I have bought a pusbutton from banggood: https://www.banggood.com/KTNNKG-3V-433M ... rehouse=CN
I added the push button in domoticz.
When i push the button it is activated in domotocz, but the pusbutton stays active. When i push again nothing happens
The only way to deactivate the witch is in domoticz, or when i add a delay of 1 second.
Does anybody know how i can use this button to switch a light?
When i add a dzvents script t turn on a light, it works a little.
The lights goes on, but goes off again with the 1 second delay.
I hope somebody can help
How to switch lights with pushbutton? Topic is solved
Moderator: leecollings
-
- Posts: 46
- Joined: Thursday 15 August 2013 22:01
- Target OS: -
- Domoticz version:
- Contact:
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: How to switch lights with pushbutton?
I do not own this type of pushButton but a similar one. Mine is setup in domoticz as a selector type switchwith levelNames
To inspect how yours is setup please run below script a couple of times and collect the relevant loglines. Maybe that will help identifying what happensOff, Click, Double Click, Long Click and Long Click Release
Please share the script and relevant loglines so we can try to help you solve the issue.dutchronnie wrote: ↑Wednesday 11 December 2019 14:24 When i add a dzVents script to turn on a light, it works a little. The lights goes on, but goes off again with the 1 second delay.
Code: Select all
return
{
on =
{
devices =
{
'pushButton' -- change to name of your device
}
},
logging =
{
level = domoticz.LOG_DEBUG
},
execute = function(dz, item)
_G.logMarker = _G.moduleLabel
dz.log('State of ' .. item.name .. ' is ' .. ( item.state or 'NA'),dz.LOG_DEBUG)
dz.log('nValue ' .. item.name .. ' is ' .. ( item.nValue or 'NA'),dz.LOG_DEBUG)
dz.log('sValue ' .. item.name .. ' is ' .. ( item.sValue or 'NA'),dz.LOG_DEBUG)
dz.log('type of ' .. item.name .. ' is ' .. ( item.deviceType or 'NA'),dz.LOG_DEBUG)
dz.log('subType of ' .. item.name .. ' is ' .. ( item.deviceSubType or 'NA'),dz.LOG_DEBUG)
dz.log('Level ' .. item.name .. ' is ' .. ( item.level or 'NA' ),dz.LOG_DEBUG)
dz.log('levelName of ' .. item.name .. ' is ' .. ( item.levelName or 'NA'),dz.LOG_DEBUG)
end
}
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
-
- Posts: 46
- Joined: Thursday 15 August 2013 22:01
- Target OS: -
- Domoticz version:
- Contact:
Re: How to switch lights with pushbutton?
Thanks Waaren,
This are the results when i push the button:
2019-12-11 19:40:08.936 Status: dzVents: Info: Handling events for: "Drukknop", value: "On"
2019-12-11 19:40:08.936 Status: dzVents: Info: ------ Start internal script: Script #2: Device: "Drukknop (RFLink Gateway)", Index: 241
2019-12-11 19:40:08.936 Status: dzVents: Debug: Script #2: State of Drukknop is On
2019-12-11 19:40:08.936 Status: dzVents: Debug: Script #2: nValue Drukknop is 1
2019-12-11 19:40:08.937 Status: dzVents: Debug: Script #2: sValue Drukknop is On
2019-12-11 19:40:08.937 Status: dzVents: Debug: Script #2: type of Drukknop is Light/Switch
2019-12-11 19:40:08.937 Status: dzVents: Debug: Script #2: subType of Drukknop is EV1527
2019-12-11 19:40:08.937 Status: dzVents: Debug: Script #2: Level Drukknop is 0
2019-12-11 19:40:08.937 Status: dzVents: Debug: Script #2: levelName of Drukknop is NA
All the times i press the button i get the same results.
Long Press, double click, all the same
I have to click in Domoticz on the button to switch it off.
Then i get the following results:
2019-12-11 19:48:07.463 Status: User: Admin initiated a switch command (241/Drukknop/Off)
2019-12-11 19:48:08.109 Status: dzVents: Info: Handling events for: "Drukknop", value: "Off"
2019-12-11 19:48:08.110 Status: dzVents: Info: ------ Start internal script: Script #2: Device: "Drukknop (RFLink Gateway)", Index: 241
2019-12-11 19:48:08.110 Status: dzVents: Debug: Script #2: State of Drukknop is Off
2019-12-11 19:48:08.110 Status: dzVents: Debug: Script #2: nValue Drukknop is 0
2019-12-11 19:48:08.110 Status: dzVents: Debug: Script #2: sValue Drukknop is Off
2019-12-11 19:48:08.110 Status: dzVents: Debug: Script #2: type of Drukknop is Light/Switch
2019-12-11 19:48:08.110 Status: dzVents: Debug: Script #2: subType of Drukknop is EV1527
2019-12-11 19:48:08.110 Status: dzVents: Debug: Script #2: Level Drukknop is 0
2019-12-11 19:48:08.110 Status: dzVents: Debug: Script #2: levelName of Drukknop is NA
The button is not switching off by clicking on the button.
This are the results when i push the button:
2019-12-11 19:40:08.936 Status: dzVents: Info: Handling events for: "Drukknop", value: "On"
2019-12-11 19:40:08.936 Status: dzVents: Info: ------ Start internal script: Script #2: Device: "Drukknop (RFLink Gateway)", Index: 241
2019-12-11 19:40:08.936 Status: dzVents: Debug: Script #2: State of Drukknop is On
2019-12-11 19:40:08.936 Status: dzVents: Debug: Script #2: nValue Drukknop is 1
2019-12-11 19:40:08.937 Status: dzVents: Debug: Script #2: sValue Drukknop is On
2019-12-11 19:40:08.937 Status: dzVents: Debug: Script #2: type of Drukknop is Light/Switch
2019-12-11 19:40:08.937 Status: dzVents: Debug: Script #2: subType of Drukknop is EV1527
2019-12-11 19:40:08.937 Status: dzVents: Debug: Script #2: Level Drukknop is 0
2019-12-11 19:40:08.937 Status: dzVents: Debug: Script #2: levelName of Drukknop is NA
All the times i press the button i get the same results.
Long Press, double click, all the same
I have to click in Domoticz on the button to switch it off.
Then i get the following results:
2019-12-11 19:48:07.463 Status: User: Admin initiated a switch command (241/Drukknop/Off)
2019-12-11 19:48:08.109 Status: dzVents: Info: Handling events for: "Drukknop", value: "Off"
2019-12-11 19:48:08.110 Status: dzVents: Info: ------ Start internal script: Script #2: Device: "Drukknop (RFLink Gateway)", Index: 241
2019-12-11 19:48:08.110 Status: dzVents: Debug: Script #2: State of Drukknop is Off
2019-12-11 19:48:08.110 Status: dzVents: Debug: Script #2: nValue Drukknop is 0
2019-12-11 19:48:08.110 Status: dzVents: Debug: Script #2: sValue Drukknop is Off
2019-12-11 19:48:08.110 Status: dzVents: Debug: Script #2: type of Drukknop is Light/Switch
2019-12-11 19:48:08.110 Status: dzVents: Debug: Script #2: subType of Drukknop is EV1527
2019-12-11 19:48:08.110 Status: dzVents: Debug: Script #2: Level Drukknop is 0
2019-12-11 19:48:08.110 Status: dzVents: Debug: Script #2: levelName of Drukknop is NA
The button is not switching off by clicking on the button.
-
- Posts: 31
- Joined: Sunday 05 March 2017 11:49
- Target OS: Raspberry Pi / ODroid
- Domoticz version: latest B
- Location: Lo Santiago, Murcia, Spain
- Contact:
Re: How to switch lights with pushbutton?
Hi Ronnie
It is a push on button.
No change he in state only can trigger on activation.
So in either lua or dzvents create a script that has an on active -> toggle the device.
With this you can emulate an on-off switch
It is a push on button.
No change he in state only can trigger on activation.
So in either lua or dzvents create a script that has an on active -> toggle the device.
With this you can emulate an on-off switch
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: How to switch lights with pushbutton?
can you try this one ?dutchronnie wrote: ↑Wednesday 11 December 2019 19:50 2019-12-11 19:40:08.936 Status: dzVents: Debug: Script #2: State of Drukknop is On
I have to click in Domoticz on the button to switch it off.
The button is not switching off by clicking on the button.
Code: Select all
return
{
on = { devices = { 'pushButton' }}, -- change to name of your pushButton
execute = function(dz)
dz.devices('lightName').toggleSwitch() -- change to name of your light
end
}
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
-
- Posts: 46
- Joined: Thursday 15 August 2013 22:01
- Target OS: -
- Domoticz version:
- Contact:
Re: How to switch lights with pushbutton?
Thanks waaren,
This code is doinge exactly what i want.
push button, and the light goes on, push again and the light goes out.
Thanks
This code is doinge exactly what i want.
push button, and the light goes on, push again and the light goes out.
Thanks
Who is online
Users browsing this forum: No registered users and 0 guests