danielwelch / hassio-zigbee2mqtt

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

Electrolama zig-a-zig-ah on HASS.IO Bad Gateway #459

Closed harvybob closed 3 years ago

harvybob commented 4 years ago

zigbee2mqtt add-on version (if edge, please report commit hash): 1.16.0

Operating environment (HassOS, Virtual Machine, Device/platform running Home Assistant):

Description of problem: When i try to go to the zigbee2mqtt web page i get 502 bad gateway error. I can add the zig-a-zig-ah as a Zigbee Home Automation and get the following path: /dev/ttyUSB0 - USB Serial, s/n: n/a

I've tried to follow the guide on the website, but am stuck on the config side. What core information do I need to add into configuration.yaml to enable the broker to work?

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

# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:

# Text to speech
tts:
  - platform: google_translate

group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
binary_sensor: !include SelfMon.yaml

# SelfMon
sensor:
- platform: template
  sensors:
    alarm_status:
      value_template: >
        {%- if is_state("binary_sensor.a_alarm_downstairs_contacts", "off") and is_state("binary_sensor.a_alarm_downstairs_pir_s", "off") and is_state("binary_sensor.a_alarm_upstairs_pir_s", "off")  %}
          Disarmed
        {%- elif is_state("binary_sensor.a_alarm_downstairs_contacts", "on") %}
          Part Set
        {%- elif is_state("binary_sensor.a_alarm_downstairs_pir_s", "on") %}
          Part Set
        {%- elif is_state("binary_sensor.a_alarm_upstairs_pir_s", "on") %}
          Part Set
        {%- elif is_state("binary_sensor.a_alarm_downstairs_contacts", "on") and is_state("binary_sensor.a_alarm_downstairs_pir_s", "on") and is_state("binary_sensor.a_alarm_upstairs_pir_s", "off")  %}
          Armed Away
        {%- else -%}
          Unknown Status
        {%- endif %}
      icon_template: >
        {%- if is_state("binary_sensor.a_alarm_downstairs_contacts", "off") and is_state("binary_sensor.a_alarm_downstairs_pir_s", "off") and is_state("binary_sensor.a_alarm_upstairs_pir_s", "off")  %}
          mdi:home-lock-open
        {%- elif is_state("binary_sensor.a_alarm_downstairs_contacts", "on") %}
          mdi:home-lock
        {%- elif is_state("binary_sensor.a_alarm_downstairs_pir_s", "on") %}
          mdi:home-lock
        {%- elif is_state("binary_sensor.a_alarm_upstairs_pir_s", "on") %}
          mdi:home-lock
        {%- else -%}
          mdi:lock-question
        {%- endif %}

Your logs from Home Assistant

log file is blank! (not sure why - another issue i am trying to resolve!)

ciotlosm commented 4 years ago

You need to use the configuration in your add-on: Supervisor > Dashboard > Zigbee2mqtt > Configuration

What you have there linked is your Home Assistant Core configuration which is not what you want to use to configure zigbee2mqtt

harvybob commented 4 years ago

Ok - so in my configuration.yaml i put in this:

homeassistant: false

# Required: allow new devices to join.
# WARNING: Disable this after all devices have been paired! (default: false)
permit_join: true

# Required: MQTT settings
mqtt:
  # Required: MQTT base topic for Zigbee2MQTT MQTT messages
  base_topic: zigbee2mqtt
  # Required: MQTT server URL (use mqtts:// for SSL/TLS connection)
  server: 'mqtt://192.168.1.1:1883'
  user: user
  # Optional: MQTT server authentication password (default: nothing)
  password: pass
  keepalive: 60

serial:
  # Required: location of the adapter (e.g. CC2531).
  # To autodetect the port, set 'port: null'.
  port: /dev/ttyUSB0
  # Optional: disable LED of the adapter if supported (default: false)
  disable_led: false
  # Optional: adapter type, not needed unless you are experiencing problems (default: shown below, options: zstack, deconz)
  adapter: null

