Benutzer-Werkzeuge

Webseiten-Werkzeuge


hardware:channels:sensors:sensorless_outdoor_temp

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Beide Seiten der vorigen RevisionVorhergehende Überarbeitung
hardware:channels:sensors:sensorless_outdoor_temp [2020/04/27 14:44] – Fixed typos trabanthardware:channels:sensors:sensorless_outdoor_temp [2020/07/17 12:37] (aktuell) – Script Einrückung korrigiert jau
Zeile 28: Zeile 28:
 from requests import get,post from requests import get,post
  
-url = "http://api.openweathermap.org/data/2.5/weather?id=<CITY-ID>&APPID=<HIER DIE EIGENE APP-ID VON OPENWHEATHERMAP EINFÜGEN>&units=metric"+url = "http://api.openweathermap.org/data/2.5/weather?id=2845222&APPID=a9a65433e56edeee32db51a8f283a03f&units=metric"
  
 try: try:
-  resp = get(url) +    resp = get(url) 
-  data = resp.json()+    data = resp.json()
 except: except:
-  print("URL load failed"+    print("URL load failed"
-  raise SystemExit(2)+    raise SystemExit(2)
  
 temp = float(data["main"]["temp"]) temp = float(data["main"]["temp"])
Zeile 42: Zeile 42:
  
 try: try:
-  post("http://localhost/middleware/data/<CHANNEL-UUID>.json", data={"value" : temp }) +    post("http://localhost/middleware/data/70919b00-c5f8-11ea-8152-ed29ae9e5e38.json", data={"value" : temp }) 
-  #post("http://localhost/middleware/data/<CHANNEL-UUID>.json", data={"value" : pres }) +    #post("http://localhost/middleware/data/<CHANNEL-UUID>.json", data={"value" : pres }) 
-  #post("http://localhost/middleware/data/<CHANNEL-UUID>.json", data={"value" : humi })+    #post("http://localhost/middleware/data/<CHANNEL-UUID>.json", data={"value" : humi })
 except: except:
-  print("Couldn't post to VZ Middleware."+    print("Couldn't post to VZ Middleware."
-  raise SystemExit(3)+    raise SystemExit(3)
 </code> </code>
 Wer möchte kann auch Luftdruck und Luftfeuchte importieren, dazu einfach die auskommentierten Zeilen entsprechend aktivieren. Wer möchte kann auch Luftdruck und Luftfeuchte importieren, dazu einfach die auskommentierten Zeilen entsprechend aktivieren.
hardware/channels/sensors/sensorless_outdoor_temp.txt · Zuletzt geändert: 2020/07/17 12:37 von jau