Page 1 of 1

multifunctional virtual switch ?

Posted: Thursday 06 October 2016 10:22
by pascalspits
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 ...

Re: multifunctional virtual switch ?

Posted: Thursday 02 February 2017 0:07
by pascalspits
nobody ?

Re: multifunctional virtual switch ?

Posted: Thursday 02 February 2017 9:03
by Nautilus
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...:)

Re: multifunctional virtual switch ?

Posted: Friday 03 February 2017 21:03
by mKotek
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

Re: multifunctional virtual dimmer switch ?

Posted: Wednesday 26 July 2017 16:29
by pascalspits
I'm still looking for a solution for this ...

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 ...

Re: multifunctional virtual switch ?

Posted: Monday 31 July 2017 12:32
by Nautilus
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:

Code: Select all

 commandArray = {}
 if (devicechanged['MyDeviceName'] == 'On' and otherdevices['MyOtherDeviceName'] == 'Off') then
     commandArray['MyOtherDeviceName']='On'
 end
 return commandArray
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:
when light is off, 1 single push brings the light on to the last dimmer level as it was last on
working. Then just repeat and modify for the other actions.

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...:)

Re: multifunctional virtual switch ?

Posted: Monday 11 February 2019 14:19
by pascalspits
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 !

Re: multifunctional virtual switch ?

Posted: Friday 22 February 2019 9:06
by pascalspits
nobody ?

Re: multifunctional virtual switch ?

Posted: Sunday 24 February 2019 18:48
by kimot
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.

Re: multifunctional virtual switch ?

Posted: Monday 12 August 2019 17:41
by CharlesX
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.