I have an old LUA scripts that was used to multiply a value from a sensor with 50.
The actual sensor is an Co2 sensor, but Telldus reads the value as a temperature.
I have recently setup my old installation, and i can not remember how i got this working, but now i get error in Domoticz log:
Error: EventSystem: in Script #1: [string "--Domoticz LUA Script (put text in file scrip..."]:12: attempt to index a nil value (global 'devicechanged')
Any ideas?
Or how to make this in DzVents?
Code: Select all
--Name of the real CO2 meter
aqMeterName = 'WMS-Co2'
--ID of the created dummy CO2 meter
dummyAqMeterId = 41
aqVal = otherdevices_svalues[aqMeterName]
commandArray = {}
if devicechanged[aqMeterName] then
--calculate actual value
actual = 50 * tonumber(aqVal)
--update dummy meter
commandArray['UpdateDevice'] = dummyAqMeterId .. "|" .. actual .. "|0"
end
return commandArray