RFlink - toggle swich - one gang

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.

Moderators: leecollings, remb0

Post Reply
Kamil
Posts: 8
Joined: Saturday 26 January 2019 15:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Newest β
Location: PL
Contact:

RFlink - toggle swich - one gang

Post by Kamil »

Version: 4.10364
Platform: RPi
Plugin/Hardware: RFLink USB GW

Hello all,
This is my first post so I would like to say Hi everyone!
;)
I have a problem with the lamp switch (toggle switch).
Scheme layout below:
Image
I would like to control the lamp in two ways: using the switch on the wall (one gang) or using the button in the GUI Domoticz.
The switch on the wall is one-button(toggle).
I would also like that after pressing the switch on the wall, the status of the lamp (on / off) changed on the switch in the GUI Domoticz.
Is anyone able to help?
I've tried Blocky, DZvents, LUA scripts, unfortunately without success, the scripts only work partially (eg they do not update the status of the switch in Domoticz).
Thank You in advance for any help!
Screen Shot 01-26-19 at 03.41 PM.PNG
Screen Shot 01-26-19 at 03.41 PM.PNG (13.18 KiB) Viewed 357 times
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: RFlink - toggle swich - one gang

Post by waaren »

Kamil wrote: Saturday 26 January 2019 16:15 I have a problem with the lamp switch (toggle switch).
I would like to control the lamp in two ways: using the switch on the wall (one gang) or using the button in the GUI Domoticz.
The switch on the wall is one-button(toggle).
I would also like that after pressing the switch on the wall, the status of the lamp (on / off) changed on the switch in the GUI Domoticz.
I've tried Blocky, DZvents, LUA scripts, unfortunately without success, the scripts only work partially (eg they do not update the status of the switch in Domoticz).
What are the device id's in domoticz ? Can you show what you already have in dzVents ?
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Kamil
Posts: 8
Joined: Saturday 26 January 2019 15:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Newest β
Location: PL
Contact:

Re: RFlink - toggle swich - one gang

Post by Kamil »

@waaren sure:

Code: Select all

commandArray = {}

print ("All based event fired");
-- loop through all the devices
if (devicechanged['Lamp'] == 'On') and (uservariables['Lamp_variable'] == 'OFF') then
commandArray['Lamp_1']='On'
commandArray['Variable:Lamp_variable']='ON'

print ("Przełacznik on zmienna off przelacznik na On zmiennana on");

elseif (devicechanged['Lamp'] == 'On') and (uservariables['Lamp_variable'] == 'ON') then
commandArray['Lamp_1']='Off'
commandArray['Variable:Lamp_variable']='OFF'

print ("Przełacznik on zmienna on przelacznik na Off zmienna na off");
end

return commandArray
Where:
"Lamp" - my switch added from RFLink (toggle button)
"Lamp_1" - my Domoticz helping switch
"Lamp_variable" - my variable to counting lamp state

and Blocky:
Screen Shot 01-26-19 at 04.52 PM.PNG
Screen Shot 01-26-19 at 04.52 PM.PNG (34.54 KiB) Viewed 346 times
Where:
"DużyPokój_LDuża_punkt" = "Lamp"
"DużyPokój_LDuża_punkt_zm" = "Lamp_1"
"DużyPokój_LDuża_punkt_stany" = "Lamp_variable"

I also tried in different combinations with the triggers on the buttons (json trigers), unfortunately without successes :oops:
Kamil
Posts: 8
Joined: Saturday 26 January 2019 15:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Newest β
Location: PL
Contact:

Re: RFlink - toggle swich - one gang

Post by Kamil »

waaren wrote: Saturday 26 January 2019 16:44 What are the device id's in domoticz ? Can you show what you already have in dzVents ?
I used the script from my previous post, but I think I should write small correction:

I need a script that will synchronize the ON / OFF indication in the Domoticz GUI regardless of whether the light has been switched on via the website, the application on the mobile phone or using a button on the wall. The button itself works, but the status icon of the button does not change when the light is switched on by pressing the button (on the wall).
:(
Can anyone help?
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest