Page 1 of 1
Remote with ONE (on button)
Posted: Friday 11 March 2016 22:03
by jhedelin
I have a remote that can only send the ON signal to Domotics.
I want to use this remote for turning a lightswitch on and off.
I have tried with Virtual Switches to make this work but with no success....
How do i fix this with blocky?
please help!!
Re: Remote with ONE (on button)
Posted: Sunday 13 March 2016 22:02
by georgesattali
Hello,
maybe, you could use it this with 2 blocks :
First use of remote (when the remote goes on) switches the otherswitch "On", second use of Remote switches it "Off".
otherswitch may or may not be virtual.
the "After 5 seconds" is just for "prettyness", you may just use Set "Remote" to "On" or "Off" instead.
-- 1st block
if "Remote" = "On" and "Otherswitch" = "Off" then
Set "OtherSwitch" to "On"
Set "Remote" to Off After 5 seconds
-- 2nd block
if "Remote" = "On" and "OtherSwitch" = "On" then
Set "OtherSwitch" to "Off"
Set "Remote" to "Off" After 5 seconds
Bye, Geo
Re: Remote with ONE (on button)
Posted: Monday 14 March 2016 20:57
by jhedelin
Hehe i have tried something like that, even if i set that the remote is a on/off switch, i cant get the remote to go OFF, not even with domoticz.... everytime i press the button on the remote or domoticz it gets the ON command only.... !
Re: Remote with ONE (on button)
Posted: Monday 14 March 2016 21:17
by Westcott
Some detectors are like this as well.
Make a dummy switch
Use the 'On' events triggered by your remote, e.g.-
Code: Select all
commandArray = {}
if (devicechanged['your remote'] then
if (otherdevices['your dummy switch') == 'Off') then
commandArray['your dummy switch') == 'On')
else
commandArray['your dummy switch') == 'Off')
end
return commandArray
Then use the dummy switch to get On and Off
Re: Remote with ONE (on button)
Posted: Tuesday 15 March 2016 8:31
by dijkdj
If you dive into Lua and API you will see there is an option "toggle". Thats the one you need.
Re: Remote with ONE (on button)
Posted: Wednesday 16 March 2016 20:02
by jhedelin
Ok, i have now tried the script Westscott wrote with no luck. Nothings happens.
I created a script file called script_device_velton.lua in Domoticz/Scripts/Lua folder.
-------------------------------
commandArray = {}
if (devicechanged['Felton'] then
if (otherdevices['VElton') == 'Off') then
commandArray['VElton') == 'On')
else
commandArray['VElton') == 'Off')
end
return commandArray
------------------
i have also tried to do the script as blocky, but when i do, the virtual switch (VElton) is going on/off every second.
Fjärr Elton is renamed to "Felton" so its not wrong
- domo.JPG (35.26 KiB) Viewed 8207 times
Whats next? What can i do with the toggle options in Lua scripts?
Thanks for your help!
Re: Remote with ONE (on button)
Posted: Wednesday 16 March 2016 20:52
by DomoUHT
Hi,
what type of single button that only sends ON do you have ? Is it a doorbell button ?
When a doorbell button is set to type On/Off it looks like you can't switch it off by DomoticZ.
In fact it switches off and immediately on again, so you can't see it going off.
I use the SelectPlus doorbell buttons to switch on/off on first/second push as follows :
First I define the doorbell button as type doorbell (name here is Doorbell PB B3)
- Schermafbeelding 2016-03-16 om 20.42.15.png (11.7 KiB) Viewed 8195 times
Then I make virtual switch type On/Off and set Delay-Off to 1 second :
- Schermafbeelding 2016-03-16 om 20.40.30.png (59.69 KiB) Viewed 8195 times
Then I use a blocky like this (Woonkamer Achter is a Living-Lamp) :
- Schermafbeelding 2016-03-16 om 20.40.59.png (71.35 KiB) Viewed 8195 times
Hope this is of any good to you.
Re: Remote with ONE (on button)
Posted: Wednesday 16 March 2016 20:54
by jhedelin
Its not a doorbell, its a remote with one button, i want to use them to turn a light switch on and off.
Re: Remote with ONE (on button)
Posted: Wednesday 16 March 2016 21:11
by DomoUHT
when it just sends a ON command, you could link the switch to a scene that switches on'DoorbellPulseON PB B3' (or use your own virtual On/Off switch with 1sec delay off).
Then you have a 1sec pulse on every ON command that you can use with the above blocky (don't use the first If statement)
Re: Remote with ONE (on button)
Posted: Wednesday 16 March 2016 21:21
by jhedelin
I have finally solved it, on the remote settings i choosed (Off Delay) 1 second. Then the remote will go OFF instead of going ON all the time.
After that i used blocky the turn the virtual switch on and off.
Re: Remote with ONE (on button)
Posted: Wednesday 16 March 2016 21:39
by DomoUHT
Blocky is not triggered by a On command, when the state is already On.
I understood that you could not change the state of the remote to Off by DomoticZ, but apparently you can.
Why do you turn on/off a virtual switch instead of the real light switch ?
Re: Remote with ONE (on button)
Posted: Thursday 17 March 2016 0:14
by markk
DomoUHT wrote:Blocky is not triggered by a On command, when the state is already On.
I'm not sure this is correct. I have loads of PIRs and door sensors which are always showing as on but successfully trigger blockly events when movement sets them on again. Blockly runs whenever a device changes status so as soon as a new signal is sent it runs and sees the device as on. It doesn't seem to know, or care, what the status was previously so just triggers the event.
Re: Remote with ONE (on button)
Posted: Thursday 17 March 2016 19:32
by DomoUHT
Hi markk,
I did some tests and have to admit that I was wrong. Sorry for that.
I tested with a 2 button on/off remote and pressing only the Off button again and again every time triggers the blocky.
So it is not about changing a device's On/Off state but the event of receiving a command.
Tested also with a user variable and this responds in the same manner (which I never would have thought). When Var=0 and writing again 0 into the var triggers a blocky (where IF Var=0 is tested).
So I guess I was wrong all the time by thinking that my (always On) doorbell button in DomoticZ was switching to Off and back to On rapidly (faster than the eye i.e.).
Thanks for correcting me !
Re: Remote with ONE (on button)
Posted: Saturday 04 February 2017 23:43
by lagus
Hi all,
Has anyone Node-Red and MQTT on their Domoticz server?
It helped me a lot! - Instead of fiddling around with LUA scripts or Blocky with additional virtual switches.
Here's another way to solve toggling of (in this case) scenes with a one button remote:
- Screenshot from 2017-02-04 23-35-34.png (19.12 KiB) Viewed 7171 times
The button that you create in Domoticz should be an "on button" & Domoticz sending out status messages on MQTT
It should be totally independent of any other way of toggling your scenes, so your normal ways will also work with your old scenes.