Zigbee - Losing the will to live and about to ditch the lot

I almost don’t want to jinx it - but since moving to Z2M with the SkyConnect (Z2M wouldn’t even start with ConBee II and adapter: deconz mod), I’ve repaired everything and not a single device has dropped in 2 days.

Lowest LQI is 124 and even that remains connected.

I don’t believe the Aqara devices can pair with SmartThings routers - they actively ignore them and connect direct to the SkyConnect.

So far, it’s pretty stable. I’ll give it a week and come back to you.

Thanks to everyone for your help.

2 Likes

I found that the aqara devices dont move once paired so it is best paired where you want the device to be rather then next to the coordinator. Best practice for all actually not just aqara.

The whole ‘pair via’ thing user interface is a bit hard to get your brain around at first both in Z2M and ZHA. I’ve had mixed results getting Aqara temperature/humidity sensors to stay paired via a remote router device. Glad you are seeing some progress. Again, I would take the LQI numbers with a grain of salt (around the rim of a margarita :wink: )

As a matter of interest, does anyone know if it’s possible to alter the “time to clear” time on Tradfri motion sensors?

The default is 3 minutes and whilst it’s somewhat configurable via settings (specific), it appears to only fake “occupancy clear” - the device still returns clear after 3 minutes have passed.

Thanks.

[Edit]

It seems I’m an idiot. The settings ARE having the desired affect now - it was under ZHA that they weren’t honored.

Impressed with Z2M thus far; but I’m intimately familiar with MQTT already.

There is no doubt that the speed of the ‘event’ based model of ZHA offers faster actions that a Z2M solution via MQTT. That said, if you really need ‘real time’ stuff use Z2M’s menus to do a direct connect between zigbee devices.

Glad you are continuing to see some positive results.

I use a Sonoff 3.0P with Z2M around 16 zigbee devices and is very stable. I have a sky connect plugged in also with open thread firmware ready for thread devices in future. I like to keep separate since easier to troubleshoot.

OK, quick update.

1 device has since dropped off the network. It’s an Aqara - so obviously won’t connect to my existing SmartThings routers. Two new IKEA plug sockets/routers coming Friday.

However, going back to my last post re: IKEA Tradfri “clear” times… it looks like I was right originally. I can set the clear time in “settings (specific)” and it does indeed go off exactly when I specify. However, the device doesn’t pick up new motion until after the original 3 minute timeout has passed. Is there any way to start detecting immediately after I’ve forcibly cleared occupancy?

Thanks

As far as I can tell, they keep sending motion, and only send ‘no motion’ if they have not detected motion for 3 minutes.

This is an example how I use them:

- id: '1567689065684'
  alias: Licht badkamer aan
  description: Licht badkamer aan
  trigger:
  - entity_id: binary_sensor.ikeapir_occupancy
    platform: state
    to: 'on'
  condition:
  - condition: template
    value_template: '{{ state_attr("sun.sun", "elevation") < 5 }}'
  action:
  - data:
      entity_id: light.lichtbadkamer
    service: light.turn_on
  mode: restart
- id: '1567689065685'
  alias: Licht badkamer af
  trigger:
  - entity_id: binary_sensor.ikeapir_occupancy
    platform: state
    to: 'off'
    for: 00:00:10
  condition: []
  action:
  - data:
      entity_id: light.lichtbadkamer
    service: light.turn_off

Dare I say it, but it looks like I finally have a stable ZigBee network with Z2M - all thanks to your help!

There’s just one issue which is frying my brain.

I have a Miboxer FUT036Z (Miboxer FUT036Z control via MQTT | Zigbee2MQTT) detected as a Zigbee model TS0501B. It’s an LED controller, single colour.

Under ZHA, it worked perfectly. Tell it to turn on, it turned on. Turn off, it went off.

Under Z2M, I’m having some very odd behaviour.

Tell it to turn on, it flashes for maybe 200ms and goes off. The logs show only one MQTT message saying to turn on. BUT… after many failed attempts throughout the night, it’ll suddenly start working exactly as expected. It’ll turn on… and 3 minutes after the stairs motion sensors detect no occupancy, it goes off as expected.

The MQTT logs are identical for both requests - ones which fail AND ones which work fine; so I’m stumped. I’d argue it’s firmware, but it hasn’t changed since I used ZHA and it never missed a beat with that.

I’ve also tried both ways to turn it on; both device->turn on and service->light->turn on. Only under service->turn on do I see all the configuration options like brightness percentages, transition etc.

If you guys can solve this, I’ll be truly amazed.

Not an answer to your problem and there is probably a better way to do this in Z2M logs, however I use bash script like below to just see the raw MQTT that Z2M is sending out to Home Assistant. You will need to install the mosquitto client programs to make this run. I just let it run in a TMUX session, I have found some behaviors that I did not expect and JSON message appearing at HA’s door that sometimes confused HA:

#!/bin/bash
echo "Bash version ${BASH_VERSION}..."

