How to get Temperature Set Point working in LUA
Posted: Tuesday 15 March 2016 0:05
Hello,
After having read a lot on the Temperature Set Point control and Lua Wiki, I decided to post this question.
I have a Temperature Set Point control named, say roomTemp. After having changed Temperature setting point and clicked on Set, I want to have a Lua script triggered and retrieve the new Set Point value in order to act accordingly. I discovered that the name of this device is suffixed with _Utility.
So I tried in LUA:
But this triggers an error because most of the time there is no value
I understand that I have first to test that the device has changed and then grab the value, since there is no value returned until a change has occured
The log returns the two following lines
2016-03-14 22:59:37.710 LUA: Device based event fired on 'roomTemp', value '' (two single quotes with no space)
2016-03-14 22:59:37.710 LUA: Device based event fired on 'roomTemp_Utility', value '12.5'
So I tried
I also tried
with no success
Syntax error is reported near otherdevices or otherdevices_svalues instructions.
I would appreciate any guidance on this matter. I'm currently running v2.4582
Thank you
After having read a lot on the Temperature Set Point control and Lua Wiki, I decided to post this question.
I have a Temperature Set Point control named, say roomTemp. After having changed Temperature setting point and clicked on Set, I want to have a Lua script triggered and retrieve the new Set Point value in order to act accordingly. I discovered that the name of this device is suffixed with _Utility.
So I tried in LUA:
Code: Select all
if devicechanged['roomTemp_Utility'] > 0 then
print ('A')
endI understand that I have first to test that the device has changed and then grab the value, since there is no value returned until a change has occured
The log returns the two following lines
2016-03-14 22:59:37.710 LUA: Device based event fired on 'roomTemp', value '' (two single quotes with no space)
2016-03-14 22:59:37.710 LUA: Device based event fired on 'roomTemp_Utility', value '12.5'
So I tried
Code: Select all
if devicechanged['roomTemp'] == '' then
print ('ok')
print otherdevices['roomTemp_Utility']
endCode: Select all
print otherdevices_svalues['roomTemp_Utility']Syntax error is reported near otherdevices or otherdevices_svalues instructions.
I would appreciate any guidance on this matter. I'm currently running v2.4582
Thank you