Zigbee lights sometimes wont turn on/off

Xiaomi, Ikea TRÅDFRI, Philips Hue and more.

Moderator: leecollings

Post Reply
Tweak
Posts: 12
Joined: Monday 16 September 2019 10:45
Target OS: -
Domoticz version:
Contact:

Zigbee lights sometimes wont turn on/off

Post 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?
Kedi
Posts: 575
Joined: Monday 20 March 2023 14:41
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Somewhere in NL
Contact:

Re: Zigbee lights sometimes wont turn on/off

Post 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
Logic will get you from A to B. Imagination will take you everywhere.
User avatar
heggink
Posts: 979
Joined: Tuesday 08 September 2015 21:44
Target OS: Raspberry Pi / ODroid
Domoticz version: 12451
Location: NL
Contact:

Re: Zigbee lights sometimes wont turn on/off

Post 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.
Docker in Truenas scale, close to latest beta
DASHTICZ 🙃
RFXCOM, zwavejs2mqtt, zigbee2mqtt,
P1 meter & solar panel
Google home, Wifi Cams motion detection
Geofence iCloud, Bluetooth & Wifi ping
Harmony hub, Nest, lots more :-)
Tweak
Posts: 12
Joined: Monday 16 September 2019 10:45
Target OS: -
Domoticz version:
Contact:

Re: Zigbee lights sometimes wont turn on/off

Post 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"...
User avatar
heggink
Posts: 979
Joined: Tuesday 08 September 2015 21:44
Target OS: Raspberry Pi / ODroid
Domoticz version: 12451
Location: NL
Contact:

Re: Zigbee lights sometimes wont turn on/off

Post 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.
Docker in Truenas scale, close to latest beta
DASHTICZ 🙃
RFXCOM, zwavejs2mqtt, zigbee2mqtt,
P1 meter & solar panel
Google home, Wifi Cams motion detection
Geofence iCloud, Bluetooth & Wifi ping
Harmony hub, Nest, lots more :-)
niki_lauda
Posts: 118
Joined: Saturday 31 August 2013 14:48
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Eindhoven (NL)
Contact:

Re: Zigbee lights sometimes wont turn on/off

Post 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.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest