uccwhity

ReadNetatmoData

Mar 1st, 2021 (edited)
106
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /////////////////////////////////////////////////////////////////////////////////////////
  2. //
  3. //  Geschrieben von Thomas Weiß, 28.02.2021, Verion 1.0
  4. //
  5. //  Das Modul steuert Pool und Klimaanlage
  6. //
  7. ///////////////////////////////////////////////////////////////////////////////////////////
  8.  
  9. // -------------------------------------------------------------------------------
  10. // ---- Einstellungen
  11. // -------------------------------------------------------------------------------
  12. var bDebug = 1
  13.  
  14. // -------------------------------------------------------------------------------
  15. // ---- Hilfsvariablen
  16. // -------------------------------------------------------------------------------
  17.  
  18. // -------------------------------------------------------------------------------
  19. // ---- Netatmo Thermnostate haben die API verändert, das Biding kann nicht mehr einlesen
  20. // -------------------------------------------------------------------------------
  21.  
  22. // -------------------------------------------------------------------------------
  23. // ---- Bad
  24. // -------------------------------------------------------------------------------
  25. rule "GetNetatmoData1"
  26. when Time cron "0 0/1 * 1/1 * ? *" or              // ( http://www.cronmaker.com/ )
  27.      System started
  28. then
  29.     var String fileContent = sendHttpGetRequest("http://192.168.220.101:8080/static/netatmo_therm_bath_data.json")      
  30.     if (bDebug==1) logInfo("GetNetatmoData", fileContent)
  31.     //Werte
  32.     var sValue  = transform("JSONPATH", "body.home.rooms..therm_setpoint_temperature", fileContent.toString)        //Sollwert
  33.     var sValue2  = transform("JSONPATH", "body.home.rooms..therm_measured_temperature", fileContent.toString)       //Istwert
  34.     var sValue3  = transform("JSONPATH", "body.home.rooms..therm_setpoint_mode", fileContent.toString)              //Status
  35.     if (bDebug==1) logInfo("GetNetatmoData", "Sollwert Bad =" + sValue + " / Istwert Bad =" + sValue2 + " / Status Bad =" + sValue3)
  36.     //Übergabe
  37.     sendCommand("RaumthermostatBad_Temperatur",  sValue2.toString )  
  38.     sendCommand("RaumthermostatBad_Setpoint",  sValue.toString )  
  39.     sendCommand("ThermostatModuleFlur_SetpointMode",  sValue3.toString )  
  40.  
  41.     // -------------------------------------------------------------------------------
  42.     // ---- Küche
  43.     // -------------------------------------------------------------------------------
  44.  
  45.     // -------------------------------------------------------------------------------
  46.     // ---- Wohnzimmer
  47.     // -------------------------------------------------------------------------------
  48.  
  49.     // -------------------------------------------------------------------------------
  50.     // ---- Flur
  51.     // -------------------------------------------------------------------------------
  52.  
  53. end
RAW Paste Data