Weather Sensor Message Format

Sensors are activated by the cron system or they run as part of a daemon process. Sensor values that are collected are sent to the LamPI-daemon process for further processing. In order for the daemon to correctly recognize all messages coming in, a standard message format is defined that all sensors should use in order to assure correct interpretation.

Messages are broadcasted to LamPI-daemon as a text buffer over UDP port 5001 (default).

The message format is in JSON and is defined as follows:

message: {"tcnt":"<transaction_id>","action":"weather","brand":"<your_brand>","type":"json","address":"<address>","channel":"<channel>",["<sensor_id>":"<sensor_value>"],..}

The first part of every message is standard and all fields should be present. Their definitions are as follows:

Sensor_id

The following sensor types/commands are recognized by the system:

Example:

{"tcnt":"529","action":"weather","brand":"wt440h","type":"json","address":"1","channel":"0","temperature":"27.5","humidity":"47","windspeed":"","winddirection":"","rainfall":""}

LM75a messages

The LM75a has 3 address bits, corresponding to the data connections A2, A1 and A0 on the chip. By connecting these address lines to either Vcc for a 1 and to GND for a 0 encoding, we can select 8 devices on the bus.

 

BMP085 and BMP180 messages

The BMP085 and BMP180 sensors do not have the possibility to use a subaddress which is coded in the hardware setup. And as LamPI-node process only looks at the address / channel combination to identify the sensor uniquely, we should add a unique channel for each sensor we have on the system. And as the system in its current setup will only allow one BMP085 or BMP180 sensor on the bus, it would be safe to use the last byte fo the IP address for this unique recognition.

The reason why this makes sense is: In the sensor code we do NOT have access to the database in order to check other sensor characteristics so we need something simple that can be generated on the client sensor in a fast, lightweight and easy way.