Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Barometric sensor #21

Open
flatsiedatsie opened this issue Nov 20, 2018 · 7 comments
Open

Support for Barometric sensor #21

flatsiedatsie opened this issue Nov 20, 2018 · 7 comments

Comments

@flatsiedatsie
Copy link
Contributor

flatsiedatsie commented Nov 20, 2018

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.

@tsathishkumar
Copy link
Owner

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

@flatsiedatsie
Copy link
Contributor Author

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	""

@tsathishkumar
Copy link
Owner

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

@flatsiedatsie
Copy link
Contributor Author

flatsiedatsie commented Dec 4, 2018

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

@tsathishkumar
Copy link
Owner

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

@flatsiedatsie
Copy link
Contributor Author

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" } }

@tsathishkumar
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants