I'm stuck with IKEA Tradfri

I've made a simple Node Flow with 5 IKEA light bulbs. Everything worked for a while but at some point the response of the bulbs became unacceptable. I updated my RPI and updated Zigbee2MQTT to the latest version. Now non of the Bulbs seam to respond anymore. Any suggestion where to look. Below is the log of Zigbee2MQTT:

Aug 19 02:33:51 alain-rpi systemd[1]: zigbee2mqtt.service: Service RestartSec=100ms expired, scheduling restart.
Aug 19 02:33:51 alain-rpi systemd[1]: zigbee2mqtt.service: Scheduled restart job, restart counter is at 69.
Aug 19 02:33:51 alain-rpi systemd[1]: Stopped zigbee2mqtt.
Aug 19 02:33:51 alain-rpi systemd[1]: Started zigbee2mqtt.
Aug 19 02:33:53 alain-rpi npm[3144]: > zigbee2mqtt@1.21.0 start /opt/zigbee2mqtt
Aug 19 02:33:53 alain-rpi npm[3144]: > node index.js
Aug 19 02:33:55 alain-rpi npm[3144]: (node:3156) UnhandledPromiseRejectionWarning: YAMLException: duplicated mapping key (16:2)
Aug 19 02:33:55 alain-rpi npm[3144]:  13 |  '0x0c4314fffe0ba5ac':
Aug 19 02:33:55 alain-rpi npm[3144]:  14 |  friendly_name: LAMP01
Aug 19 02:33:55 alain-rpi npm[3144]:  15 |  '0xb4e3f9fffef340f1':
Aug 19 02:33:55 alain-rpi npm[3144]:  16 |  friendly_name: LAMP02
Aug 19 02:33:55 alain-rpi npm[3144]: -------^
Aug 19 02:33:55 alain-rpi npm[3144]:  17 |  '0xb4e3f9fffed966f4':
Aug 19 02:33:55 alain-rpi npm[3144]:  18 |  friendly_name: LAMP03
Aug 19 02:33:55 alain-rpi npm[3144]:     at generateError (/opt/zigbee2mqtt/node_modules/js-yaml/lib/loader.js:183:10)
Aug 19 02:33:55 alain-rpi npm[3144]:     at throwError (/opt/zigbee2mqtt/node_modules/js-yaml/lib/loader.js:187:9)
Aug 19 02:33:55 alain-rpi npm[3144]:     at storeMappingPair (/opt/zigbee2mqtt/node_modules/js-yaml/lib/loader.js:358:7)
Aug 19 02:33:55 alain-rpi npm[3144]:     at readBlockMapping (/opt/zigbee2mqtt/node_modules/js-yaml/lib/loader.js:1173:9)
Aug 19 02:33:55 alain-rpi npm[3144]:     at composeNode (/opt/zigbee2mqtt/node_modules/js-yaml/lib/loader.js:1441:12)
Aug 19 02:33:55 alain-rpi npm[3144]:     at readBlockMapping (/opt/zigbee2mqtt/node_modules/js-yaml/lib/loader.js:1164:11)
Aug 19 02:33:55 alain-rpi npm[3144]:     at composeNode (/opt/zigbee2mqtt/node_modules/js-yaml/lib/loader.js:1441:12)
Aug 19 02:33:55 alain-rpi npm[3144]:     at readDocument (/opt/zigbee2mqtt/node_modules/js-yaml/lib/loader.js:1625:3)
Aug 19 02:33:55 alain-rpi npm[3144]:     at loadDocuments (/opt/zigbee2mqtt/node_modules/js-yaml/lib/loader.js:1688:5)
Aug 19 02:33:55 alain-rpi npm[3144]:     at Object.load (/opt/zigbee2mqtt/node_modules/js-yaml/lib/loader.js:1714:19)
Aug 19 02:33:55 alain-rpi npm[3144]: (Use `node --trace-warnings ...` to show where the warning was created)
Aug 19 02:33:55 alain-rpi npm[3144]: (node:3156) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
Aug 19 02:33:55 alain-rpi npm[3144]: (node:3156) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Not strictly a node-red question but I believe you have set the same friendly name on 2 devices.

YAMLException: duplicated mapping key

This is causing the zigbee2mqtt application to crash.

You will need to edit the yaml settings file & change one of the duplicate names.

I've used LAMP_01 to LAMP_06 as friendly names in my Yaml. I first thought the underscore was an issue so I tested it with Lamp01, Lamp02 etc... but this didn't help.

permit_join: false
mqtt:
base_topic: zigbee2mqtt
server: 'mqtt://localhost:1883'
serial:
port: /dev/ttyACM0

frontend:
 port: 8080
 host: localhost

devices:
 '0x0c4314fffe0ba5ac':
 friendly_name: LAMP_01
 '0xb4e3f9fffef340f1':
 friendly_name: LAMP_02
 '0xb4e3f9fffed966f4':
 friendly_name: LAMP_03
 '0xb4e3f9fffef188bd':
 friendly_name: LAMP_04
 '0xb4e3f9fffeecea79':
 friendly_name: LAMP_05
 '0x0017880108193b7f':
 friendly_name: LAMP_06

Did you craft that YAML manually (in a text editor)?

It is invalid
image

Your spacing is causing yaml to be invalid.

try this...

permit_join: false
mqtt:
base_topic: zigbee2mqtt
server: 'mqtt://localhost:1883'
serial:
port: /dev/ttyACM0

frontend:
  port: 8080
  host: localhost

devices:
  '0x0c4314fffe0ba5ac':
    friendly_name: LAMP_01
  '0xb4e3f9fffef340f1':
    friendly_name: LAMP_02
  '0xb4e3f9fffed966f4':
    friendly_name: LAMP_03
  '0xb4e3f9fffef188bd':
    friendly_name: LAMP_04
  '0xb4e3f9fffeecea79':
    friendly_name: LAMP_05
  '0x0017880108193b7f':
    friendly_name: LAMP_06

I actually use a function node to read and write the Yaml file.

OK, so did correct spacing fix your issue?

I used the next command to get to the Yaml file
nano /opt/zigbee2mqtt/data/configuration.yaml

And pasted your code there. Now I'm getting this:

pi@alain-rpi:~ $ sudo journalctl -u zigbee2mqtt.service -f
-- Logs begin at Thu 2021-08-19 09:14:31 CEST. --
Aug 19 09:17:16 alain-rpi npm[1914]: npm ERR! A complete log of this run can be                                                                                                                                found in:
Aug 19 09:17:16 alain-rpi npm[1914]: npm ERR!     /home/pi/.npm/_logs/2021-08-19                                                                                                                               T07_17_16_715Z-debug.log
Aug 19 09:17:16 alain-rpi systemd[1]: zigbee2mqtt.service: Main process exited,                                                                                                                                code=exited, status=1/FAILURE
Aug 19 09:17:16 alain-rpi systemd[1]: zigbee2mqtt.service: Failed with result 'e                                                                                                                               xit-code'.
Aug 19 09:17:16 alain-rpi systemd[1]: zigbee2mqtt.service: Service RestartSec=10                                                                                                                               0ms expired, scheduling restart.
Aug 19 09:17:16 alain-rpi systemd[1]: zigbee2mqtt.service: Scheduled restart job                                                                                                                               , restart counter is at 25.
Aug 19 09:17:16 alain-rpi systemd[1]: Stopped zigbee2mqtt.
Aug 19 09:17:16 alain-rpi systemd[1]: Started zigbee2mqtt.
Aug 19 09:17:18 alain-rpi npm[1957]: > zigbee2mqtt@1.21.0 start /opt/zigbee2mqtt
Aug 19 09:17:18 alain-rpi npm[1957]: > node index.js
Aug 19 09:17:21 alain-rpi npm[1957]: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!                                                                                                                               !!!!!!
Aug 19 09:17:21 alain-rpi npm[1957]:             READ THIS CAREFULLY
Aug 19 09:17:21 alain-rpi npm[1957]: Refusing to start because configuration is                                                                                                                                not valid, found the following errors:
Aug 19 09:17:21 alain-rpi npm[1957]: - mqtt must be object
Aug 19 09:17:21 alain-rpi npm[1957]: - serial must be object
Aug 19 09:17:21 alain-rpi npm[1957]: If you don't know how to solve this, read h                                                                                                                               ttps://www.zigbee2mqtt.io/information/configuration.html
Aug 19 09:17:21 alain-rpi npm[1957]: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!                                                                                                                               !!!!!!
Aug 19 09:17:21 alain-rpi npm[1957]: npm ERR! code ELIFECYCLE
Aug 19 09:17:21 alain-rpi npm[1957]: npm ERR! errno 1
Aug 19 09:17:21 alain-rpi npm[1957]: npm ERR! zigbee2mqtt@1.21.0 start: `node in                                                                                                                               dex.js`
Aug 19 09:17:21 alain-rpi npm[1957]: npm ERR! Exit status 1
Aug 19 09:17:21 alain-rpi npm[1957]: npm ERR!
Aug 19 09:17:21 alain-rpi npm[1957]: npm ERR! Failed at the zigbee2mqtt@1.21.0 s                                                                                                                               tart script.
Aug 19 09:17:21 alain-rpi npm[1957]: npm ERR! This is probably not a problem wit                                                                                                                               h npm. There is likely additional logging output above.
Aug 19 09:17:21 alain-rpi npm[1957]: npm ERR! A complete log of this run can be                                                                                                                                found in:
Aug 19 09:17:21 alain-rpi npm[1957]: npm ERR!     /home/pi/.npm/_logs/2021-08-19                                                                                                                               T07_17_21_204Z-debug.log
Aug 19 09:17:21 alain-rpi systemd[1]: zigbee2mqtt.service: Main process exited,                                                                                                                                code=exited, status=1/FAILURE
Aug 19 09:17:21 alain-rpi systemd[1]: zigbee2mqtt.service: Failed with result 'e                                                                                                                               xit-code'.
Aug 19 09:17:21 alain-rpi systemd[1]: zigbee2mqtt.service: Service RestartSec=10                                                                                                                               0ms expired, scheduling restart.
Aug 19 09:17:21 alain-rpi systemd[1]: zigbee2mqtt.service: Scheduled restart job                                                                                                                               , restart counter is at 26.
Aug 19 09:17:21 alain-rpi systemd[1]: Stopped zigbee2mqtt.
Aug 19 09:17:21 alain-rpi systemd[1]: Started zigbee2mqtt.
Aug 19 09:17:23 alain-rpi npm[1982]: > zigbee2mqtt@1.21.0 start /opt/zigbee2mqtt
Aug 19 09:17:23 alain-rpi npm[1982]: > node index.js
Aug 19 09:17:25 alain-rpi npm[1982]: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Aug 19 09:17:25 alain-rpi npm[1982]:             READ THIS CAREFULLY
Aug 19 09:17:25 alain-rpi npm[1982]: Refusing to start because configuration is not valid, found the following errors:
Aug 19 09:17:25 alain-rpi npm[1982]: - mqtt must be object
Aug 19 09:17:25 alain-rpi npm[1982]: - serial must be object
Aug 19 09:17:25 alain-rpi npm[1982]: If you don't know how to solve this, read https://www.zigbee2mqtt.io/information/configuration.html
Aug 19 09:17:25 alain-rpi npm[1982]: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Aug 19 09:17:25 alain-rpi npm[1982]: npm ERR! code ELIFECYCLE
Aug 19 09:17:25 alain-rpi npm[1982]: npm ERR! errno 1
Aug 19 09:17:25 alain-rpi npm[1982]: npm ERR! zigbee2mqtt@1.21.0 start: `node index.js`
Aug 19 09:17:25 alain-rpi npm[1982]: npm ERR! Exit status 1
Aug 19 09:17:25 alain-rpi npm[1982]: npm ERR!
Aug 19 09:17:25 alain-rpi npm[1982]: npm ERR! Failed at the zigbee2mqtt@1.21.0 start script.
Aug 19 09:17:25 alain-rpi npm[1982]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Aug 19 09:17:25 alain-rpi npm[1982]: npm ERR! A complete log of this run can be found in:
Aug 19 09:17:25 alain-rpi npm[1982]: npm ERR!     /home/pi/.npm/_logs/2021-08-19T07_17_25_677Z-debug.log
Aug 19 09:17:25 alain-rpi systemd[1]: zigbee2mqtt.service: Main process exited, code=exited, status=1/FAILURE
Aug 19 09:17:25 alain-rpi systemd[1]: zigbee2mqtt.service: Failed with result 'exit-code'.
Aug 19 09:17:25 alain-rpi systemd[1]: zigbee2mqtt.service: Service RestartSec=100ms expired, scheduling restart.
Aug 19 09:17:25 alain-rpi systemd[1]: zigbee2mqtt.service: Scheduled restart job, restart counter is at 27.
Aug 19 09:17:25 alain-rpi systemd[1]: Stopped zigbee2mqtt.
Aug 19 09:17:25 alain-rpi systemd[1]: Started zigbee2mqtt.
Aug 19 09:17:27 alain-rpi npm[2012]: > zigbee2mqtt@1.21.0 start /opt/zigbee2mqtt
Aug 19 09:17:27 alain-rpi npm[2012]: > node index.js
Aug 19 09:17:30 alain-rpi npm[2012]: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

