danielwelch / hassio-zigbee2mqtt

Hass.io add-on for zigbee2mqtt
Apache License 2.0
566 stars 189 forks source link

502 gateway after enabling Last Seen option #511

Closed SPEC1AL1ST closed 3 years ago

SPEC1AL1ST commented 3 years ago

zigbee2mqtt add-on version (if edge, please report commit hash): 1.17.0.1 Operating environment (HassOS, Virtual Machine, Device/platform running Home Assistant):

Supervisor Version 2020.12.7 Newest Version 2020.12.7 Channel stable Operating System Raspbian GNU/Linux 10 (buster) Docker version 20.10.2

Description of problem: When i enable ISO8601_local "Last seen" in settings - after few minutes i recieve 502 gateway problem. Also Last seen setting i see as disable. Dont work. I think you forgot to add the last_seen option to the default configuration file. Its work after i add last_seen: ISO_8601_local to config.

Your entire configuration from the frontend (with sensitive fields redacted):

data_path: /share/zigbee2mqtt
external_converters: []
devices: devices.yaml
groups: groups.yaml
homeassistant: true
permit_join: false
mqtt:
  base_topic: zigbee2mqtt
  server: 'mqtt://core-mosquitto'
  user: user
  password: pass
serial:
  port: /dev/serial/by-id/usb-Texas_Instruments_CC2538_USB_CDC-if00
advanced:
  log_level: info
  pan_id: 6754
  channel: 11
  network_key:
    - 1
    - 3
    - 5
    - 7
    - 9
    - 11
    - 13
    - 15
    - 0
    - 2
    - 4
    - 6
    - 8
    - 10
    - 12
    - 13
  availability_blocklist: []
  availability_passlist: []
device_options: {}
blocklist: []
passlist: []
queue: {}
frontend:
  port: 8099
experimental:
  new_api: true
socat:
  enabled: false
  master: 'pty,raw,echo=0,link=/dev/ttyZ2M,mode=777'
  slave: 'tcp-listen:8485,keepalive,nodelay,reuseaddr,keepidle=1,keepintvl=1,keepcnt=5'
  restartdelay: 1
  initialdelay: 1
  options: '-d -d'
  log: false

Your logs from Home Assistant

2021-01-06T11:00:22: PM2 log: App [npm:0] online 2021-01-06T11:00:22: PM2 log: 0 application online, retry = 3

zigbee2mqtt@1.17.0 start /zigbee2mqtt-1.17.0 node index.js !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! READ THIS CAREFULLY Refusing to start because configuration is not valid, found the following errors:

  • advanced.last_seen should be string
  • advanced.last_seen should be equal to one of the allowed values If you don't know how to solve this, read https://www.zigbee2mqtt.io/information/configuration.html !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! zigbee2mqtt@1.17.0 start: node index.js npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the zigbee2mqtt@1.17.0 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! /root/.npm/_logs/2021-01-06T09_00_27_895Z-debug.log 2021-01-06T11:00:29: PM2 log: App [npm:0] exited with code [1] via signal [SIGINT] 2021-01-06T11:00:29: PM2 log: App [npm:0] starting in -fork mode- 2021-01-06T11:00:29: PM2 log: App [npm:0] online zigbee2mqtt@1.17.0 start /zigbee2mqtt-1.17.0 node index.js !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! READ THIS CAREFULLY Refusing to start because configuration is not valid, found the following errors:
  • advanced.last_seen should be string
  • advanced.last_seen should be equal to one of the allowed values If you don't know how to solve this, read https://www.zigbee2mqtt.io/information/configuration.html !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! zigbee2mqtt@1.17.0 start: node index.js npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the zigbee2mqtt@1.17.0 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! /root/.npm/_logs/2021-01-06T09_00_33_782Z-debug.log 2021-01-06T11:00:36: PM2 log: App [npm:0] exited with code [1] via signal [SIGINT] 2021-01-06T11:00:36: PM2 log: App [npm:0] starting in -fork mode- 2021-01-06T11:00:36: PM2 log: App [npm:0] online zigbee2mqtt@1.17.0 start /zigbee2mqtt-1.17.0 node index.js !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! READ THIS CAREFULLY Refusing to start because configuration is not valid, found the following errors:
  • advanced.last_seen should be string
  • advanced.last_seen should be equal to one of the allowed values If you don't know how to solve this, read https://www.zigbee2mqtt.io/information/configuration.html !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! zigbee2mqtt@1.17.0 start: node index.js npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the zigbee2mqtt@1.17.0 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! /root/.npm/_logs/2021-01-06T09_00_39_063Z-debug.log 2021-01-06T11:00:40: PM2 log: App [npm:0] exited with code [1] via signal [SIGINT] 2021-01-06T11:00:40: PM2 log: App [npm:0] starting in -fork mode- 2021-01-06T11:00:40: PM2 log: App [npm:0] online zigbee2mqtt@1.17.0 start /zigbee2mqtt-1.17.0 node index.js !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! READ THIS CAREFULLY Refusing to start because configuration is not valid, found the following errors:
  • advanced.last_seen should be string
  • advanced.last_seen should be equal to one of the allowed values If you don't know how to solve this, read https://www.zigbee2mqtt.io/information/configuration.html !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! zigbee2mqtt@1.17.0 start: node index.js npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the zigbee2mqtt@1.17.0 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! /root/.npm/_logs/2021-01-06T09_00_45_216Z-debug.log 2021-01-06T11:00:47: PM2 log: App [npm:0] exited with code [1] via signal [SIGINT] 2021-01-06T11:00:47: PM2 log: App [npm:0] starting in -fork mode- 2021-01-06T11:00:47: PM2 log: App [npm:0] online
