Selector dzvents selecting buttons

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

Moderator: leecollings

Post Reply
parrotface
Posts: 36
Joined: Monday 02 February 2015 15:50
Target OS: Linux
Domoticz version:
Location: Cheshire England
Contact:

Selector dzvents selecting buttons

Post by parrotface »

Hi
I am using a selector switch to control heating zones and manually selecting the buttons is working OK.
Using the dzVents script I can switch the selector Off
domoticz.devices('Heat Pump Boost').switchOff().afterMin(60)

I can't work out the syntax to select a different selector switch button. Do I use the level 10 , 20 30 etc or the button Name - zone1, zone2 zone3 etc
what is the correct syntax to select zone1?
Thanks
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Selector dzvents selecting buttons

Post by waaren »

in dzVents you can use .state to select the name.

Code: Select all

execute = function(domoticz, device )

local state = device.state

if state == "name of state-1" then
   do stuff
elseif state == "name of state-2" then
   do other stuff
end
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
parrotface
Posts: 36
Joined: Monday 02 February 2015 15:50
Target OS: Linux
Domoticz version:
Location: Cheshire England
Contact:

Re: Selector dzvents selecting buttons

Post by parrotface »

Thanks for your reply
If I understand it correctly your script means I can check to see which button of the selector is active.
What I need is how to change the selector from dzVents script to change the active button.
I can select the Off button but not the other selections.
Thanks
parrotface
Posts: 36
Joined: Monday 02 February 2015 15:50
Target OS: Linux
Domoticz version:
Location: Cheshire England
Contact:

Re: Selector dzvents selecting buttons

Post by parrotface »

tried these

This works OK domoticz.devices('selector').switchOff().afterMin(60)

These DO NOT work
domoticz.devices('selector').modeSet(10)
domoticz.devices('selector').levelSet(10)
domoticz.devices('selector').set(10)

note selector is name of my selector switch
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Selector dzvents selecting buttons

Post by waaren »

from https://www.domoticz.com/wiki/DzVents:_ ... _scripting


switchSelector(level): Function. Switches a selector switch to a specific level (numeric value, see the edit page in Domoticz for such a switch to get a list of the values). Supports command options.

so in your case:

Code: Select all

domoticz.devices('selector').switchSelector(10)
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
parrotface
Posts: 36
Joined: Monday 02 February 2015 15:50
Target OS: Linux
Domoticz version:
Location: Cheshire England
Contact:

Re: Selector dzvents selecting buttons

Post by parrotface »

Hi
Thanks for reply

Still can't get it working
domoticz.devices('selector').switchOff() works every time

domoticz.devices('selector').switchSelector(Zone1) or
domoticz.devices('selector').switchSelector(10) wont work

Thanks
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Selector dzvents selecting buttons

Post by waaren »

Does the command produce an error in the logfile or is it just ignored ? Can you post the output of domoticz.devices('selector').dump() ?
maybe that will give us clue what is going wrong.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest