Remote with ONE (on button)

Moderator: leecollings

Post Reply
jhedelin
Posts: 5
Joined: Friday 11 March 2016 21:54
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Remote with ONE (on button)

Post 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!!
georgesattali
Posts: 84
Joined: Saturday 05 March 2016 16:40
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: France
Contact:

Re: Remote with ONE (on button)

Post 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
jhedelin
Posts: 5
Joined: Friday 11 March 2016 21:54
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Remote with ONE (on button)

Post 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.... !
User avatar
Westcott
Posts: 423
Joined: Tuesday 09 December 2014 17:04
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: UK - Glos
Contact:

Re: Remote with ONE (on button)

Post 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
Zwave - Sigma Z+ stick, Fibaro, Horstmann, Neo Coolcam, EUROtronic
RFlink - IR detectors and temperatures
Wifi - YeeLights, ESP32s, Anoop sockets
Zigbee - lots with zigbee2mqtt and ZbBridge
dijkdj
Posts: 63
Joined: Saturday 07 March 2015 22:10
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Remote with ONE (on button)

Post by dijkdj »

If you dive into Lua and API you will see there is an option "toggle". Thats the one you need.
jhedelin
Posts: 5
Joined: Friday 11 March 2016 21:54
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Remote with ONE (on button)

Post 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
domo.JPG (35.26 KiB) Viewed 8201 times
Whats next? What can i do with the toggle options in Lua scripts?

Thanks for your help!
DomoUHT
Posts: 15
Joined: Friday 13 March 2015 22:08
Target OS: OS X
Domoticz version: 2.2293
Location: Alkmaar, The Netherlands
Contact:

Re: Remote with ONE (on button)

Post 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
Schermafbeelding 2016-03-16 om 20.42.15.png (11.7 KiB) Viewed 8189 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
Schermafbeelding 2016-03-16 om 20.40.30.png (59.69 KiB) Viewed 8189 times
Then I use a blocky like this (Woonkamer Achter is a Living-Lamp) :
Schermafbeelding 2016-03-16 om 20.40.59.png
Schermafbeelding 2016-03-16 om 20.40.59.png (71.35 KiB) Viewed 8189 times
Hope this is of any good to you.
jhedelin
Posts: 5
Joined: Friday 11 March 2016 21:54
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Remote with ONE (on button)

Post 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.
DomoUHT
Posts: 15
Joined: Friday 13 March 2015 22:08
Target OS: OS X
Domoticz version: 2.2293
Location: Alkmaar, The Netherlands
Contact:

Re: Remote with ONE (on button)

Post 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)
jhedelin
Posts: 5
Joined: Friday 11 March 2016 21:54
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Remote with ONE (on button)

Post 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.
DomoUHT
Posts: 15
Joined: Friday 13 March 2015 22:08
Target OS: OS X
Domoticz version: 2.2293
Location: Alkmaar, The Netherlands
Contact:

Re: Remote with ONE (on button)

Post 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 ?
markk
Posts: 267
Joined: Tuesday 14 January 2014 14:50
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Remote with ONE (on button)

Post 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.
Running Domoticz on Pi3 with RFXtrx433e. LWRF power sockets and dimmer switches. Integrated my existing wirefree alarm PIRs and door contacts with domoticz. Geofencing with Pilot. Harmony Hub. Tado for Heating. Now playing with mysensors.
DomoUHT
Posts: 15
Joined: Friday 13 March 2015 22:08
Target OS: OS X
Domoticz version: 2.2293
Location: Alkmaar, The Netherlands
Contact:

Re: Remote with ONE (on button)

Post 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 !
lagus
Posts: 10
Joined: Saturday 05 December 2015 22:33
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Berlin/Helsinki
Contact:

Re: Remote with ONE (on button)

Post 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
Screenshot from 2017-02-04 23-35-34.png (19.12 KiB) Viewed 7165 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.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest