Problem with json-httpresponse (Solved)
Posted: Saturday 27 January 2024 21:16
I get data from a web thermostat which I can access from an IP address.
In DZVENTS the code script checks 3 variables.
Only the code line with the temperature is working fine and can be shown in a dummy entry.
The code line with Humidity is not working and do not show any data change in the dummy entry.
The relay code line I commented for a later troubleshooting.
Could there be a simple reason I overlook?
The IDX value is correct.
Error log says only: Error: dzVents: Error: (3.1.8) ESP32: No status provided. Humidity not set
Thanks, Paco
In DZVENTS the code script checks 3 variables.
Only the code line with the temperature is working fine and can be shown in a dummy entry.
The code line with Humidity is not working and do not show any data change in the dummy entry.
The relay code line I commented for a later troubleshooting.
Could there be a simple reason I overlook?
The IDX value is correct.
Error log says only: Error: dzVents: Error: (3.1.8) ESP32: No status provided. Humidity not set
Thanks, Paco
Code: Select all
{
"type":"TH&Relay",
"name":"Thermostaat",
"version":"4",
"relay_error":"",
"th_error":"",
"mac":"",
"relay_high": "0",
"relay_high_level": "1",
"celsius":"17.90",
"fahrenheit":"64.22",
"humidity":"58.00",
"wifi_ssi": "-46"
}Code: Select all
local scriptVar = 'ESP32'
return
{
on =
{
timer =
{
'every minute',
},
httpResponses =
{
scriptVar .. '*',
},
},
logging =
{
level = domoticz.LOG_DEBUG, -- set to domoticz.LOG_ERROR when all OK
marker = scriptVar,
},
execute = function(dz, item)
local temperature = dz.devices(32) -- set to id of your virtual temperature sensor
local humidity = dz.devices(64) -- set to id of your virtual humidity sensor
-- local relay = dz.devices(34) -- set to id of your virtual text device
if item.isTimer then
dz.openURL(
{
url = '192.168.1.19',
callback = scriptVar .. '_getJSON',
})
elseif item.isHTTPResponse and item.isJSON then
temperature.updateTemperature(item.json.celsius)
humidity.updateHumidity(item.json.humidity)
-- relay.updateText(item.json.relay_high)
else
dz.log('There was a problem handling the request', dz.LOG_ERROR)
dz.log(item, domoticz.LOG_DEBUG)
end
end
}