I Need to set a thermostat temperature from a value stored in a user variable inside LUA.
Unfortunatelly I did not find anything in the documentation

Quax1507
Moderator: leecollings
Code: Select all
commandArray['UpdateDevice']='xxx|0|'..tostring(uservariables['variablename'])
Code: Select all
local idx = 40
commandArray = {}
commandArray['UpdateDevice']='40|0|'..tostring(uservariables['value'])
return commandArray
Code: Select all
local idx = "40"
commandArray = {}
if uservariablechanged['value'] then
print("changing thermostat to:" .. tostring(uservariables['value']))
commandArray['UpdateDevice']=idx..'|0|'..tostring(uservariables['value'])
end
return commandArray
Code: Select all
-----------------------
------ Variablen ------
-----------------------
local heizkoerper = 'Dummy' --Name des Heizkörpers
local fensterkontakt = 'Türkontakt nn'
commandArray = {}
if devicechanged[fensterkontakt]=='On' then
commandArray['Variable:Bad_Heizkörper_Ablage'] = otherdevices_svalues[heizkoerper]
commandArray[1]={['UpdateDevice']='159|0|12.0'}
elseif devicechanged[fensterkontakt]=='Off' then
commandArray['UpdateDevice']='159|0|' .. tostring(uservariables['Bad_Heizkörper_Ablage'])
end
return commandArray
Yes - I changed it to script_variable_xxxx.lua, and that stopped it repeating. (BTW: your example is missing a ')' at the end of the print statement.)What did you name the script? something like script_device_xxxx.lua?
Users browsing this forum: No registered users and 1 guest