Page 1 of 1
On Off toggle buttons for on/off switch
Posted: Wednesday 04 December 2019 8:33
by binbo
Hi all,
In “switches” section of domoticz - an on/off switch is a lightbulb, that you click to alternate between on and off.
The problem is - with my zwave devices, domoticz isn’t reporting their state correctly, so I click Off, and the lightbulb stays on. As the button sends the command it currently “thinks” the lights are in.
In scenes - switches have hard “On” and “Off” buttons. So I can send “Off” command I want to send.
Is there any way to have the same two on/off buttons in switches?
Many thanks.
Re: On Off toggle buttons for on/off switch
Posted: Wednesday 04 December 2019 9:17
by C4rtm4N
Has this always been the case or did it just start recently? I had a caching problem that meant state changes weren't being updated but I fixed that by altering my nginx config.
Rather than trying to work around things, would it not be better to solve the actual problem and ensure that state changes always show? There is no reason why they shouldn't.
Re: On Off toggle buttons for on/off switch
Posted: Wednesday 04 December 2019 23:17
by binbo
Hi, thanks for the reply.
I’ve only just moved from a 433 system to zwave.
The relays I’m using: aeotec dual nano switches - they are apparently slow to update domoticz of their state.
So really - what would be ideal for me - is if I could ignore the state check from the device - and just get domoticz to change the lightbulb icon on/off like it did when I had my 433 LightwaveRF system - which didn’t report the relay state. It just turned the icon on/off based on opposite of what was clicked.
Is this possible somehow?
Re: On Off toggle buttons for on/off switch
Posted: Tuesday 18 February 2020 17:27
by akortekaas
You could make a Dzvents script to make a device to something whatever the switch sends when you click it.
Im not a coder but i use this script to take 3 different values from 1 switch to toggle 3 different lights (only 1 light is configured atm)
Device 10 is the switch, sonoff2 is connected to a lamp it is switching.
If you put in your device names and id's and change the raw value data to on of off messages and just do "on" or whatever after both "then"s it should work.
return {
on = { devices = { 10 } },
execute = function(dz, item)
local switch1 = dz.devices("sonoff2")
local switch2 = dz.devices("rfswitch2")
local switch3 = dz.devices("rfswitch3")
if item.rawData[1] == "15282593" then
switch1.toggleSwitch()
elseif item.rawData[1] == "15282600" then
switch2.toggleSwitch()
elseif item.rawData[1] == "15282594" then
switch3.toggleSwitch()
end
end
}