RuBiCK commented 3 years ago

Exactly same issue here with the same versions

SPEC1AL1ST commented 3 years ago

Exactly same issue here with the same versions

Maybe needing urgent udpate?

SPEC1AL1ST commented 3 years ago

And thorough verification in the future

Metzlmane commented 3 years ago

I have the same issue Tried to add "last_seen: ISO_8601_local" under advanced, but it still fails to start. I also tried 'disable'. What did you change to get it working again? @SPEC1AL1ST

vampywiz17 commented 3 years ago

Same problem, please fix it.

SPEC1AL1ST commented 3 years ago

I have the same issue Tried to add "last_seen: ISO_8601_local" under advanced, but it still fails to start. I also tried 'disable'. What did you change to get it working again? @SPEC1AL1ST

My config from frontend:

data_path: /share/zigbee2mqtt
external_converters: []
devices: devices.yaml
groups: groups.yaml
homeassistant: true
permit_join: false
mqtt:
  base_topic: zigbee2mqtt
  server: 'mqtt://core-mosquitto'
  user: user
  password: pass
serial:
  port: /dev/serial/by-id/usb-Texas_Instruments_CC2538_USB_CDC-if00
advanced:
  log_level: info
  pan_id: 6754
  channel: 11
  network_key:
    - 1
    - 3
    - 5
    - 7
    - 9
    - 11
    - 13
    - 15
    - 0
    - 2
    - 4
    - 6
    - 8
    - 10
    - 12
    - 13
  availability_blocklist: []
  availability_passlist: []
  last_seen: ISO_8601_local
device_options: {}
blocklist: []
passlist: []
queue: {}
frontend:
  port: 8099
experimental:
  new_api: true
socat:
  enabled: false
  master: 'pty,raw,echo=0,link=/dev/ttyZ2M,mode=777'
  slave: 'tcp-listen:8485,keepalive,nodelay,reuseaddr,keepidle=1,keepintvl=1,keepcnt=5'
  restartdelay: 1
  initialdelay: 1
  options: '-d -d'
  log: false
jeroenvansch commented 3 years ago

Tried to add "last_seen: ISO_8601_local" under advanced, but it still fails to start. I also tried 'disable'. What did you change to get it working again? @SPEC1AL1ST

Same problem here. my fix: I made sure i didn't have a mention of last_seen in the config file. Then save it and restart Z2M. it looks like a formatting error when the YAML gets translated to JSON. But I didn't save the corrupted config file unfortunately

billvinson commented 3 years ago

Using 1.17.0.1, if I add last_seen: ISO_8601_local the configuration.yaml, it seems to get stripped out. If I set it via the GUI, I see the log entry: info 2021-01-18 11:45:18: MQTT publish: topic 'zigbee2mqtt/bridge/response/config/last_seen', payload '{"data":{"value":"ISO_8601_local"},"status":"ok","transaction":"0zo5k-1"}' and then a response showing the new value as "last_seen":{"transaction":"0zo5k-1","value":"ISO_8601_local"}. That full value is also placed in the configuration.yaml and nothing else will happen at that point. No Zigbee communication at all. It seems to just fail to function. My understanding is that last_seen is supposed to be a simple string, but that doesn't seem to work and what the GUI is doing also doesn't appear to work. If I delete last_seen from the configuration.yaml and restart, functionality resumes, but without last_seen which I would really like to get back.

brendanmullan commented 3 years ago

Experiencing the same issue, anyone able to enable last seen and not have this issue?

billvinson commented 3 years ago

Experiencing the same issue, anyone able to enable last seen and not have this issue?

I moved my HA installation to a new system but kept all the same versions. I then edited the configuration from the supervisor web interface for the zigbee2mqtt addon. I put "last_seen": "ISO_8601_local" under the advanced section. I then restarted the addon. It took several minutes with what appeared to be no logging in the UI, but then my device updates started showing up with last_seen. I still think enabling via the UI may be broken, but I either had a typo or didn't wait long enough after editing the config manually/restarting last time. Not sure this will help anyone else, but hopefully...

brendanmullan commented 3 years ago

Experiencing the same issue, anyone able to enable last seen and not have this issue?

I moved my HA installation to a new system but kept all the same versions. I then edited the configuration from the supervisor web interface for the zigbee2mqtt addon. I put "last_seen": "ISO_8601_local" under the advanced section. I then restarted the addon. It took several minutes with what appeared to be no logging in the UI, but then my device updates started showing up with last_seen. I still think enabling via the UI may be broken, but I either had a typo or didn't wait long enough after editing the config manually/restarting last time. Not sure this will help anyone else, but hopefully...

This fix worked for me, thanks!

jeroenvansch commented 3 years ago

It seems to be fixed in the latest version(1.17.1) changelog:_#5545 Fix setting lastseen from frontend not working