I assumed you had a working config and just fixed up the badly formatted YAML to make it work

That suggests your YAML should be...

permit_join: false
mqtt:
  base_topic: zigbee2mqtt
  server: 'mqtt://localhost:1883'
serial:
  port: /dev/ttyACM0

frontend:
  port: 8080
  host: localhost

devices:
  '0x0c4314fffe0ba5ac':
    friendly_name: LAMP_01
  '0xb4e3f9fffef340f1':
    friendly_name: LAMP_02
  '0xb4e3f9fffed966f4':
    friendly_name: LAMP_03
  '0xb4e3f9fffef188bd':
    friendly_name: LAMP_04
  '0xb4e3f9fffeecea79':
    friendly_name: LAMP_05
  '0x0017880108193b7f':
    friendly_name: LAMP_06

NOTE: you state mqtt.server to be 'mqtt://localhost:1883' - is the MQTT broker on the same machine as zigbee2mqtt? If not, you will need to change to the IP of the broker.

Yes it's just a RPI that has the MQTT broker installed and runs Node Red.

I removed the opt/zigbee2mqtt folder and re-installed everything again. This seems to help in a way that the Zigbee2Mqtt service keeps running. I copy pasted the correct Yaml file. And I'm now getting an Entity error that the friendly name is unknown. Do I need to repair all the lights? Since I have them in the Yaml file? Below is the log.

