Ikea Tradfri button not updating with Zigbee binding

  • Platform information:
    • Hardware: Raspberry Pi 4
    • OS: OpenHabian
    • openHAB version: 3.3.0
  • Issue of the topic: Tradfri buttons are not updating state with Zigbee binding

I’ve got a stable Z-Wave setup and decided to dip my toes into Zigbee with the IKEA product line. I set up the Ember coordinator and successfully added 2 dimmable light bulbs and 2 buttons. While I can control the lights, the buttons do not seem to be issuing any updates when pressed (long, single, double, anything) but still report values for each of their channels. I found a thread from the OH 2 days and the solution, at that time, was to set up Zigbee2MQTT but this seems like something that could have been sorted by now. Is this still the best way to get these buttons to work? Should I, instead, get a Tradfri gateway and use that binding?

I cannot hello with you specific issue, but just as a general recommendation:

If you already have the correct hardware (ember stick), better go with installing additional software (zigbee2mqtt) instead of getting more hardware (tradfri gateway)

I’m using zigbee2mqtt and that’s working fine (e.g. I recently bought a lightbulb that was not supported and the solution was to update to latest version what fixed the issue).

Thanks for the input. I only suggest the gateway due to the complexity of setting up MQTT. I’ve been trying to read up and I’m not sure which pieces are really necessary and how I can/should accomplish things.
Do I need to install the MQTT binding or will Zigbee2MQTT handle everything with the addition of the Mosquitto server?
Z2M appears to give me a UI that allows the addition of devices into its system. What do I use to add them as items in OH?

Z2M is a separate software which, in combination with an mqtt broker and the mqtt binding, is an alternative to using the OH zigbee binding.
Yes, the overall setup is more complex but there are some advantages like support for more hardware devices, being able to put additional coordinators in different locations like e.g. a garage or a garden house. It comes with an UI that lets you control your devices and configure them properly. If you are planning to use tuya devices z2m is the way to go (or tuya2mqtt).
If all your devices are supported by the binding and are reachable take the binding, otherwise give z2m a try (that’s what I did).
Thomas

Maybe it’s more about the right understanding, but zigbee2mqtt (at least from my perspective) is not really not complex than other integrations.

Let me compare both options for you.

General setup and dataflow:

Openhab <-> mqtt binding <-> mqtt server <-> zigbee2mqtt
vs
Openhab <-> Ikea tradfri binding <-> tradfri hub

One time effort:

Z2m solution:

  1. install mqtt server
  2. install z2m server
  3. install mqtt binding

Tradfri solution:

  1. install tradfri hub
  2. install tradfri binding

Effort to add a new ZigBee device

Z2m solution:

  1. add device to zigbee2mqtt
  2. add openhab things & items

Tradfri solution:

  1. add device to tradfri hub
  2. add things& items in openhab

As you can see one time effort for z2m solution is a bit higher, but recurring effort to add new devices is similar.
With z2m you have better chances that new devices will be supported (as it is open source), with the Ikea solution you always relay on what Ikea will support (e.g. Philips hue is only supporting lights and switches but no radiator thermostats or other devices)

Thank you for the excellent explanation! I was not able to find clear steps for a complete solution and this was what I believed to be required. Thank you, again, for clarifying.

Well, this has gotten complicated… I’ve installed z2m, Mosquitto, and the mqtt binding, everything reported back as successful, but I can’t access the front end and the mqtt binding doesn’t see the Mosquitto server. I’m wondering if the reverse proxy that installed following the “Securing access to openHAB” article is the cause. I don’t quite know enough about what that service is doing to say for sure…

Not a lot of info to go on here. Below are the steps to install the Mosquitto server, and connect openHAB to the server via the MQTT binding:

Thank you for the instructions - I was expecting something Mosquitto-specific or for the scan button to work. The broker now shows online but I’m still unable to reach the zigbee2mqtt front end to add devices. Going to [IP address]:8081 gives an “Unable to connect” message.

For mqtt I can recommend to use an external mqtt browser / explorer to connect to the server and view well messages that are posted. This will later help to configure the things I’ve everything is running.

For z2m without any specific error message is hard to help, but you have seen in the docs that you 1) need to activate the frontend in the config file and 2) if you want to use port 8081 need to change the default configuration?