advanced:
    # Optional: Logging level, options: debug, info, warn, error (default: info)
  log_level: info
  # Optional: Location of log directory (default: shown below)
  log_directory: data/log/%TIMESTAMP%
  # Optional: Log file name, can also contain timestamp, e.g.: zigbee2mqtt_%TIMESTAMP%.log (default: shown below)
  log_file: zigbee2mqtt_log.txt
  # Optional: Log rotation (default: shown below)
  log_rotation: true
  # Optional: Output location of the log (default: shown below), leave empty to supress logging (log_output: [])
  # possible options: 'console', 'file', 'syslog'
  log_output:
    - file
  baudrate: 115200
  network_key: [1, 3, 5, 7, 9, 11, 13, 15, 0, 2, 4, 6, 8, 10, 12, 13]
  # Optional: Enables report feature (see information -> report for more details) (default: false)
  report: true
  # Optional: Home Assistant discovery topic (default: shown below)
  homeassistant_discovery_topic: 'homeassistant'
  # Optional: Home Assistant status topic (default: shown below)
  homeassistant_status_topic: 'homeassistant/status'
  # Optional: Home Assistant legacy triggers (default: shown below), when enabled:
  # - Zigbee2mqt will send an empty 'action' or 'click' after one has been send
  # - A 'sensor_action' and 'sensor_click' will be discoverd
  homeassistant_legacy_triggers: true
  # Optional: log timestamp format (default: shown below)
  timestamp_format: 'YYYY-MM-DD HH:mm:ss'

and tried to restart and got this:

Log Details (ERROR)
Logger: homeassistant.components.hassio
Source: components/hassio/__init__.py:383
Integration: Hass.io (documentation, issues)
First occurred: 10:06:43 (1 occurrences)
Last logged: 10:06:43

Component error: permit_join - Integration 'permit_join' not found. Component error: advanced - Integration 'advanced' not found. Invalid config for [mqtt]: [base_topic] is an invalid option for [mqtt]. Check: mqtt->mqtt->base_topic. (See /config/configuration.yaml, line 57).
harvybob commented 4 years ago

Does all of that need to be in its own .yaml file and then imported in?

harvybob commented 4 years ago

Configuration

image

I have no option to configure. If i click on the webui i get a 502 error.

ciotlosm commented 4 years ago

You should not use configuration.yaml at all. In your screenshot you should look higher up in the tabs, where you have Documentation & Configuration.

Component error: permit_join - Integration 'permit_join' not found. Component error: advanced - Integration 'advanced' not found. Invalid config for [mqtt]: [base_topic] is an invalid option for [mqtt]. Check: mqtt->mqtt->base_topic. (See /config/configuration.yaml, line 57). This error is here because you are trying to put zigbee2mqtt configuration inside Home Assistant Core configuration. Please remove all entries you added in configuation.yaml or your Home Assistant won't start.

harvybob commented 4 years ago

Great that fixed things! - missed the obvious!

I can see it in my Mosquito!

Now i just need to wait for my first Zigbee device to arrive!

harvybob commented 4 years ago

