dannybloe wrote:
You have to make sure to use the constants as described in the documentation otherwise Domoticz will not recognize your command.
Many thanks for looking into it. The fact that it is a requirement to use the domoticz constants is very inconvenient - even in a simple example like this, I'd need to build a statement for each possible combination of humidity status and forecast, which would be too inconvenient. Given that they are just contants that are at some point just evaluated into a number, I think it would be a good idea that the number can be assigned directly or through the use of a variable.
Going ahead with my testing:
1.- I realized that the humidity status IS actualily being evaluated - although, incorrectly. See capture:
The device on the left is the "origin". As you see, it states "Comfortable" for the humidity status. This becomes copied into the device on the right by the script above (not using the domoticz constant, great!), but somehow it becomes "Normal".
I would also guess this points in the direction that it shouldn't be necessary that it is required that the forecast piece is updated using the domoticz constant.
2.- I modified my script for additional testing:
Code: Select all
return {
active = true,
on = {
timer = {'every minute'},
--devices = {'Meteo terraza'},
},
execute = function(domoticz)
local t = domoticz.devices('Meteo terraza').temperature
local h = domoticz.devices('Meteo terraza').humidity
local hs = domoticz.devices('Meteo terraza').humidityStatus
local p = domoticz.devices('WU THB LEBL').barometer
local fcst = domoticz.devices('WU THB LEBL').forecast
domoticz.devices('Humedad').updateText(hs)
domoticz.devices('fcst').updateText(fcst)
domoticz.devices('Meteo terraza corregido').updateTempHumBaro(t, h, hs, p, fcst)
domoticz.log('Meteo terraza corregido')
end
}
I also created two text virtual decices in order to see the values stored for the humidity status and the forecast ("Humedad" and "fcst").
Now I'm getting the following error:
Code: Select all
2017-07-02 20:16:00.322 dzVents: Info: ------ Start internal script: Meteo terraza:, trigger: every minute
2017-07-02 20:16:00.334 Error: dzVents: Error: There is no device with that name or id: WU THB LEBL
2017-07-02 20:16:00.334 Error: dzVents: Error: An error occured when calling event handler Meteo terraza
2017-07-02 20:16:00.334 Error: dzVents: Error: .../var/scripts/dzVents/generated_scripts/Meteo terraza.lua:12: attempt to index a nil value
2017-07-02 20:16:00.334 dzVents: Info: ------ Finished Meteo terraza
However, the WU THB LEBL device exists, the spelling is correct and was actually working correctly before modifying the script.
Any ideas?
Many thanks for the effort of developing dzvents for those of us not super-experts in lua. I could still have a look into the code if you give me some hint of where to look if you think that could be of help.
Thanks!