Run service zigbee2mqtt stop to close down z2m.

Then go to the zigbee2mqtt installation directory and run npm start
This should start z2m and give you feedback in case something goes wrong.

I understand the need for an error message but, as far as I can tell, this is the only thing that was being presented. I saw the need to enable the front end in the online documentation but the openhabian install implies, with a message at the end of installation, that the front end is running and available on port 8081.

This was very helpful! See output below:

 npm start

> zigbee2mqtt@1.27.2 start /opt/zigbee2mqtt
> node index.js

Zigbee2MQTT:info  2022-09-14 08:03:10: Logging to console and directory: '/var/log/zigbee2mqtt/2022-09-14.08-03-10al' filename: log.txt
Zigbee2MQTT:info  2022-09-14 08:03:10: Starting Zigbee2MQTT version 1.27.2 (commit #7dc48fb6)
Zigbee2MQTT:info  2022-09-14 08:03:10: Starting zigbee-herdsman (0.14.53)
Zigbee2MQTT:error 2022-09-14 08:03:32: Error while starting zigbee-herdsman
Zigbee2MQTT:error 2022-09-14 08:03:32: Failed to start zigbee
Zigbee2MQTT:error 2022-09-14 08:03:32: Check https://www.zigbee2mqtt.io/guide/installation/20_zigbee2mqtt-fails-to-start.html for possible solutions
Zigbee2MQTT:error 2022-09-14 08:03:32: Exiting...
Zigbee2MQTT:error 2022-09-14 08:03:33: Error: Failed to connect to the adapter (Error: SRSP - SYS - ping after 6000ms)
    at ZStackAdapter.start (/opt/zigbee2mqtt/node_modules/zigbee-herdsman/src/adapter/z-stack/adapter/zStackAdapter.ts:103:27)
    at Controller.start (/opt/zigbee2mqtt/node_modules/zigbee-herdsman/src/controller/controller.ts:132:29)
    at Zigbee.start (/opt/zigbee2mqtt/lib/zigbee.ts:58:27)
    at Controller.start (/opt/zigbee2mqtt/lib/controller.ts:101:27)
    at start (/opt/zigbee2mqtt/index.js:109:5)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! zigbee2mqtt@1.27.2 start: `node index.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the zigbee2mqtt@1.27.2 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/openhabian/.npm/_logs/2022-09-14T13_03_33_513Z-debug.log

Thinking I had maybe selected the wrong adapter based on the error message above, I used the openhabian-config menu to remove and reinstall zigbee2mqtt and ensure the right adapter was selected. Unfortunately, the behavior above persists. I also removed the zigbee binding, in case there was a conflict in access to the adapter but, again, I’m receiving the same error message. The log referred to in the error messages above is a copy of the output shown here so there’s nothing new to gather from that.

Out of desperation, and to remove doubt of the wrong adapter selected, I uninstalled; removed my z-wave adapter (to prevent any mix ups and have only one option at the selection window); rebooted; reinstalled; and started the service manually. The output of that is below and is essentially the same as before.

 npm start

> zigbee2mqtt@1.27.2 start /opt/zigbee2mqtt
> node index.js

Building Zigbee2MQTT... (initial build), finished
Zigbee2MQTT:info  2022-09-14 08:40:51: Logging to console and directory: '/var/log/zigbee2mqtt/2022-09-14.08-40-51al' filename: log.txt
Zigbee2MQTT:info  2022-09-14 08:40:52: Starting Zigbee2MQTT version 1.27.2 (commit #7dc48fb6)
Zigbee2MQTT:info  2022-09-14 08:40:52: Starting zigbee-herdsman (0.14.53)
Zigbee2MQTT:error 2022-09-14 08:41:14: Error while starting zigbee-herdsman
Zigbee2MQTT:error 2022-09-14 08:41:14: Failed to start zigbee
Zigbee2MQTT:error 2022-09-14 08:41:14: Check https://www.zigbee2mqtt.io/guide/installation/20_zigbee2mqtt-fails-to-start.html for possible solutions
Zigbee2MQTT:error 2022-09-14 08:41:14: Exiting...
Zigbee2MQTT:error 2022-09-14 08:41:14: Error: Failed to connect to the adapter (Error: SRSP - SYS - ping after 6000ms)
    at ZStackAdapter.start (/opt/zigbee2mqtt/node_modules/zigbee-herdsman/src/adapter/z-stack/adapter/zStackAdapter.ts:103:27)
    at Controller.start (/opt/zigbee2mqtt/node_modules/zigbee-herdsman/src/controller/controller.ts:132:29)
    at Zigbee.start (/opt/zigbee2mqtt/lib/zigbee.ts:58:27)
    at Controller.start (/opt/zigbee2mqtt/lib/controller.ts:101:27)
    at start (/opt/zigbee2mqtt/index.js:109:5)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! zigbee2mqtt@1.27.2 start: `node index.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the zigbee2mqtt@1.27.2 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/openhabian/.npm/_logs/2022-09-14T13_41_15_038Z-debug.log

The adapter I’m using came from the list of supported adapters (POPP ZB-STICK) and was working with the zigbee binding previously.

EDIT:
I wanted to make sure the adapter was also supported by zigbee2mqtt and found the following here (Supported Adapters | Zigbee2MQTT):

If Zigbee2MQTT fails to start, try adding the following to your configuration.yaml

serial:
  adapter: ezsp

Added the adapter line to the configuration file at /opt/zigbee2mqtt/data/configuration.yaml and restarted with npm to great success. Front end now shows at the advertised address and port. Now to add those buttons…

OK, good to hear it is working now - just thought you might have something else still running that blocks the adapter.
Try a reboot and see if z2m now shows up without manually starting it.

Regarding the button:
I guess you mean that small dimmer button that is sold together with a bulb (guess all those buttons at IKEA a similar). I have such a button up and running, will have a look this evening and post my setup.

Service is still working after a reboot; I think that’s got THAT piece sorted.

You’re right, this is one of the IKEA dimmer buttons. I was able to get one added through the front end but it keeps failing the “interview” phase and pops up an error message saying it was not paired. To make sure this isn’t a loss of signal thing, I placed the button a few inches away from the adapter. Is this like z-wave where it may be some time before the device transmits its data to the server or is it more immediate? Is there a way to force the interview in a similar way to a z-wave “wake up” command?

Delete it again from z2m.
Then factory reset the button (Unscrew the cover, press it 4 times in quick succession to factory reset).
After this try pairing it again.

It looks like I’ll be needing a USB extension cable as suggested in the zigbee2mqtt documentation. I did everything I could to reduce interference - turn off wifi on the RPi, remove z-wave dongle, turn off wifi in the house; still no success with interrogation and pairing. Cable should be here sometime tomorrow.

USB extension cable was delivered and installed and the buttons are still showing the same behavior. I know the basic functionality is there because I was able to connect, interview, and update 2 Tradfri light bulbs, so at least there’s that. It’s just the stupid buttons…
I did experience some interesting behavior while it was toying with different things to get them to pair. If I held down the pairing button while z2m was allowing new devices, the light bulb would pulse in an erratic manner. It only did it once but when I later pressed the button, the bulb turned off. I’m not sure what was going on but the obvious takeaway is that the button was talking directly to the bulb.
Looking at the z2m page for them (IKEA E1812 control via MQTT | Zigbee2MQTT) there’s a note about devices below FW rev 2.3.75 and how I’m supposed to send it a command. Not being super familiar with z2m - is this something I’m supposed to issue from the Dev Console of the device? When it says “sending to”, does that go in the “Cluster” window?

Sorry, that is a different button than mine, I have none of these so can’t help you with that one.
In general it might be beneficial if you post the behaviour shown in the z2m log during pairing as well as when you are pushing the button after the pairing - maybe there is some useful information in there so someone might be able to help better.

I’m starting to suspect my adapter is somehow at fault. It’s listed in the supported devices of z2m as “experimental” but doesn’t elaborate what that means and the forums haven’t helped me. As requested, here is the full log excerpt at the dubug level from an exclusion and inclusion, interview, and failure cycle.

info 2022-09-19 09:40:23Succesfully changed options
info 2022-09-19 09:40:23MQTT publish: topic 'zigbee2mqtt/bridge/response/options', payload '{"data":{"restart_required":false},"status":"ok","transaction":"fxiei-1"}'
debug 2022-09-19 09:40:29Received MQTT message on 'zigbee2mqtt/bridge/request/device/remove' with data '{"block":false,"force":true,"id":"0x0c4314fffe23020c","transaction":"fxiei-2"}'
info 2022-09-19 09:40:29Removing device '0x0c4314fffe23020c' (block: false, force: true)
info 2022-09-19 09:40:29MQTT publish: topic 'zigbee2mqtt/0x0c4314fffe23020c', payload ''
info 2022-09-19 09:40:29Successfully removed device '0x0c4314fffe23020c' (block: false, force: true)
info 2022-09-19 09:40:29MQTT publish: topic 'zigbee2mqtt/bridge/response/device/remove', payload '{"data":{"block":false,"force":true,"id":"0x0c4314fffe23020c"},"status":"ok","transaction":"fxiei-2"}'
debug 2022-09-19 09:40:34Received MQTT message on 'zigbee2mqtt/bridge/request/device/remove' with data '{"block":false,"force":true,"id":"0x0c4314fffe709b54","transaction":"fxiei-3"}'
info 2022-09-19 09:40:34Removing device '0x0c4314fffe709b54' (block: false, force: true)
info 2022-09-19 09:40:34MQTT publish: topic 'zigbee2mqtt/0x0c4314fffe709b54', payload ''
info 2022-09-19 09:40:34Successfully removed device '0x0c4314fffe709b54' (block: false, force: true)
info 2022-09-19 09:40:34MQTT publish: topic 'zigbee2mqtt/bridge/response/device/remove', payload '{"data":{"block":false,"force":true,"id":"0x0c4314fffe709b54"},"status":"ok","transaction":"fxiei-3"}'
info 2022-09-19 09:41:15Device '0x0c4314fffe23020c' joined
info 2022-09-19 09:41:15MQTT publish: topic 'zigbee2mqtt/bridge/event', payload '{"data":{"friendly_name":"0x0c4314fffe23020c","ieee_address":"0x0c4314fffe23020c"},"type":"device_joined"}'
info 2022-09-19 09:41:15Starting interview of '0x0c4314fffe23020c'
info 2022-09-19 09:41:15MQTT publish: topic 'zigbee2mqtt/bridge/event', payload '{"data":{"friendly_name":"0x0c4314fffe23020c","ieee_address":"0x0c4314fffe23020c","status":"started"},"type":"device_interview"}'
error 2022-09-19 09:42:15Failed to interview '0x0c4314fffe23020c', device has not successfully been paired
info 2022-09-19 09:42:15MQTT publish: topic 'zigbee2mqtt/bridge/event', payload '{"data":{"friendly_name":"0x0c4314fffe23020c","ieee_address":"0x0c4314fffe23020c","status":"failed"},"type":"device_interview"}'
info 2022-09-19 09:42:31Starting interview of '0x0c4314fffe23020c'
info 2022-09-19 09:42:31MQTT publish: topic 'zigbee2mqtt/bridge/event', payload '{"data":{"friendly_name":"0x0c4314fffe23020c","ieee_address":"0x0c4314fffe23020c","status":"started"},"type":"device_interview"}'
error 2022-09-19 09:43:31Failed to interview '0x0c4314fffe23020c', device has not successfully been paired
info 2022-09-19 09:43:31MQTT publish: topic 'zigbee2mqtt/bridge/event', payload '{"data":{"friendly_name":"0x0c4314fffe23020c","ieee_address":"0x0c4314fffe23020c","status":"failed"},"type":"device_interview"}'
debug 2022-09-19 09:45:13Saving state to file /opt/zigbee2mqtt/data/state.json

Okay, new adapter received today and the buttons are connecting correctly in z2m! Now I’m trying to create the Things and Items necessary to make them work in OH3 and I’m struggling to understand the example provided here. Looking at the IKEA items at the bottom of the page, it seems fairly straightforward but I don’t understand where the SZMS and SZ in Thing topic SZMS "SZMS" @ "SZ" come from. Where can I find this in my z2m instance to make sure I’m using the right labels?