Getting this error in the log:

ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2020-11-03T11_14_46_558Z-debug.log
2020-11-03T11:14:46: PM2 log: App [npm:0] exited with code [1] via signal [SIGINT]
2020-11-03T11:14:46: PM2 log: App [npm:0] starting in -fork mode-
2020-11-03T11:14:46: PM2 log: App [npm:0] online
> zigbee2mqtt@1.16.0 start /zigbee2mqtt-1.16.0
> node index.js
Zigbee2MQTT:info  2020-11-03 11:14:48: Logging to console and directory: '/share/zigbee2mqtt/log/2020-11-03.11-14-47' filename: log.txt
Zigbee2MQTT:info  2020-11-03 11:14:48: Starting Zigbee2MQTT version 1.16.0 (commit #1.16.0)
Zigbee2MQTT:info  2020-11-03 11:14:48: Starting zigbee-herdsman...
Zigbee2MQTT:error 2020-11-03 11:14:54: Error while starting zigbee-herdsman
Zigbee2MQTT:error 2020-11-03 11:14:54: Failed to start zigbee
Zigbee2MQTT:error 2020-11-03 11:14:54: Exiting...
Zigbee2MQTT:error 2020-11-03 11:14:54: Error: Error while opening serialport 'Error: Error: I/O error, cannot open /dev/ttyUSB0'
    at Znp.<anonymous> (/zigbee2mqtt-1.16.0/node_modules/zigbee-herdsman/dist/adapter/z-stack/znp/znp.js:136:32)
    at Generator.next (<anonymous>)
    at /zigbee2mqtt-1.16.0/node_modules/zigbee-herdsman/dist/adapter/z-stack/znp/znp.js:27:71
    at new Promise (<anonymous>)
    at __awaiter (/zigbee2mqtt-1.16.0/node_modules/zigbee-herdsman/dist/adapter/z-stack/znp/znp.js:23:12)
    at SerialPort.<anonymous> (/zigbee2mqtt-1.16.0/node_modules/zigbee-herdsman/dist/adapter/z-stack/znp/znp.js:134:49)
    at SerialPort._error (/zigbee2mqtt-1.16.0/node_modules/zigbee-herdsman/node_modules/@serialport/stream/lib/index.js:198:14)
    at /zigbee2mqtt-1.16.0/node_modules/zigbee-herdsman/node_modules/@serialport/stream/lib/index.js:242:12
npm

ERR!

code ELIFECYCLE
npm ERR! errno 1
npm

ERR! zigbee2mqtt@1.16.0 start: `node index.js`
npm ERR! Exit status 1
npm ERR! 
npm 
ERR! Failed at the zigbee2mqtt@1.16.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Config file is set with:

data_path: /share/zigbee2mqtt
external_converters: []
devices: devices.yaml
groups: groups.yaml
homeassistant: true
permit_join: false
mqtt:
  base_topic: zigbee2mqtt
  server: 'mqtt://192.168.1.1'
  user: <user>
  password: <pass>
serial:
  port: /dev/ttyUSB0
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
ciotlosm commented 4 years ago

Your device is wrong /dev/ttyUSB0. Please use docs to identify your correct device (maybe used the named serial device).

From docs: To find out which serial ports you have exposed go to Supervisor → System → Host system → ⋮ → Hardware

harvybob commented 4 years ago

image

Even if i go to add via - configuration -> integration -> + -> Zigbee Home Assistant it finds ttyUSB0.

After a couple of restarts, log is showing this:


npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the zigbee2mqtt@1.16.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/2020-11-03T11_49_00_442Z-debug.log
2020-11-03T11:49:01: PM2 log: App [npm:0] exited with code [1] via signal [SIGINT]
2020-11-03T11:49:01: PM2 log: App [npm:0] starting in -fork mode-
2020-11-03T11:49:01: PM2 log: App [npm:0] online
> zigbee2mqtt@1.16.0 start /zigbee2mqtt-1.16.0
> node index.js
Zigbee2MQTT:info  2020-11-03 11:49:02: Logging to console and directory: '/config/log' filename: log.txt
Zigbee2MQTT:info  2020-11-03 11:49:02: Starting Zigbee2MQTT version 1.16.0 (commit #1.16.0)
Zigbee2MQTT:info  2020-11-03 11:49:02: Starting zigbee-herdsman...
Zigbee2MQTT:error 2020-11-03 11:49:09: Error while starting zigbee-herdsman
Zigbee2MQTT:error 2020-11-03 11:49:09: Failed to start zigbee
Zigbee2MQTT:error 2020-11-03 11:49:09: Exiting...
Zigbee2MQTT:error 2020-11-03 11:49:09: Error: Error while opening serialport 'Error: Error: I/O error, cannot open /dev/ttyUSB0'
    at Znp.<anonymous> (/zigbee2mqtt-1.16.0/node_modules/zigbee-herdsman/dist/adapter/z-stack/znp/znp.js:136:32)
    at Generator.next (<anonymous>)
    at /zigbee2mqtt-1.16.0/node_modules/zigbee-herdsman/dist/adapter/z-stack/znp/znp.js:27:71
    at new Promise (<anonymous>)
    at __awaiter (/zigbee2mqtt-1.16.0/node_modules/zigbee-herdsman/dist/adapter/z-stack/znp/znp.js:23:12)
    at SerialPort.<anonymous> (/zigbee2mqtt-1.16.0/node_modules/zigbee-herdsman/dist/adapter/z-stack/znp/znp.js:134:49)
    at SerialPort._error (/zigbee2mqtt-1.16.0/node_modules/zigbee-herdsman/node_modules/@serialport/stream/lib/index.js:198:14)
    at /zigbee2mqtt-1.16.0/node_modules/zigbee-herdsman/node_modules/@serialport/stream/lib/index.js:242:12
npm

ERR!

code ELIFECYCLE
npm
 ERR! errno 1
npm

ERR! zigbee2mqtt@1.16.0 start: `node index.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the zigbee2mqtt@1.16.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/2020-11-03T11_49_09_463Z-debug.log
2020-11-03T11:49:10: PM2 log: App [npm:0] exited with code [1] via signal [SIGINT]
2020-11-03T11:49:10: PM2 log: App [npm:0] starting in -fork mode-
2020-11-03T11:49:10: PM2 log: App [npm:0] online
> zigbee2mqtt@1.16.0 start /zigbee2mqtt-1.16.0
> node index.js
Zigbee2MQTT:info  2020-11-03 11:49:11: Logging to console and directory: '/config/log' filename: log.txt
Zigbee2MQTT:info  2020-11-03 11:49:11: Starting Zigbee2MQTT version 1.16.0 (commit #1.16.0)
Zigbee2MQTT:info  2020-11-03 11:49:11: Starting zigbee-herdsman...
Zigbee2MQTT:error 2020-11-03 11:49:18: Error while starting zigbee-herdsman
Zigbee2MQTT:error 2020-11-03 11:49:18: Failed to start zigbee
Zigbee2MQTT:error 2020-11-03 11:49:18: Exiting...
Zigbee2MQTT:error 2020-11-03 11:49:18: Error: Error while opening serialport 'Error: Error: I/O error, cannot open /dev/ttyUSB0'
    at Znp.<anonymous> (/zigbee2mqtt-1.16.0/node_modules/zigbee-herdsman/dist/adapter/z-stack/znp/znp.js:136:32)
    at Generator.next (<anonymous>)
    at /zigbee2mqtt-1.16.0/node_modules/zigbee-herdsman/dist/adapter/z-stack/znp/znp.js:27:71
    at new Promise (<anonymous>)
    at __awaiter (/zigbee2mqtt-1.16.0/node_modules/zigbee-herdsman/dist/adapter/z-stack/znp/znp.js:23:12)
    at SerialPort.<anonymous> (/zigbee2mqtt-1.16.0/node_modules/zigbee-herdsman/dist/adapter/z-stack/znp/znp.js:134:49)
    at SerialPort._error (/zigbee2mqtt-1.16.0/node_modules/zigbee-herdsman/node_modules/@serialport/stream/lib/index.js:198:14)
    at /zigbee2mqtt-1.16.0/node_modules/zigbee-herdsman/node_modules/@serialport/stream/lib/index.js:242:12
npm

ERR! code ELIFECYCLE
npm ERR! errno 1
npm

ERR!
 zigbee2mqtt@1.16.0 start: `node index.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the zigbee2mqtt@1.16.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/2020-11-03T11_49_18_481Z-debug.log
2020-11-03T11:49:19: PM2 log: App [npm:0] exited with code [1] via signal [SIGINT]
2020-11-03T11:49:19: PM2 log: App [npm:0] starting in -fork mode-
2020-11-03T11:49:19: PM2 log: App [npm:0] online
> zigbee2mqtt@1.16.0 start /zigbee2mqtt-1.16.0
> node index.js
Zigbee2MQTT:info  2020-11-03 11:49:21: Logging to console and directory: '/config/log' filename: log.txt
Zigbee2MQTT:info  2020-11-03 11:49:21: Starting Zigbee2MQTT version 1.16.0 (commit #1.16.0)
Zigbee2MQTT:info  2020-11-03 11:49:21: Starting zigbee-herdsman...
Zigbee2MQTT:info  2020-11-03 11:49:23: zigbee-herdsman started
Zigbee2MQTT:info  2020-11-03 11:49:23: Coordinator firmware version: '{"meta":{"maintrel":1,"majorrel":2,"minorrel":7,"product":1,"revision":20201026,"transportrev":2},"type":"zStack3x0"}'
Zigbee2MQTT:info  2020-11-03 11:49:23: Currently 0 devices are joined:
Zigbee2MQTT:info  2020-11-03 11:49:23: Zigbee: disabling joining new devices.
Zigbee2MQTT:info  2020-11-03 11:49:23: Started frontend on port 8099
Zigbee2MQTT:info  2020-11-03 11:49:23: Connecting to MQTT server at mqtt://192.168.1.1
Zigbee2MQTT:info  2020-11-03 11:49:23: Connected to MQTT server
Zigbee2MQTT:info  2020-11-03 11:49:23: MQTT publish: topic 'zigbee2mqtt/bridge/state', payload 'online'
Zigbee2MQTT:info  2020-11-03 11:49:23: MQTT publish: topic 'zigbee2mqtt/bridge/info', payload '{"commit":"1.16.0","config":{"advanced":{"adapter_concurrent":null,"availability_blacklist":[],"availability_blocklist":[],"availability_passlist":[],"availability_timeout":0,"availability_whitelist":[],"cache_state":true,"cache_state_persistent":true,"cache_state_send_on_startup":true,"channel":11,"elapsed":false,"ext_pan_id":[221,221,221,221,221,221,221,221],"homeassistant_discovery_topic":"homeassistant","homeassistant_legacy_triggers":true,"homeassistant_status_topic":"hass/status","last_seen":"disable","legacy_api":true,"log_directory":"/config/log","log_file":"log.txt","log_level":"info","log_output":["console","file"],"log_rotation":true,"log_syslog":{},"pan_id":6754,"report":false,"soft_reset_timeout":0,"timestamp_format":"YYYY-MM-DD HH:mm:ss"},"ban":[],"blocklist":[],"device_options":{},"devices":{},"experimental":{"new_api":true,"output":"json"},"external_converters":[],"frontend":{"port":8099},"groups":{},"homeassistant":true,"map_options":{"graphviz":{"colors":{"fill":{"coordinator":"#e04e5d","enddevice":"#fff8ce","router":"#4ea3e0"},"font":{"coordinator":"#ffffff","enddevice":"#000000","router":"#ffffff"},"line":{"active":"#009900","inactive":"#994444"}}}},"mqtt":{"base_topic":"zigbee2mqtt","include_device_information":false,"server":"mqtt://192.168.1.1","user":"<user>"},"passlist":[],"permit_join":false,"queue":{},"serial":{"disable_led":false,"port":"/dev/ttyUSB0"},"whitelist":[]},"coordinator":{"meta":{"maintrel":1,"majorrel":2,"minorrel":7,"product":1,"revision":20201026,"transportrev":2},"type":"zStack3x0"},"log_level":"info","network":{"channel":11,"extended_pan_id":"0x32229297fc3ded6d","pan_id":6754},"permit_join":false,"version":"1.16.0"}'
Zigbee2MQTT:info  2020-11-03 11:49:23: MQTT publish: topic 'zigbee2mqtt/bridge/devices', payload '[{"definition":null,"endpoints":{"1":{"bindings":[],"clusters":{"input":[],"output":[]}},"11":{"bindings":[],"clusters":{"input":["ssIasAce"],"output":["ssIasZone","ssIasWd"]}},"110":{"bindings":[],"clusters":{"input":[],"output":[]}},"12":{"bindings":[],"clusters":{"input":[],"output":[]}},"13":{"bindings":[],"clusters":{"input":["genOta"],"output":[]}},"2":{"bindings":[],"clusters":{"input":[],"output":[]}},"242":{"bindings":[],"clusters":{"input":[],"output":[]}},"3":{"bindings":[],"clusters":{"input":[],"output":[]}},"4":{"bindings":[],"clusters":{"input":[],"output":[]}},"47":{"bindings":[],"clusters":{"input":[],"output":[]}},"5":{"bindings":[],"clusters":{"input":[],"output":[]}},"6":{"bindings":[],"clusters":{"input":[],"output":[]}},"8":{"bindings":[],"clusters":{"input":[],"output":[]}}},"friendly_name":"Coordinator","ieee_address":"0x00124b00215fffbb","interview_completed":true,"interviewing":false,"network_address":0,"supported":false,"type":"Coordinator"}]'
Zigbee2MQTT:info  2020-11-03 11:49:23: MQTT publish: topic 'zigbee2mqtt/bridge/groups', payload '[]'
Zigbee2MQTT:info  2020-11-03 11:49:23: MQTT publish: topic 'zigbee2mqtt/bridge/config', payload '{"commit":"1.16.0","coordinator":{"meta":{"maintrel":1,"majorrel":2,"minorrel":7,"product":1,"revision":20201026,"transportrev":2},"type":"zStack3x0"},"log_level":"info","network":{"channel":11,"extendedPanID":"0x32229297fc3ded6d","panID":6754},"permit_join":false,"version":"1.16.0"}'
ciotlosm commented 4 years ago

In your zigbee2mqtt add-on Configuration change from:

serial:
  port: /dev/ttyUSB0

to

serial:
  port: /dev/serial/by-id/usb-1a86_USB_Serial-if00-port0
harvybob commented 4 years ago

I've done that, get the same - few failed attempts then it works (i think!)

ciotlosm commented 3 years ago

@harvybob all working now?

harvybob commented 3 years ago

HI, Yep, i got a zigbee thermometer yesterday, paired and working fine! thanks for your assistance!