multifunctional virtual switch ?
Moderator: leecollings
-
- Posts: 88
- Joined: Tuesday 24 February 2015 16:14
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Belgium
- Contact:
multifunctional virtual switch ?
Hi,
I'm looking into using ESP8266-12 with ESP-Easy to connect all my wallswitches (pushbuttons) into Domoticz.
They will appear in Domoticz as virtual switches (push on buttons) as I understand.
With these virtual switches I can switch on/of different lights or activate scenes with Blockly events ... I see that
But now I wonder how can I have these switches do different things ?
when light is off, 1 single push brings the light on to the last dimmer level as it was last on
when light is on, 1 single push turns light off
when light is on, long continuous push changes the dimmer level (first go up to 100% , then go down to 0%)
when light is off, long continuous push does something else (haven't thought about it yet)
when light is off, double click calls a scene
when light is on, double click calls another scene
...
Should this be done with scripting ? LUA or Blockly ?
I've been looking around the forum for hours and hours, but nothing usefull came up ...
I'm looking into using ESP8266-12 with ESP-Easy to connect all my wallswitches (pushbuttons) into Domoticz.
They will appear in Domoticz as virtual switches (push on buttons) as I understand.
With these virtual switches I can switch on/of different lights or activate scenes with Blockly events ... I see that
But now I wonder how can I have these switches do different things ?
when light is off, 1 single push brings the light on to the last dimmer level as it was last on
when light is on, 1 single push turns light off
when light is on, long continuous push changes the dimmer level (first go up to 100% , then go down to 0%)
when light is off, long continuous push does something else (haven't thought about it yet)
when light is off, double click calls a scene
when light is on, double click calls another scene
...
Should this be done with scripting ? LUA or Blockly ?
I've been looking around the forum for hours and hours, but nothing usefull came up ...
RasPi2 - Aeotec Z-Stick S2 - Fibaro multisensors - Fibaro RGBW dimmers - ETH08 relais boards
-
- Posts: 88
- Joined: Tuesday 24 February 2015 16:14
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Belgium
- Contact:
Re: multifunctional virtual switch ?
nobody ?
RasPi2 - Aeotec Z-Stick S2 - Fibaro multisensors - Fibaro RGBW dimmers - ETH08 relais boards
-
- Posts: 722
- Joined: Friday 02 October 2015 12:12
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Location: Finland
- Contact:
Re: multifunctional virtual switch ?
A single virtual switch catches only on / off. You could of course create a virtual selector switch but you need to be able to configure the ESP-unit so that it activates the correct selector state with different presses. Then it is just a matter off doing some lua or blockly...

-
- Posts: 68
- Joined: Wednesday 30 December 2015 23:54
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Location: Poland
- Contact:
Re: multifunctional virtual switch ?
Since Easy ESP allows you to have rules with event names in them, you could use selector swich in Domoticz and send specific event name to ESP. HTH
Michal 'Kotek', greetings from Poland. Zapraszam na mój blog o automatyce domowej po polsku: http://www.ukotka.com.
-
- Posts: 88
- Joined: Tuesday 24 February 2015 16:14
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Belgium
- Contact:
Re: multifunctional virtual dimmer switch ?
I'm still looking for a solution for this ...
can somebody please help ?
can somebody please help ?
pascalspits wrote:Hi,
I'm looking into using ESP8266-12 with ESP-Easy to connect all my wallswitches (pushbuttons) into Domoticz.
They will appear in Domoticz as virtual switches (push on buttons) as I understand.
With these virtual switches I can switch on/of different lights or activate scenes with Blockly events ... I see that
But now I wonder how can I have these switches do different things ?
when light is off, 1 single push brings the light on to the last dimmer level as it was last on
when light is on, 1 single push turns light off
when light is on, long continuous push changes the dimmer level (first go up to 100% , then go down to 0%)
when light is off, long continuous push does something else (haven't thought about it yet)
when light is off, double click calls a scene
when light is on, double click calls another scene
...
Should this be done with scripting ? LUA or Blockly ?
I've been looking around the forum for hours and hours, but nothing usefull came up ...
RasPi2 - Aeotec Z-Stick S2 - Fibaro multisensors - Fibaro RGBW dimmers - ETH08 relais boards
-
- Posts: 722
- Joined: Friday 02 October 2015 12:12
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Location: Finland
- Contact:
Re: multifunctional virtual switch ?
Sounds like you are just trying to trigger some actions which are based on different conditions? That's the very core Blockly / Lua /dZvents functionality for which there are plenty of examples on the board. Also I suggest taking a look at the wiki, e.g: Domoticz events and this basic Lua example:
Just replace the "MyDeviceName" with the name of your "1 single push" device and "MyOtherDeviceName" with the name of the light switch and you pretty much should have this:
And yes, Blockly is just as good of an option to do this as well. What I'm finding a bit hard to understand is that you say you've spent hours and hours on this and found nothing useful, really? Makes we wonder I've understood something wrong here...
Code: Select all
commandArray = {}
if (devicechanged['MyDeviceName'] == 'On' and otherdevices['MyOtherDeviceName'] == 'Off') then
commandArray['MyOtherDeviceName']='On'
end
return commandArray
working. Then just repeat and modify for the other actions.when light is off, 1 single push brings the light on to the last dimmer level as it was last on
And yes, Blockly is just as good of an option to do this as well. What I'm finding a bit hard to understand is that you say you've spent hours and hours on this and found nothing useful, really? Makes we wonder I've understood something wrong here...

-
- Posts: 88
- Joined: Tuesday 24 February 2015 16:14
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Belgium
- Contact:
Re: multifunctional virtual switch ?
I've never done any LUA scripting yet, always done things in Blockly, but this will be to complicated for Blockly I fear ...
So, is there somebody who can help me make a LUA (or any other type) script for these functionalities ?
when light is off, 1 single push switches the light on to the last dimmer level as it was last on (so, with level memory)
when light is on, 1 single push turns light off
when light is on but not on 100%, long continuous push gradually rises the dimmer level up to 100% (in 5% steps ?), when stop pushing it stops at the reached level
when light is on and on 100%, long continuous push gradually lowers the dimmer level down to 0% (in 5% steps ?), when stop pushing it stops at the reached level
when light is off or on, double click sets the dimmer to 100%
thanks in advance !
So, is there somebody who can help me make a LUA (or any other type) script for these functionalities ?
when light is off, 1 single push switches the light on to the last dimmer level as it was last on (so, with level memory)
when light is on, 1 single push turns light off
when light is on but not on 100%, long continuous push gradually rises the dimmer level up to 100% (in 5% steps ?), when stop pushing it stops at the reached level
when light is on and on 100%, long continuous push gradually lowers the dimmer level down to 0% (in 5% steps ?), when stop pushing it stops at the reached level
when light is off or on, double click sets the dimmer to 100%
thanks in advance !
RasPi2 - Aeotec Z-Stick S2 - Fibaro multisensors - Fibaro RGBW dimmers - ETH08 relais boards
-
- Posts: 88
- Joined: Tuesday 24 February 2015 16:14
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Belgium
- Contact:
Re: multifunctional virtual switch ?
nobody ?
RasPi2 - Aeotec Z-Stick S2 - Fibaro multisensors - Fibaro RGBW dimmers - ETH08 relais boards
-
- Posts: 105
- Joined: Saturday 25 November 2017 17:18
- Target OS: Raspberry Pi / ODroid
- Domoticz version: v3.8153
- Location: Czech Rep.
- Contact:
Re: multifunctional virtual switch ?
I think you must study ESPeasy rules.
There are examples on forum for detecting long push, double click too.
Then you must send through JSON API values to Domoticz.
And back from Domoticz through events calls.
But I do not know, if all your ideas will be possible.
There are examples on forum for detecting long push, double click too.
Then you must send through JSON API values to Domoticz.
And back from Domoticz through events calls.
But I do not know, if all your ideas will be possible.
RPi2 Domoticz v 4.10717
10 x Sonoff Basic - ESPeasy
1 x Wemos D1 - ESPeasy
1 x Shelly Plus Plug S
1 x Sonoff S26 - ESPeasy
1 x Shelly 1
1 x MySensors HC-SR04
1 x MySenosrs wifi gateway
1 x RFLink
4x Cam IPC-T240H
10 x Sonoff Basic - ESPeasy
1 x Wemos D1 - ESPeasy
1 x Shelly Plus Plug S
1 x Sonoff S26 - ESPeasy
1 x Shelly 1
1 x MySensors HC-SR04
1 x MySenosrs wifi gateway
1 x RFLink
4x Cam IPC-T240H
Re: multifunctional virtual switch ?
I agree with others, that if you don't set up a technical assignment correctly, you will waste a lot of time. Simply because people will not understand what you want from them. So maybe the best way to start is to learn writing in a persuasive manner. In other words a little bit back to school, yes. But at the same time it works miracles in saving time.
Who is online
Users browsing this forum: No registered users and 1 guest