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

Added support for smart rain gauge and anemometer #3

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

sscheib
Copy link

@sscheib sscheib commented May 19, 2020

Hello,

simply added support for the smart rain gauge and the anemometer of Netatmo to both the Python version and the Zabbix template.
The code is otherwise untouched, however the export of the Zabbix template was done using Zabbix 4.4 (yours was 3.x).

@pfoo
Copy link
Owner

pfoo commented Nov 21, 2020

Are rain gauge and anemometer modules not providing the ['data_type'] json part allowing for at least some dashboard_data autodiscovery ? I don't own any of them..
Because this allows shorter code (instead of one print for each windangle, guststrength, gustangle, max_wind_angle, max_wind_str, date_max_wind_str, ...)

For example, internal module provide ['devices']['x']['modules']['x']['data_type'] stating the module provide temperature, CO2 and humidity, which then allow to print(dashboard_data) while looping in data_type
This also allows to keep the same code for all modules (at least for internal/external) instead of module-specific-code

I can take a look at it if you provide a complete response json. Don't forget to anonymize it (at least for mail, home_id, _id, city, location as far as i remember)
Simpliest way to do this is :

  • adding print(json.dumps(data)) just after data = response.json()['body']
  • and import json on top of file

@sscheib
Copy link
Author

sscheib commented Nov 21, 2020

They actually do and your approach sounds absolutely reasonable, however I do not have time for it at the moment, hence I provide you the output as you asked for ("sensitive" data has been replaced with "hidden"):
{ "devices":[ { "_id":"70:ee:50:3a:10:d2", "station_name":"hidden", "date_setup":1547574533, "last_setup":1547574533, "type":"NAMain", "last_status_store":1605955516, "module_name":"hidden", "firmware":178, "last_upgrade":1547574534, "wifi_status":50, "reachable":true, "co2_calibrating":false, "data_type":[ "Temperature", "CO2", "Humidity", "Noise", "Pressure" ], "place":{ "altitude":hidden, "city":"hidden", "country":"hidden", "timezone":"hidden", "location":[ hidden, hidden ] }, "home_id":"hidden", "home_name":"hidden", "dashboard_data":{ "time_utc":1605955513, "Temperature":19.9, "CO2":494, "Humidity":43, "Noise":39, "Pressure":1031.8, "AbsolutePressure":1005.7, "min_temp":19.9, "max_temp":20.9, "date_max_temp":1605913319, "date_min_temp":1605954906, "temp_trend":"down", "pressure_trend":"stable" }, "modules":[ { "_id":"03:00:00:07:47:de", "type":"NAModule4", "module_name":"hidden", "last_setup":1547575239, "data_type":[ "Temperature", "CO2", "Humidity" ], "battery_percent":58, "reachable":true, "firmware":50, "last_message":1605955513, "last_seen":1605955500, "rf_status":66, "battery_vp":5250, "dashboard_data":{ "time_utc":1605955500, "Temperature":20, "CO2":420, "Humidity":42, "min_temp":19.9, "max_temp":21, "date_max_temp":1605913305, "date_min_temp":1605937504, "temp_trend":"down" } }, { "_id":"03:00:00:07:d2:26", "type":"NAModule4", "module_name":"hidden", "last_setup":1554211308, "data_type":[ "Temperature", "CO2", "Humidity" ], "battery_percent":66, "reachable":true, "firmware":50, "last_message":1605955513, "last_seen":1605955468, "rf_status":70, "battery_vp":5391, "dashboard_data":{ "time_utc":1605955468, "Temperature":18.5, "CO2":1190, "Humidity":55, "min_temp":18.5, "max_temp":19.3, "date_max_temp":1605921168, "date_min_temp":1605952033, "temp_trend":"stable" } }, { "_id":"02:00:00:3f:74:e0", "type":"NAModule1", "module_name":"Outdoor", "last_setup":1568033095, "data_type":[ "Temperature", "Humidity" ], "battery_percent":75, "reachable":true, "firmware":50, "last_message":1605955513, "last_seen":1605955506, "rf_status":58, "battery_vp":5404, "dashboard_data":{ "time_utc":1605955506, "Temperature":2.7, "Humidity":92, "min_temp":-1.6, "max_temp":2.7, "date_max_temp":1605955506, "date_min_temp":1605932948, "temp_trend":"up" } }, { "_id":"05:00:00:06:c5:a8", "type":"NAModule3", "module_name":"hidden", "last_setup":1589791292, "data_type":[ "Rain" ], "battery_percent":87, "reachable":true, "firmware":12, "last_message":1605955513, "last_seen":1605955513, "rf_status":62, "battery_vp":5710, "dashboard_data":{ "time_utc":1605955513, "Rain":0, "sum_rain_1":0, "sum_rain_24":0 } }, { "_id":"06:00:00:04:7f:1c", "type":"NAModule2", "module_name":"hidden", "last_setup":1597997553, "data_type":[ "Wind" ], "battery_percent":88, "reachable":true, "firmware":25, "last_message":1605955513, "last_seen":1605955513, "rf_status":56, "battery_vp":5755, "dashboard_data":{ "time_utc":1605955513, "WindStrength":0, "WindAngle":-1, "GustStrength":3, "GustAngle":333, "max_wind_str":8, "max_wind_angle":334, "date_max_wind_str":1605934505 } } ] } ], "user":{ "mail":"hidden", "administrative":{ "lang":"en", "reg_locale":"en-US", "country":"EN_GB", "unit":0, "windunit":0, "pressureunit":0, "feel_like_algo":0 } } }

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

Successfully merging this pull request may close these issues.

2 participants