Switch in combination with Selector
Moderator: leecollings
- HansieNL
- Posts: 964
- Joined: Monday 28 September 2015 15:13
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Switch in combination with Selector
If I select Off on the selector switch, the dimmer switch changes also to off status.
If I select Off on dimmer switch, the selector switch stays on last chosen and doesn't change to switched off.
I'm using a hardware dimmer switch and if switched to off it set dimmer switch to off. I want auto switch the selector to off too? Than I can hide dimmer switch and only use selector switch.
Blah blah blah
-
- Posts: 27
- Joined: Monday 13 April 2015 23:19
- Target OS: NAS (Synology & others)
- Domoticz version: 3.5033
- Location: Amsterdam, The Netherlands
- Contact:
Re: Switch in combination with Selector
I think this can be easily fulfilled with a lua device script. Basically I think it should be something like this:
Put above code in a script_device_YourScriptName.lua file and put it in the scripts/lua folder and it should work. Good luck!
Code: Select all
commandArray = {}
if devicechanged['Lamp Salontafel 02'] == 'Off' then
commandArray['Lamp Salontafel']='Set Level 0'
end
return commandArray
Put above code in a script_device_YourScriptName.lua file and put it in the scripts/lua folder and it should work. Good luck!
Re: Switch in combination with Selector
Probably set the selector switch as sub device of the dimmer switch ?
- HansieNL
- Posts: 964
- Joined: Monday 28 September 2015 15:13
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Switch in combination with Selector
@arjanw: If I set selector switch as sub device of dimmer switch off button works ok, but when I select one of the other selections after a few seconds off buttons lightens up and selected button isn't lightened up anymore. I tried dimmer switch as sub device of selector switch, but same effect? Looks like there's somewhere a loop?
@wmn79: I tried the script, but same strange behaviour as with sub setting. I can push button from selector switch, but jumps to off button, but off switch is not triggered.
These are the actions for the selector switch...
@wmn79: I tried the script, but same strange behaviour as with sub setting. I can push button from selector switch, but jumps to off button, but off switch is not triggered.
These are the actions for the selector switch...
Last edited by HansieNL on Saturday 12 March 2016 12:26, edited 1 time in total.
Blah blah blah
-
- Posts: 27
- Joined: Monday 13 April 2015 23:19
- Target OS: NAS (Synology & others)
- Domoticz version: 3.5033
- Location: Amsterdam, The Netherlands
- Contact:
Re: Switch in combination with Selector
Do you get an error in the log? If so what is the error? Did I get the name of the first switch correct? Not sure if it is the letter O or a zero. I think I used a zero in the name. If that is incorrect you need to change it.
- HansieNL
- Posts: 964
- Joined: Monday 28 September 2015 15:13
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Switch in combination with Selector
@wmn79: script works fine. If I push for example Halvol the right command is sent to bulb and executed. Lamp Salontafel O2 is on then. Lamp Salontafel (selector switch) button Halfvol lights up for just a second and then Off button lights up. I expect that the selction I made stays light on, or am I missing something.
Blah blah blah
-
- Posts: 27
- Joined: Monday 13 April 2015 23:19
- Target OS: NAS (Synology & others)
- Domoticz version: 3.5033
- Location: Amsterdam, The Netherlands
- Contact:
Re: Switch in combination with Selector
I don't mean the commands you use in your set levels I mean the LUA script I posted. That script should only be executed if the Lamp Salon tafel 02 (or O2) is changed to off. If you use both the lua script and the command you have with set level 0 you will get in a loop. You better put a check in the LUA if it is off or not. Should be something like this:
With the selector switches I have, the last given command keeps being selected. So if I select volume down for my Sonos, it will stay on volume down. Therefore I update the selector switch with the current state (playing, paused or stopped) I don't know why this is different with your selector switch.
Code: Select all
commandArray = {}
if devicechanged['Lamp Salontafel 02'] == 'Off' then
if otherdevices['Lamp Salontafel']~='Off'
commandArray['Lamp Salontafel']='Set Level 0'
end
end
return commandArray
- HansieNL
- Posts: 964
- Joined: Monday 28 September 2015 15:13
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Switch in combination with Selector
@wmn79: Thx for the tip. I deleted the level 0 command and changed your script to:
commandArray = {}
if devicechanged['Lamp Salontafel O2'] == 'Off' and otherdevices['Lamp Salontafel'] ~='Off' then
commandArray['Lamp Salontafel']='Set Level: 0'
elseif devicechanged['Lamp Salontafel'] == 'Off' and otherdevices['Lamp Salontafel 02'] ~='Off' then
commandArray['Lamp Salontafel O2']='Off'
end
return commandArray
I don't get a sValue ? for the Lamp Salontafel O2 (dimmer switch) and this way I get the best result.
commandArray = {}
if devicechanged['Lamp Salontafel O2'] == 'Off' and otherdevices['Lamp Salontafel'] ~='Off' then
commandArray['Lamp Salontafel']='Set Level: 0'
elseif devicechanged['Lamp Salontafel'] == 'Off' and otherdevices['Lamp Salontafel 02'] ~='Off' then
commandArray['Lamp Salontafel O2']='Off'
end
return commandArray
I don't get a sValue ? for the Lamp Salontafel O2 (dimmer switch) and this way I get the best result.
Blah blah blah
-
- Posts: 27
- Joined: Monday 13 April 2015 23:19
- Target OS: NAS (Synology & others)
- Domoticz version: 3.5033
- Location: Amsterdam, The Netherlands
- Contact:
Re: Switch in combination with Selector
Yes that is right, I don't get sValues with my Hue bulbs as well. Maybe that is something which can be improved by arjanwaard who has really improved the implementation of Hue in Domoticz lately.
Do the switches now work how you want them to work?
Do the switches now work how you want them to work?
Who is online
Users browsing this forum: No registered users and 1 guest