while :
do

    PRI=$(mosquitto_sub -C 1 -h 192.168.2.242 -t zigbee2mqtt/0x54aa441abc6292fb)
    printf "%s\n" "$PRI"
#    echo $PRI


done

Thanks dproffer!

I haven’t fixed it by any means, but I think I’ve found a work-around. By calling “on” twice in quick succession, it appears to work. Oddly, “off” only need be called once.

It’s almost as if “do not disturb” mode is on (which it’s not). If I understand correctly, DND mode means the first call is ignored and the second is actioned; so you don’t have to alter automations but devices can be set to DND if they’re acting up/you want to temporarily kill automations for that device.

So far, so good. Not a single device has dropped since installing Z2M and 2 IKEA routers (ditched the SmartThings as Aqara devices won’t talk to them). Dare I risk it… and say it’s stable right now?!

There is a “retry” automation for things that sometimes fail when called, but it is a workaround I don’t want to ever use (prefer as all of you do to just fix the issue)

Hi Paul,
Happy to hear of your progress! Glad you are finding Zigbee2MQTT a place where you can be pretty successful with this ‘wild west’ firehose of new zigbee devices. I do hope ZHA does make some good strides as well, however for now Mr. Kanters and team at Z2M are doing the amazing work. Yes, it is frustrating that some Zigbee devices do not communicated with each other. Of the problems I have had, 90% of them have been with Aqara devices, that guides my future Zigbee device purchase strongly. Again, when figuring out some of these these issues, the logs and tools at Zigbee2MQTT have really been the most helpful of any of the 10 or so Zigbee networks I have experimented with over the years.

Enough of my blathering. To your issue with as I understand it issue you have with the Ikea motion sensors commanding the FUT036Z LED controller.

First, I am really not sure from your writing what ‘level’ you are referring to with your issue. If you can spell this out a bit clearer this might help the many knowledgeable folks hear help pinpoint the root cause. When I say ‘level’, I am not sure if you are talking Home Assistant Automations, Home Assistant sensors/lights, MQTT messages or raw Zigbee commands. The raw zigbee level is pretty hard and very often not necessary to get down to. The MQTT message level is IMHO the right starting point. You really need to understand what MQTT messages Z2M is creating from the raw Zigbee commands/messages and what Z2M will do when a MQTT message is sent to it for a device.

This is why I recommend either the command line tool I showed in my previous post or a very useful GUI tool, ‘MQTT Explorer’ :

http://mqtt-explorer.com/

From my experience with the Ikea motion sensors, I would make sure the switch that shows the ‘sun’ vs. ‘moon’ on the back is in the ‘sun’ position, I have never been able to figure out the ‘illuminance_above_threshold’ function that I believe this switch controls.

Below is a binary sensor that I use for the Ikea motion sensor. You have to extract out the JSON attribute “occupancy” true/false as the important message. And VERY important in any automations you need to explicitly check for a binary sensor based “occupancy” change from ‘on’ to ‘off’ or ‘off’ to ‘on’. This is due to the fact the Ikea sensor will go to sleep and cause HA to set the binary sensor to ‘unknown’. Then when the sensor wakes up for a battery check or some reason other than a true occupancy change, your automation may fire. I have the HA binary sensor to ‘time out’ after 3600 seconds, this might or might NOT be a good idea.

I’m not sure where you found that the “occupancy clear” defaults to 180 seconds (3 minutes). The switch on the back has setting for 1 5 and 10 minutes. However, I believe the Z2M setting default of 90 seconds overrides this switch. And again, it’s default on my Zigbee2MQTT is 90 seconds.

Fundamentally, you have to make sure your HA binary sensor and automations based on it are only triggering on the exact state changes you want.

  - name: "Ikea Motion Detector West"
    device_class: motion
    unique_id: "0x000b57abce8b6af8-Motion"
    expire_after: 3600
    state_topic: "zigbee2mqtt/0x000b57abce8b6af8"
    value_template: "{{ value_json.occupancy }}"
    payload_off: false
    payload_on: true
    availability_topic: zigbee2mqtt/0x000b57abce8b6af8/availability
    json_attributes_topic: "zigbee2mqtt/0x000b57fffe8b6af8"

{"battery":100,"elapsed":65096,"illuminance_above_threshold":false,"last_seen":"2023-08-16T16:17:05-07:00","linkquality":83,"occupancy":true,"update":{"installed_version":604241925,"latest_version":604241925,"state":"idle"}}



{"battery":100,"elapsed":90003,"illuminance_above_threshold":false,"last_seen":"2023-08-16T16:17:05-07:00","linkquality":83,"occupancy":false,"update":{"installed_version":604241925,"latest_version":604241925,"state":"idle"}}

Second, I have used the Ikea motion sensors for a couple years with the Native Ikea hub, ZHA and Z2M. While they have for the most part done their job. They are a rather odd device.

Good hunting!

Hi folks

Nearly a month later, it appears the network is now completely stable. I’m still running the SkyConnect USB but with Z2M rather than ZHA.

Thank you to everyone for your help.

Paul.

4 Likes