I'm trying to generate a simple script to create an alarm from my ventilation system.
Iv made the alarm codes as:
Code: Select all
local ALK4 = '4- PRESSURE ; High or low pressure pressure switch'
local ALK5 = '5- DOOR ; Inspection door open'
and then i want to put the value of the local as description in the alert device:
local AL_kode = domoticz.devices('Nilan Alarm_read code').sensorValue
Code: Select all
if ('ALK'..AL_kode) == 'ALK0' or 'ALK1' or 'ALK2' or 'ALK3' or 'ALK4' or 'ALK5' or 'ALK6' or 'ALK7' ' then
domoticz.data.svalAL = 'ALK'..AL_kode
else
domoticz.data.svalAL = 'Ikke%20kendt%20tilstand'
end
domoticz.log(domoticz.data.svalAL)
domoticz.log(ALK4)
local url = 'http://192.168.1.xx:8080/json.htm?type=command¶m=udevice&idx='..idx..'&nvalue=1&svalue='..domoticz.data.svalAL
--domoticz.log(url)
domoticz.openURL(url)
The two log output also shows 1: name of variable, 2: value of variable
How to i get the value of the local variable instead of the name?
Thank you in advance.
BR
AR