Thanks for helping.
theTemp & theTempAgain (like deel1 & deel2) were just efforts to break my lines into smaller parts, trying to find the problem.
I made the changes and added the log line. I don't get error messages, but I don't get values either... The command in the string is right, i check this with
It just doesn't get processed a command. Code. Function. Whatever it is
That is why I started experimenting with load(), trying to execute the string. B ut perhaps I am trying to do this in an insane way, I am open from suggestions
I like a good bug hunting in my scripts, but it has to make sense at t he end of the day. I just want to make it flexible. Now I take several measurements from 3, 6 and 9 hours, but perhaps I want to use every hour, or more measurements per hour. That is why I thought it would be easy to put stuff in a table. The device index, the units, the name how to get them (like .feels_like) and everything needed to construct the final command (like "domoticz.devices(thedummydevice).updateTemperature(OWMMain.hourly[3].temp) and execute that. Alas.
Code: Select all
2020-06-17 09:12:39.540 Status: User: Admin initiated a switch command (2308/CheckOWM/On)
2020-06-17 09:12:39.555 Status: Incoming connection from: 192.168.8.155
2020-06-17 09:12:39.716 Status: dzVents: Info: Handling events for: "CheckOWM", value: "On"
2020-06-17 09:12:39.716 Status: dzVents: Info: OWM: ------ Start internal script: test OWM: Device: "CheckOWM (OpenWeatherDummies)", Index: 2308
2020-06-17 09:12:39.717 Status: dzVents: Debug: OWM: OpenURL: url = http://api.openweathermap.org/data/2.5/onecall?<removed>
2020-06-17 09:12:39.717 Status: dzVents: Debug: OWM: OpenURL: method = GET
2020-06-17 09:12:39.717 Status: dzVents: Debug: OWM: OpenURL: post data = nil
2020-06-17 09:12:39.717 Status: dzVents: Debug: OWM: OpenURL: headers = nil
2020-06-17 09:12:39.717 Status: dzVents: Debug: OWM: OpenURL: callback = OWMForecast
2020-06-17 09:12:39.718 Status: dzVents: Info: OWM: ------ Finished test OWM
2020-06-17 09:12:39.718 Status: EventSystem: Script event triggered: /home/pi/domoticz/dzVents/runtime/dzVents.lua
2020-06-17 09:12:40.062 Status: dzVents: HTTPResponse> main: Rain
2020-06-17 09:12:40.062 Status: dzVents: HTTPResponse> icon: 10d
2020-06-17 09:12:40.062 Status: dzVents: HTTPResponse> pressure: 1013
2020-06-17 09:12:40.062 Status: dzVents: HTTPResponse> wind_speed: 2.51
2020-06-17 09:12:40.062 Status: dzVents: HTTPResponse> wind_deg: 275
2020-06-17 09:12:40.062 Status: dzVents: HTTPResponse> feels_like: 14.35
2020-06-17 09:12:40.062 Status: dzVents: HTTPResponse> temp: 14.79
2020-06-17 09:12:40.062 Status: dzVents: HTTPResponse> 47:
2020-06-17 09:12:40.062 Status: dzVents: HTTPResponse> humidity: 96
2020-06-17 09:12:40.062 Status: dzVents: HTTPResponse> rain:
2020-06-17 09:12:40.062 Status: dzVents: HTTPResponse> 1h: 0.36
2020-06-17 09:12:40.062 Status: dzVents: HTTPResponse> dt: 1592542800
2020-06-17 09:12:40.062 Status: dzVents: HTTPResponse> dew_point: 14.3
2020-06-17 09:12:40.062 Status: dzVents: HTTPResponse> clouds: 100
2020-06-17 09:12:40.062 Status: dzVents: HTTPResponse> weather:
2020-06-17 09:12:40.062 Status: dzVents: HTTPResponse> 1:
2020-06-17 09:12:40.062 Status: dzVents: HTTPResponse> description: light rain
2020-06-17 09:12:40.062 Status: dzVents: HTTPResponse> id: 500
2020-06-17 09:12:40.062 Status: dzVents: HTTPResponse> main: Rain
2020-06-17 09:12:40.063 Status: dzVents: HTTPResponse> icon: 10d
2020-06-17 09:12:40.063 Status: dzVents: HTTPResponse> pressure: 1014
2020-06-17 09:12:40.063 Status: dzVents: HTTPResponse> wind_speed: 2.81
2020-06-17 09:12:40.063 Status: dzVents: HTTPResponse> wind_deg: 270
2020-06-17 09:12:40.063 Status: dzVents: HTTPResponse> feels_like: 14.18
2020-06-17 09:12:40.063 Status: dzVents: HTTPResponse> temp: 14.82
2020-06-17 09:12:40.063 Status: dzVents: HTTPResponse> 48:
2020-06-17 09:12:40.063 Status: dzVents: HTTPResponse> humidity: 95
2020-06-17 09:12:40.063 Status: dzVents: HTTPResponse> rain:
2020-06-17 09:12:40.063 Status: dzVents: HTTPResponse> 1h: 0.37
2020-06-17 09:12:40.063 Status: dzVents: HTTPResponse> dt: 1592546400
2020-06-17 09:12:40.063 Status: dzVents: HTTPResponse> dew_point: 14.48
2020-06-17 09:12:40.063 Status: dzVents: HTTPResponse> clouds: 100
2020-06-17 09:12:40.063 Status: dzVents: HTTPResponse> weather:
2020-06-17 09:12:40.063 Status: dzVents: HTTPResponse> 1:
2020-06-17 09:12:40.063 Status: dzVents: HTTPResponse> description: light rain
2020-06-17 09:12:40.063 Status: dzVents: HTTPResponse> id: 500
2020-06-17 09:12:40.063 Status: dzVents: HTTPResponse> main: Rain
2020-06-17 09:12:40.063 Status: dzVents: HTTPResponse> icon: 10d
2020-06-17 09:12:40.063 Status: dzVents: HTTPResponse> pressure: 1014
2020-06-17 09:12:40.063 Status: dzVents: HTTPResponse> wind_speed: 2
2020-06-17 09:12:40.063 Status: dzVents: HTTPResponse> wind_deg: 286
2020-06-17 09:12:40.063 Status: dzVents: HTTPResponse> feels_like: 15.11
2020-06-17 09:12:40.063 Status: dzVents: HTTPResponse> temp: 15.13
2020-06-17 09:12:40.064 Status: dzVents: HTTPResponse> lon: 6.13
2020-06-17 09:12:40.064 Status: dzVents: HTTPResponse> timezone_offset: 7200
2020-06-17 09:12:40.064 Status: dzVents: HTTPResponse> trigger: OWMForecast
2020-06-17 09:12:40.064 Status: dzVents: HTTPResponse> isVariable: false
2020-06-17 09:12:40.064 Status: dzVents: HTTPResponse> isCustomEvent: false
2020-06-17 09:12:40.064 Status: dzVents: HTTPResponse> statusCode: 200
2020-06-17 09:12:40.064 Status: dzVents: HTTPResponse> isHardware: false
2020-06-17 09:12:40.064 Status: dzVents: HTTPResponse> isTimer: false
2020-06-17 09:12:40.064 Status: dzVents: HTTPResponse> isSystem: false
2020-06-17 09:12:40.064 Status: dzVents: HTTPResponse> statusText: OK
2020-06-17 09:12:40.064 Status: dzVents: HTTPResponse> dump()
2020-06-17 09:12:40.064 Status: dzVents: HTTPResponse> isScene: false
2020-06-17 09:12:40.065 Status: dzVents: Info: OWM: {["ok"]=true, ["isXML"]=false, ["headers"]={["Access-Control-Allow-Origin"]="*", ["X-Cache-Key"]="/data/2.5/onecall?,removed>&units=metric", ["Content-Type"]="application/json; charset=utf-8", ["Server"]="openresty", ["Access-Control-Allow-Credentials"]="true", ["Content-Length"]="14698", ["Access-Control-Allow-Methods"]="GET, POST", ["Date"]="Wed, 17 Jun 2020 07:12:39 GMT", ["Connection"]="keep-alive"}, ["isGroup"]=false, ["isJSON"]=true, ["isSecurity"]=false, ["protocol"]="HTTP/1.1", ["isDevice"]=false, ["data"]="{"lat":53.31,"lon":6.13,"timezone":"Europe/Amsterdam","timezone_offset":7200,"current":{"dt":1592377804,"sunrise":1592363220,"sunset":1592424359,"temp":16.51,"feels_like":17.14,"pressure":1012,"humidity":85,"dew_point":13.98,"uvi":7.06,"clouds":25,"wind_speed":0.89,"wind_deg":12,"wind_gust":2.68,"weather":[{"id":802,"main":"Clouds","description":"scattered clouds","icon":"03d"}]},"hourly":[{"dt":1592377200,"temp":16.51,"feels_like":16.49,"pressure":1012,"humidity":85,"dew_point":13.98,"clouds":25,"wind_speed":1.82,"wind_deg":49,"weather":[{"id":802,"main":"Clouds","description":"scattered clouds","icon":"03d"}]},{"dt":1592380800,"temp":17.34,"feels_like":17.21,"pressure":1013,"humidity":81,"dew_point":14.05,"clouds":30,"wind_speed":2.02,"wind_deg":41,"weather":[{"id":802,"main":"Clouds","description":"scattered clouds","icon":"03d"}]},{"dt":1592384400,"temp":18.54,"feels_like":17.87,"pressure":1014,"humidity":76,"dew_point":14.23,"clouds":37,"wind_speed":2.88,"wind_deg":40,"weather":[{"id":802,"main":"Clouds","description":"scattered clouds","icon":"03d"}]},{"dt":1592388000,"temp":19.27,"feels_like":18.15,"pressure":1014,"humidity":72,"dew_point":14.1,"clouds":53,"wind_speed":3.45,"wind_deg":41,"weather":[{"id":803,"main":"Clouds","description":"broken clouds","icon":"04d"}]},{"dt":1592391600,"temp":19.74,"feels_like":18.71,"pressure":1014,"humidity":72,"dew_point":14.55,"clouds":64,"wind_speed":3.55,"wind_deg":37,"weather":[{"id":803,"main":"Clouds","description":"broken clouds","icon":"04d"}]},{"dt":1592395200,"temp":19.88,"feels_like":18.67,"pressure":1014,"humidity":71,"dew_point":14.54,"clouds":70,"wind_speed":3.77,"wind_deg":34,"weather":[{"id":803,"main":"Clouds","description":"broken clouds","icon":"04d"}]},{"dt":1592398800,"temp":19.42,"feels_like":17.6,"pressure":1013,"humidity":71,"dew_point":14.21,"clouds":100,"wind_speed":4.42,"wind_deg":29,"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04d"}]},{"dt":1592402400,"temp":19.12,"feels_like":16.71,"pressure":1013,"humidity":70,"dew_point":13.64,"clouds":100,"wind_speed":5.02,"wind_deg":31,"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04d"}]},{"dt":1592406000,"temp":18.93,"feels_like":16.24,"pressure":1012,"humidity":71,"dew_point":13.58,"clouds":97,"wind_speed":5.43,"wind_deg":34,"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04d"}]},{"dt":1592409600,"temp":18.48,"feels_like":15.66,"pressure":1012,"humidity":72,"dew_point":13.41,"clouds":98,"wind_speed":5.52,"wind_deg":38,"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04d"}]},{"dt":1592413200,"temp":17.7,"feels_like":14.91,"pressure":1012,"humidity":74,"dew_point":13.03,"clouds":98,"wind_speed":5.32,"wind_deg":37,"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04d"}]},{"dt":1592416800,"temp":16.81,"feels_like":13.9,"pressure":1012,"humidity":75,"dew_point":12.54,"clouds":99,"wind_speed":5.2,"wind_deg":39,"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04d"}]},{"dt":1592420400,"temp":16.28,"feels_like":13.4,"pressure":1012,"humidity":76,"dew_point":12.2,"clouds":100,"wind_speed":5.02,"wind_deg":45,"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04d"}]},{"dt":1592424000,"temp":16.04,"feels_like":13.26,"pressure":1013,"humidity":75,"dew_point":11.76,"clouds":100,"wind_speed":4.69,"wind_deg":47,"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04d"}]},{"dt":1592427600,"temp":15.76,"feels_like":12.87,"pressure":1013,"humidity":76,"dew_point":11.62,"clouds":100,"wind_speed":4.82,"wind_deg":48,"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04n"}]},{"dt":1592431200,"temp":15.58,"feels_like":12.81,"pressure":1012,"humidity":79,"dew_point":11.96,"clouds":100,"wind_speed":4.82,"wind_deg":52,"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04n"}]},{"dt":1592434800,"temp":15.13,"feels_like":12.53,"pressure":1012,"humidity":84,"dew_point":12.6,"clouds":94,"wind_speed":4.8,"wind_deg":56,"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04n"}]},{"dt":1592438400,"temp":15.2,"feels_like":13.06,"pressure":1012,"humidity":88,"dew_point":13.38,"clouds":94,"wind_speed":4.5,"wind_deg":63,"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04n"}]},{"dt":1592442000,"temp":15.28,"feels_like":13.48,"pressure":1012,"humidity":91,"dew_point":13.9,"clouds":100,"wind_speed":4.29,"wind_deg":74,"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04n"}]},{"dt":1592445600,"temp":15.16,"feels_like":13.64,"pressure":1012,"humidity":93,"dew_point":14.12,"clouds":99,"wind_speed":4,"wind_deg":87,"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04n"}]},{"dt":1592449200,"temp":15.29,"feels_like":13.99,"pressure":1012,"humidity":94,"dew_point":14.36,"clouds":99,"wind_speed":3.82,"wind_deg":89,"weather":[{"id":500,"main":"Rain","description":"light rain","icon":"10n"}],"rain":{"1h":0.14}},{"dt":1592452800,"temp":15.68,"feels_like":14.42,"pressure":1011,"humidity":92,"dew_point":14.55,"clouds":99,"wind_speed":3.79,"wind_deg":92,"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04d"}]},{"dt":1592456400,"temp":16.03,"feels_like":14.87,"pressure":1011,"humidity":92,"dew_point":14.81,"clouds":99,"wind_speed":3.82,"wind_deg":99,"weather":[{"id":500,"main":"Rain","description
2020-06-17 09:12:40.085 Status: dzVents: Debug: OWM: Processing device-adapter for Min temp vandaag: Temperature device adapter
2020-06-17 09:12:40.087 Status: dzVents: Debug: OWM: Processing device-adapter for Max temp vandaag: Temperature device adapter
2020-06-17 09:12:40.087 Status: dzVents: Debug: OWM: k=2288 v[1]=forecast_temp_9h_deviceName v[2]=temp v[3]=Temperatuur om v[4]=OWMMain.hourly[9]
2020-06-17 09:12:40.087 Status: dzVents: Debug: OWM: *** theTemp: OWMMain.hourly[9].temp 18.54
2020-06-17 09:12:40.087 Status: dzVents: Debug: OWM: *** theTempAgain: OWMMain.hourly[9].temp
2020-06-17 09:12:40.088 Status: dzVents: Debug: OWM: Processing device-adapter for Temperatuur over 9 uur: Temperature device adapter
2020-06-17 09:12:40.088 Status: dzVents: Debug: OWM: updating temps: k=2288 v[4]=OWMMain.hourly[9] v[2]=temp
2020-06-17 09:12:40.088 Status: dzVents: Debug: OWM: k=2305 v[1]=forecast_tempFeels_6h_deviceName v[2]=feels_like v[3]=Gevoelstemperatuur om v[4]=OWMMain.hourly[6]
2020-06-17 09:12:40.089 Status: dzVents: Debug: OWM: *** theTemp: OWMMain.hourly[6].feels_like 18.54
2020-06-17 09:12:40.089 Status: dzVents: Debug: OWM: *** theTempAgain: OWMMain.hourly[6].feels_like
2020-06-17 09:12:40.090 Status: dzVents: Debug: OWM: Processing device-adapter for Gevoelstemperatuur over 6 uur: Temperature device adapter
2020-06-17 09:12:40.090 Status: dzVents: Debug: OWM: updating temps: k=2305 v[4]=OWMMain.hourly[6] v[2]=feels_like
2020-06-17 09:12:40.090 Status: dzVents: Debug: OWM: k=2306 v[1]=forecast_tempFeels_9h_deviceName v[2]=feels_like v[3]=Gevoelstemperatuur om v[4]=OWMMain.hourly[9]
2020-06-17 09:12:40.090 Status: dzVents: Debug: OWM: *** theTemp: OWMMain.hourly[9].feels_like 18.54
2020-06-17 09:12:40.090 Status: dzVents: Debug: OWM: *** theTempAgain: OWMMain.hourly[9].feels_like
2020-06-17 09:12:40.091 Status: dzVents: Debug: OWM: Processing device-adapter for Gevoelstemperatuur over 9 uur: Temperature device adapter
2020-06-17 09:12:40.091 Status: dzVents: Debug: OWM: updating temps: k=2306 v[4]=OWMMain.hourly[9] v[2]=feels_like
2020-06-17 09:12:40.091 Status: dzVents: Debug: OWM: k=2304 v[1]=forecast_tempFeels_3h_deviceName v[2]=feels_like v[3]=Gevoelstemperatuur om v[4]=OWMMain.hourly[3]
2020-06-17 09:12:40.091 Status: dzVents: Debug: OWM: *** theTemp: OWMMain.hourly[3].feels_like 18.54
2020-06-17 09:12:40.092 Status: dzVents: Debug: OWM: *** theTempAgain: OWMMain.hourly[3].feels_like
2020-06-17 09:12:40.093 Status: dzVents: Debug: OWM: Processing device-adapter for Gevoelstemperatuur om 11:00 uur:: Temperature device adapter
2020-06-17 09:12:40.093 Status: dzVents: Debug: OWM: updating temps: k=2304 v[4]=OWMMain.hourly[3] v[2]=feels_like
2020-06-17 09:12:40.093 Status: dzVents: Debug: OWM: k=2286 v[1]=forecast_temp_3h_deviceName v[2]=temp v[3]=Temperatuur om v[4]=OWMMain.hourly[3]
2020-06-17 09:12:40.093 Status: dzVents: Debug: OWM: *** theTemp: OWMMain.hourly[3].temp 18.54
2020-06-17 09:12:40.093 Status: dzVents: Debug: OWM: *** theTempAgain: OWMMain.hourly[3].temp
2020-06-17 09:12:40.094 Status: dzVents: Debug: OWM: Processing device-adapter for Temperatuur om 11:00 uur:: Temperature device adapter
2020-06-17 09:12:40.094 Status: dzVents: Debug: OWM: updating temps: k=2286 v[4]=OWMMain.hourly[3] v[2]=temp
2020-06-17 09:12:40.094 Status: dzVents: Debug: OWM: k=2287 v[1]=forecast_temp_6h_deviceName v[2]=temp v[3]=Temperatuur om v[4]=OWMMain.hourly[6]
2020-06-17 09:12:40.095 Status: dzVents: Debug: OWM: *** theTemp: OWMMain.hourly[6].temp 18.54
2020-06-17 09:12:40.095 Status: dzVents: Debug: OWM: *** theTempAgain: OWMMain.hourly[6].temp
2020-06-17 09:12:40.096 Status: dzVents: Debug: OWM: Processing device-adapter for Temperatuur over 6 uur: Temperature device adapter
2020-06-17 09:12:40.096 Status: dzVents: Debug: OWM: updating temps: k=2287 v[4]=OWMMain.hourly[6] v[2]=temp
2020-06-17 09:12:40.096 Status: dzVents: Debug: OWM: OpenURL: url = http://127.0.0.1:18080/json.htm?type=command¶m=renamedevice&idx=2286&name=Temperatuur+om+11%3A00+uur%3A
2020-06-17 09:12:40.096 Status: dzVents: Debug: OWM: OpenURL: method = GET
2020-06-17 09:12:40.096 Status: dzVents: Debug: OWM: OpenURL: post data = nil
2020-06-17 09:12:40.096 Status: dzVents: Debug: OWM: OpenURL: headers = nil
2020-06-17 09:12:40.096 Status: dzVents: Debug: OWM: OpenURL: callback = nil
2020-06-17 09:12:40.096 Status: dzVents: Debug: OWM: OpenURL: url = http://127.0.0.1:18080/json.htm?type=command¶m=renamedevice&idx=2304&name=Gevoelstemperatuur+om+11%3A00+uur%3A
2020-06-17 09:12:40.096 Status: dzVents: Debug: OWM: OpenURL: method = GET
2020-06-17 09:12:40.097 Status: dzVents: Debug: OWM: OpenURL: post data = nil
2020-06-17 09:12:40.097 Status: dzVents: Debug: OWM: OpenURL: headers = nil
2020-06-17 09:12:40.097 Status: dzVents: Debug: OWM: OpenURL: callback = nil
2020-06-17 09:12:40.097 Status: dzVents: Info: OWM: ------ Finished test OWM