For example if this sensor battery level is nil then this should be false and not fire:
Code: Select all
if domoticz.devices('Garage side door sensor').batteryLevel < 100 then
-- do something
end
Code: Select all
2023-07-13 19:00:00.304 Error: dzVents: Error: (3.1.8) An error occurred when calling event handler Low battery notification
2023-07-13 19:00:00.304 Error: dzVents: Error: (3.1.8) ...s\dzVents\generated_scripts/Low battery notification.lua:61: attempt to compare nil with number
I did workaround it:
Code: Select all
if domoticz.devices('Garage side door sensor').batteryLevel ~= nil and domoticz.devices('Garage side door sensor').batteryLevel < 100 then
--do something
end
https://www.lua.org/versions.html#5.4