Skip to content

Commit

Permalink
Changed from station_name to home_name because of API change by Netatmo
Browse files Browse the repository at this point in the history
Changed from station_name to home_name because of API change by Netatmo
  • Loading branch information
Michael Miklis committed Dec 23, 2020
1 parent b2b2fa2 commit 3545b2a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 19 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ Das PlugIn wird von mir noch weiterentwickelt und ich freue mich über Anregunge


## Change-Log
- 2019-12-30 Release 2.0.2 - Changed from station_name to home_name because of API change by Netatmo
- 2019-12-30 Release 2.0.1 - Support für Loxberry 2.0 (getestet auf 2.0.0.4)
- 2019-05-08 Release 0.18 - Offline Module und Stationen werden ignoriert
- 2019-03-08 Release 0.17 - Netatmo Login Prozess angepasst
Expand Down
36 changes: 18 additions & 18 deletions data/netatmo.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/python3
# encoding=utf-8

# 2019-05-08 Michael Miklis (michaelmiklis.de)
# 2020-12-23 Michael Miklis (michaelmiklis.de)


import time
Expand Down Expand Up @@ -137,7 +137,7 @@ def main():
# ---------------------------------------------
# Get WiFi Signal
# ---------------------------------------------
value = "{0}.{1}.{2}={3}".format(device["station_name"], device["module_name"], "wifi_status",
value = "{0}.{1}.{2}={3}".format(device["home_name"], device["module_name"], "wifi_status",
str(device["wifi_status"]))

# send udp datagram
Expand All @@ -147,7 +147,7 @@ def main():
# ---------------------------------------------
# Get devicereachable (a.k.a. offline)
# ---------------------------------------------
value = "{0}.{1}.{2}={3}".format(device["station_name"], device["module_name"], "reachable", str(int(device["reachable"])))
value = "{0}.{1}.{2}={3}".format(device["home_name"], device["module_name"], "reachable", str(int(device["reachable"])))

# send udp datagram
sendudp(value, miniserverIP, virtualUDPPort)
Expand Down Expand Up @@ -177,27 +177,27 @@ def main():
# Subtract time / date offset
loxSensorTime = sensorTime - loxBaseEpoch;

value = "{0}.{1}.{2}={3}".format(device["station_name"], device["module_name"], sensor,
value = "{0}.{1}.{2}={3}".format(device["home_name"], device["module_name"], sensor,
loxSensorTime)

# convert trend values down,up,stable into -1, 1 and 0
elif (sensor.lower() == "pressure_trend") or (sensor.lower() == "temp_trend"):

if device["dashboard_data"][sensor] == "up":
value = "{0}.{1}.{2}={3}".format(device["station_name"], device["module_name"], sensor, "1")
value = "{0}.{1}.{2}={3}".format(device["home_name"], device["module_name"], sensor, "1")

elif device["dashboard_data"][sensor] == "down":
value = "{0}.{1}.{2}={3}".format(device["station_name"], device["module_name"], sensor, "-1")
value = "{0}.{1}.{2}={3}".format(device["home_name"], device["module_name"], sensor, "-1")

elif device["dashboard_data"][sensor] == "stable":
value = "{0}.{1}.{2}={3}".format(device["station_name"], device["module_name"], sensor, "0")
value = "{0}.{1}.{2}={3}".format(device["home_name"], device["module_name"], sensor, "0")

else:
value = "{0}.{1}.{2}={3}".format(device["station_name"], device["module_name"], sensor,
value = "{0}.{1}.{2}={3}".format(device["home_name"], device["module_name"], sensor,
str((device["dashboard_data"][sensor])))

else:
value = "{0}.{1}.{2}={3}".format(device["station_name"], device["module_name"], sensor,
value = "{0}.{1}.{2}={3}".format(device["home_name"], device["module_name"], sensor,
str((device["dashboard_data"][sensor])))

# send udp datagram
Expand All @@ -213,7 +213,7 @@ def main():
# ---------------------------------------------
# Get battery level
# ---------------------------------------------
value = "{0}.{1}.{2}={3}".format(device["station_name"], module["module_name"], "battery_percent",
value = "{0}.{1}.{2}={3}".format(device["home_name"], module["module_name"], "battery_percent",
str(module["battery_percent"]))

# send udp datagram
Expand All @@ -223,7 +223,7 @@ def main():
# ---------------------------------------------
# Get RF signal quality
# ---------------------------------------------
value = "{0}.{1}.{2}={3}".format(device["station_name"], module["module_name"], "rf_status",
value = "{0}.{1}.{2}={3}".format(device["home_name"], module["module_name"], "rf_status",
str(module["rf_status"]))

# send udp datagram
Expand All @@ -233,7 +233,7 @@ def main():
# ---------------------------------------------
# Get devicereachable (a.k.a. offline)
# ---------------------------------------------
value = "{0}.{1}.{2}={3}".format(device["station_name"], module["module_name"], "reachable", str(int(module["reachable"])))
value = "{0}.{1}.{2}={3}".format(device["home_name"], module["module_name"], "reachable", str(int(module["reachable"])))

# send udp datagram
sendudp(value, miniserverIP, virtualUDPPort)
Expand Down Expand Up @@ -264,27 +264,27 @@ def main():
# Subtract time / date offset
loxSensorTime = sensorTime - loxBaseEpoch

value = "{0}.{1}.{2}={3}".format(device["station_name"], module["module_name"], sensor,
value = "{0}.{1}.{2}={3}".format(device["home_name"], module["module_name"], sensor,
loxSensorTime)

# convert trend values down,up,stable into -1, 1 and 0
elif (sensor.lower() == "pressure_trend") or (sensor.lower() == "temp_trend"):

if module["dashboard_data"][sensor] == "up":
value = "{0}.{1}.{2}={3}".format(device["station_name"], module["module_name"], sensor, "1")
value = "{0}.{1}.{2}={3}".format(device["home_name"], module["module_name"], sensor, "1")

elif module["dashboard_data"][sensor] == "down":
value = "{0}.{1}.{2}={3}".format(device["station_name"], module["module_name"], sensor, "-1")
value = "{0}.{1}.{2}={3}".format(device["home_name"], module["module_name"], sensor, "-1")

elif module["dashboard_data"][sensor] == "stable":
value = "{0}.{1}.{2}={3}".format(device["station_name"], module["module_name"], sensor, "0")
value = "{0}.{1}.{2}={3}".format(device["home_name"], module["module_name"], sensor, "0")

else:
value = "{0}.{1}.{2}={3}".format(device["station_name"], module["module_name"], sensor,
value = "{0}.{1}.{2}={3}".format(device["home_name"], module["module_name"], sensor,
str((module["dashboard_data"][sensor])))

else:
value = "{0}.{1}.{2}={3}".format(device["station_name"], module["module_name"], sensor,
value = "{0}.{1}.{2}={3}".format(device["home_name"], module["module_name"], sensor,
str(module["dashboard_data"][sensor]))

# send udp datagram
Expand Down
2 changes: 1 addition & 1 deletion plugin.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ [email protected]
[PLUGIN]
# The version of your plugin - important if you would like to write an
# upgrade script.
VERSION=2.0.1
VERSION=2.0.2

# Short name and prefered subfolder of your Plugin (do not use blanks - they
# will be filtered - and use lowercase only)! Used for script names in
Expand Down

0 comments on commit 3545b2a

Please sign in to comment.