Page 1 of 1

Zigbee lights sometimes wont turn on/off

Posted: Thursday 30 March 2023 13:09
by Tweak
Hello, i have a strange problem with my Zigbee IKEA lights. I hope someone can help me.

I have like 2 "switches" in domoticz named: ZigbeeTuinhuislampen and ZigbeeGaragelampen
On these switches i use Timers for On/Off

The scripts (DzVents)

Code: Select all

return {
	on = {
		devices = {
			'ZigbeeTuinhuislampen'
		}
	},
	execute = function(domoticz, device)
	
	if (domoticz.devices('ZigbeeTuinhuislampen').state == 'On') then
	    domoticz.devices('LampTuinhuis1').dimTo(60)
	    domoticz.devices('LampTuinhuis2').dimTo(60)
	    domoticz.devices('LampTuinhuis3').dimTo(60)
	    domoticz.devices('LampTuinhuis4').dimTo(60)

	    
    end
    if (domoticz.devices('ZigbeeTuinhuislampen').state == 'Off') then
        domoticz.devices('LampTuinhuis1').switchOff()
	    domoticz.devices('LampTuinhuis2').switchOff()
	    domoticz.devices('LampTuinhuis3').switchOff()
    	domoticz.devices('LampTuinhuis4').switchOff()
    	
        
end
end
}
And:

Code: Select all

return {
	on = {
		devices = {
			'ZigbeeGaragelampen'
		}
	},
	execute = function(domoticz, device)
	
	if (domoticz.devices('ZigbeeGaragelampen').state == 'On') then
        domoticz.devices('LampGarage1').switchOn()
	    domoticz.devices('LampGarage2').switchOn().afterSec(1)
	    domoticz.devices('LampGarage3').switchOn().afterSec(2)
	    domoticz.devices('LampGarage4').switchOn().afterSec(3)
	    
    end
    if (domoticz.devices('ZigbeeGaragelampen').state == 'Off') then
        domoticz.devices('LampGarage4').switchOff()
        domoticz.devices('LampGarage3').switchOff().afterSec(1)
        domoticz.devices('LampGarage2').switchOff().afterSec(2)
        domoticz.devices('LampGarage1').switchOff().afterSec(3)
	    
end
end
}

Now the problem, sometimes the lights are staying on or off. When i look in Domoticz the switch ZigbeeGaragelampen and ZigbeeTuinhuislampen are OFF but when i look at the lights (example LampGarage4) it says that device is ON! So what i do? Turn the main switch On and Off again and fixed.

I am not able to find out why this is happening, there is no error in the log and because it is only happening sometimes its hard to find the problem.
I recently updated zigbee2mqtt to the newest version but nope did not help.

Anyone that knows why this is happening? Or maybe possible to build in some kind of loop? Like switchoff and check if light is really switched off after a few seconds and try again?

Re: Zigbee lights sometimes wont turn on/off

Posted: Thursday 30 March 2023 14:18
by Kedi
What happens if you simplify:

Code: Select all

	if (domoticz.devices('ZigbeeGaragelampen').state == 'On') then
to?

Code: Select all

	if device.active then
and ofcourse the 'Off" to device.inActive

Re: Zigbee lights sometimes wont turn on/off

Posted: Thursday 30 March 2023 14:37
by heggink
Assuming you use zigbee2mqtt with Domoticz autodiscovery, if devices have a bad signal then they may not switch but domoticz doesn't always pick up on that. I also had that issue where I put a repeater somewhere in the middle (also IKEA related in my case). I have both the Ikea E1746 as well as a regular spare power plug at the edge of my house to extend the signal.

You can test the signal in the zigbee2mqtt web interface as well as look at your network map to see how the device are connected (and whether the repeater maks things better).

That helped me at least.

Re: Zigbee lights sometimes wont turn on/off

Posted: Thursday 30 March 2023 15:02
by Tweak
Hmm, i also thougt it is a signal problem because the lights "LampTuinhuis" are far away.

But! The lights on the garage are not so far away from "LampTuinhuis" and IN the garage there is a Ikea power plug (2 of them)

And what i dont get, why no errors? Or does "the main switch" turn all the lights of but it jumps back to On?
If i remember correctly i also checked the "last seen date/time" on the devices and they did not match "the main switch"...

Re: Zigbee lights sometimes wont turn on/off

Posted: Thursday 30 March 2023 15:51
by heggink
The no errors bit depends on the integration which is mqtt. If you keep zigbee2mqtt open then you can (if you set the logging correctly) see what is being logged and any errors occurring. From what I could tell (but not really investigated in any detail), zigbee2mqtt does not send error messages over mqtt so domoticz can pick up on them (or domoticz ignores them, whichever). If the network is OK then this is never an issue until you run into these. Once you resolve then (keeping the zigbee2mqtt logging open) then things work smoothly.

Re: Zigbee lights sometimes wont turn on/off

Posted: Thursday 07 March 2024 23:07
by niki_lauda
Tweak wrote: Thursday 30 March 2023 13:09 Hello, i have a strange problem with my Zigbee IKEA lights. I hope someone can help me.

I have like 2 "switches" in domoticz named: ZigbeeTuinhuislampen and ZigbeeGaragelampen
On these switches i use Timers for On/Off

The scripts (DzVents)

Code: Select all

return {
	on = {
		devices = {
			'ZigbeeTuinhuislampen'
		}
	},
	execute = function(domoticz, device)
	
	if (domoticz.devices('ZigbeeTuinhuislampen').state == 'On') then
	    domoticz.devices('LampTuinhuis1').dimTo(60)
	    domoticz.devices('LampTuinhuis2').dimTo(60)
	    domoticz.devices('LampTuinhuis3').dimTo(60)
	    domoticz.devices('LampTuinhuis4').dimTo(60)

	    
    end
    if (domoticz.devices('ZigbeeTuinhuislampen').state == 'Off') then
        domoticz.devices('LampTuinhuis1').switchOff()
	    domoticz.devices('LampTuinhuis2').switchOff()
	    domoticz.devices('LampTuinhuis3').switchOff()
    	domoticz.devices('LampTuinhuis4').switchOff()
    	
        
end
end
}
And:

Code: Select all

return {
	on = {
		devices = {
			'ZigbeeGaragelampen'
		}
	},
	execute = function(domoticz, device)
	
	if (domoticz.devices('ZigbeeGaragelampen').state == 'On') then
        domoticz.devices('LampGarage1').switchOn()
	    domoticz.devices('LampGarage2').switchOn().afterSec(1)
	    domoticz.devices('LampGarage3').switchOn().afterSec(2)
	    domoticz.devices('LampGarage4').switchOn().afterSec(3)
	    
    end
    if (domoticz.devices('ZigbeeGaragelampen').state == 'Off') then
        domoticz.devices('LampGarage4').switchOff()
        domoticz.devices('LampGarage3').switchOff().afterSec(1)
        domoticz.devices('LampGarage2').switchOff().afterSec(2)
        domoticz.devices('LampGarage1').switchOff().afterSec(3)
	    
end
end
}

Now the problem, sometimes the lights are staying on or off. When i look in Domoticz the switch ZigbeeGaragelampen and ZigbeeTuinhuislampen are OFF but when i look at the lights (example LampGarage4) it says that device is ON! So what i do? Turn the main switch On and Off again and fixed.

I am seeing the same kind of behavior somtimes. Difference between the state of a switch in the interface, the real state of the switch and the state of the switch in the events devices States overview.

Worked around it with a few dummy switches. But still anoying.