Aug 19 10:15:07 alain-rpi npm[512]: Zigbee2MQTT:error 2021-08-19 10:15:07: Entity 'LAMP_01' is unknown
Aug 19 10:15:07 alain-rpi npm[512]: Zigbee2MQTT:info  2021-08-19 10:15:07: MQTT publish: topic 'zigbee2mqtt/bridge/log', payload '{"message":{"friendly_name":"LAMP_02"},"typ        e":"entity_not_found"}'
Aug 19 10:15:07 alain-rpi npm[512]: Zigbee2MQTT:error 2021-08-19 10:15:07: Entity 'LAMP_02' is unknown
Aug 19 10:15:07 alain-rpi npm[512]: Zigbee2MQTT:info  2021-08-19 10:15:07: MQTT publish: topic 'zigbee2mqtt/bridge/log', payload '{"message":{"friendly_name":"LAMP_03"},"typ        e":"entity_not_found"}'
Aug 19 10:15:07 alain-rpi npm[512]: Zigbee2MQTT:error 2021-08-19 10:15:07: Entity 'LAMP_03' is unknown
Aug 19 10:15:07 alain-rpi npm[512]: Zigbee2MQTT:info  2021-08-19 10:15:07: MQTT publish: topic 'zigbee2mqtt/bridge/log', payload '{"message":{"friendly_name":"LAMP_04"},"typ        e":"entity_not_found"}'
Aug 19 10:15:07 alain-rpi npm[512]: Zigbee2MQTT:error 2021-08-19 10:15:07: Entity 'LAMP_04' is unknown
Aug 19 10:15:07 alain-rpi npm[512]: Zigbee2MQTT:info  2021-08-19 10:15:07: MQTT publish: topic 'zigbee2mqtt/bridge/log', payload '{"message":{"friendly_name":"LAMP_05"},"typ        e":"entity_not_found"}'
Aug 19 10:15:07 alain-rpi npm[512]: Zigbee2MQTT:error 2021-08-19 10:15:07: Entity 'LAMP_05' is unknown
Aug 19 10:15:07 alain-rpi npm[512]: Zigbee2MQTT:info  2021-08-19 10:15:07: MQTT publish: topic 'zigbee2mqtt/bridge/log', payload '{"message":{"friendly_name":"LAMP_06"},"typ        e":"entity_not_found"}'
Aug 19 10:15:07 alain-rpi npm[512]: Zigbee2MQTT:error 2021-08-19 10:15:07: Entity 'LAMP_06' is unknown
Aug 19 10:15:07 alain-rpi npm[512]: Zigbee2MQTT:info  2021-08-19 10:15:07: MQTT publish: topic 'zigbee2mqtt/bridge/log', payload '{"message":{"friendly_name":"LAMP_07"},"typ        e":"entity_not_found"}'
Aug 19 10:15:07 alain-rpi npm[512]: Zigbee2MQTT:error 2021-08-19 10:15:07: Entity 'LAMP_07' is unknown
Aug 19 10:15:07 alain-rpi npm[512]: Zigbee2MQTT:info  2021-08-19 10:15:07: MQTT publish: topic 'zigbee2mqtt/bridge/log', payload '{"message":{"friendly_name":"LAMP_08"},"typ        e":"entity_not_found"}'
Aug 19 10:15:07 alain-rpi npm[512]: Zigbee2MQTT:error 2021-08-19 10:15:07: Entity 'LAMP_08' is unknown
Aug 19 10:15:07 alain-rpi npm[512]: Zigbee2MQTT:info  2021-08-19 10:15:07: MQTT publish: topic 'zigbee2mqtt/bridge/log', payload '{"message":{"friendly_name":"LAMP_09"},"typ        e":"entity_not_found"}'
Aug 19 10:15:07 alain-rpi npm[512]: Zigbee2MQTT:error 2021-08-19 10:15:07: Entity 'LAMP_09' is unknown

OK after all that and resetting one lamp it seems to work again.. I still don't understand I need to reset all the lights as it seems. Is this not fixed in the Yaml file?

One thing I've noticed now is that the Zigbee2MQTT Dashboard doesn't work anymore :-/

Try resetting the MQTT server and redeploy - in the MQTT nodes of the admin panel flow

You mean with a command node and the commands below to stop and start the Zigbee2MQTT service?

# Stopping Zigbee2MQTT
sudo systemctl stop zigbee2mqtt

# Starting Zigbee2MQTT
sudo systemctl start zigbee2mqtt

No, sorry I was thinking that you were referring to the Node-red flow Z2M Admin which is a Node-red version of the zigbee2MQTT frontend.

If you are talking about the zigbee2MQTT Frontend then make sure you have the relevant entries in the YAML file (with correct spacing) and then restarting zigbee2MQTT may help

frontend:
  # Optional, default 8080
  port: 8080
  # Optional, default 0.0.0.0
  host: localhost

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.