How to get Temperature Set Point working in LUA

Moderator: leecollings

Post Reply
Number8
Posts: 374
Joined: Friday 23 May 2014 7:55
Target OS: Linux
Domoticz version: 2022.1
Location: Saint Pierre de Jards
Contact:

How to get Temperature Set Point working in LUA

Post by Number8 »

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:

Code: Select all

if devicechanged['roomTemp_Utility'] > 0 then
print ('A')
end
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

Code: Select all

if devicechanged['roomTemp'] == '' then
print ('ok')
print otherdevices['roomTemp_Utility']
end
I also tried

Code: Select all

print otherdevices_svalues['roomTemp_Utility']
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
Debian buster on NUC and three RPi with buster.
Number8
Posts: 374
Joined: Friday 23 May 2014 7:55
Target OS: Linux
Domoticz version: 2022.1
Location: Saint Pierre de Jards
Contact:

Re: How to get Temperature Set Point working in LUA

Post by Number8 »

I ended up with this logic
if devicechanged[setPointName] == '' then
setPointValue = tonumber(otherdevices_svalues[setPointName])
print (setPointValue)
Debian buster on NUC and three RPi with buster.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest