MySController-rs icon indicating copy to clipboard operation
MySController-rs copied to clipboard

Support for Barometric sensor

Open flatsiedatsie opened this issue 6 years ago • 7 comments

Air pressure is used by barometers. Tracking it is useful for local weather prediction. It is measured in mbar, and oscillates around a value of 1013. (900-1100).

https://en.wikipedia.org/wiki/Atmospheric_pressure

in MySensors this is initiated as follows:

MyMessage pressureMsg(BARO_CHILD_ID, V_PRESSURE); MyMessage forecastMsg(BARO_CHILD_ID, V_FORECAST);

So a child can receive two values:

  • pressure in mbar
  • a code value that indicates upcoming weather.

The codes are: #define STABLE 0 // "Stable Weather Pattern" #define SUNNY 1 // "Slowly rising Good Weather", "Clear/Sunny " #define CLOUDY 2 // "Slowly falling L-Pressure ", "Cloudy/Rain " #define UNSTABLE 3 // "Quickly rising H-Press", "Not Stable" #define THUNDERSTORM 4 // "Quickly falling L-Press", "Thunderstorm" #define UNKNOWN 5 // "Unknown (More Time needed)

Supporting just the pressure would already be great. A lot of controllers can calculate the weather prediction from that themselves.

Another solution to the "human readable" issue would be the support of text sensors. There is an issue about that already.

flatsiedatsie avatar Nov 20 '18 09:11 flatsiedatsie

I have just pushed the support for Barometer. Let me know if it works.

tsathishkumar avatar Nov 20 '18 10:11 tsathishkumar

The pressure level works. But the forecast number doesn't seem to work.

http://192.168.2.110:8888/1/properties/forecast

Shows:

{"forecast":true}

So it gives a boolean, even though the properties would indicate that it is a string:

http://192.168.2.110:8888/1/properties results in

@context	"https://iot.mozilla.org/schemas"
@type	
0	"multiLevelSensor"
actions	{}
description	"Barometer sensor"
events	{}
href	"/1"
links	
0	
href	"/1/properties"
rel	"properties"
1	
href	"/1/actions"
rel	"actions"
2	
href	"/1/events"
rel	"events"
3	
href	"ws://192.168.2.110:8888/1"
rel	"alternate"
name	"New Node - Barometer sensor"
properties	
forecast	
description	"Forecast predicted by sensor"
href	"/1/properties/forecast"
type	"string"
unit	""
level	
description	"Pressure measured by sensor"
href	"/1/properties/level"
type	"number"
unit	""

flatsiedatsie avatar Nov 29 '18 13:11 flatsiedatsie

Did the sensor send any forecast? If you could let me know of the message sent from sensors, it would be helpful to test.

tsathishkumar avatar Nov 29 '18 15:11 tsathishkumar

In theory it seems to send the data ok. But Mozilla Gateway still just says "true".

 INFO 2018-12-03T08:25:02Z: myscontroller_rs::core::connection: 0.0.0.0:5003 >> "3;2;1;0;5;Stable\n"
 INFO 2018-12-03T08:25:02Z: myscontroller_rs::core::connection: 0.0.0.0:8088 << "3;2;1;0;5;Stable\n"
 INFO 2018-12-03T08:25:02Z: myscontroller_rs::wot: Received SetMessage { node_id: 3, child_sensor_id: 2, ack: 0, value: Value { set_type: Forecast, value: "Stable" } }

forecast-true

flatsiedatsie avatar Dec 04 '18 07:12 flatsiedatsie

This is strange. I think there is some issue with the Mozilla gateway. I'll try to simulate it in my local setup.

tsathishkumar avatar Dec 04 '18 12:12 tsathishkumar

Here are some debug codes:

INFO 2018-12-10T15:56:49Z: myscontroller_rs::wot: Received SetMessage { node_id: 3, child_sensor_id: 2, ack: 0, value: Value { set_type: Forecast, value: "Stable" } } WARN 2018-12-10T15:56:49Z: myscontroller_rs::wot: Unsupported set message SetMessage { node_id: 3, child_sensor_id: 2, ack: 0, value: Value { set_type: Forecast, value: "Stable" } }

flatsiedatsie avatar Dec 10 '18 15:12 flatsiedatsie

This helps. Let me check why it is not supported.

tsathishkumar avatar Dec 11 '18 06:12 tsathishkumar