Chimney valve

Easy to use, 100% Lua-based event scripting framework.

Moderator: leecollings

Post Reply
User avatar
jacobsentertainment
Posts: 223
Joined: Thursday 01 October 2020 1:47
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021-1
Location: Not @ home
Contact:

Chimney valve

Post by jacobsentertainment »

Hi all,

I'm trying to activate the valve in my chimney based on several states. two switch states have to be off and the temperature needs to be below 20°
I tried the following but I'm not getting any results or faults, what's going wrong?

Code: Select all

return
{
    on =
    {
        devices = {
            181, 180, 65, 64 
    }
},
    execute = function(domoticz, device)
        
        local Tempsensor = domoticz.devices(64)
		local Switch1 = domoticz.devices(180)
		local Switch2 = domoticz.devices(65)
		local Switch3 = domoticz.devices(181)
		local Temp = Tempsensor.temperature
		
        if  Switch3.state == 'off' and Switch2 == 'off' and Temp <= 20  then 
            Switch1.switchOn()
        end
    end
}
User avatar
waltervl
Posts: 6691
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2025.1
Location: NL
Contact:

Re: Chimney valve

Post by waltervl »

Device states are case sensitive so instead of "off" use "Off".
See the device data page in the event editor (first tab) for your actual values.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
User avatar
jacobsentertainment
Posts: 223
Joined: Thursday 01 October 2020 1:47
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021-1
Location: Not @ home
Contact:

Re: Chimney valve

Post by jacobsentertainment »

waltervl wrote: Tuesday 21 September 2021 1:00 Device states are case sensitive so instead of "off" use "Off".
See the device data page in the event editor (first tab) for your actual values.
Tried the uppercase and lowercase won't change any, still no results.

Device page, learned something today, didn't know this page.
User avatar
waltervl
Posts: 6691
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2025.1
Location: NL
Contact:

Re: Chimney valve

Post by waltervl »

And you forgot the .state for Switch2
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
User avatar
jacobsentertainment
Posts: 223
Joined: Thursday 01 October 2020 1:47
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021-1
Location: Not @ home
Contact:

Re: Chimney valve

Post by jacobsentertainment »

I didn't see that, thanks it works now :mrgreen:
rrozema
Posts: 470
Joined: Thursday 26 October 2017 13:37
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Delft
Contact:

Re: Chimney valve

Post by rrozema »

To completely avoid the upper and lower case issues in the values, use device.active instead. active is a Boolean that will be true when the device.state is 'On' (or 'Open' or > 0% or ...) and false when the the device is 'Off' (or 'Closed' or 0% or ...).
User avatar
jacobsentertainment
Posts: 223
Joined: Thursday 01 October 2020 1:47
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021-1
Location: Not @ home
Contact:

Re: Chimney valve

Post by jacobsentertainment »

rrozema wrote: Tuesday 21 September 2021 7:39 To completely avoid the upper and lower case issues in the values, use device.active instead. active is a Boolean that will be true when the device.state is 'On' (or 'Open' or > 0% or ...) and false when the the device is 'Off' (or 'Closed' or 0% or ...).
Ill give that a try to, I'm not an software engineer so I have to find out by doing things and see results and go from there. Give me an engine or some other mechanical challenge and I'm the man :lol: But thanks for the tip!
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest