Zigbee2mqtt with socat configuration

Tags: #<Tag:0x00007f73958a6b90> #<Tag:0x00007f73958a6a00>

I have zigbee2mqtt home assistant add-on with working configuration. Now I want to move the zigbee usb stick in other location, but without moving my home assistant box.

I connected zigbee stick to another rp and installed ser2net - using instructions on https://www.zigbee2mqtt.io/how_tos/how_to_connect_to_a_remote_adapter.html.

CONFIGURATION FILE:

data_path: /share/zigbee2mqtt
devices: devices.yaml
groups: groups.yaml
homeassistant: true
permit_join: false
mqtt:
  base_topic: zigbee2mqtt
  server: 'mqtt://***********:1883'
  user: *******
  password: *********
serial:
  port: /dev/ttyZ2M
advanced:
  pan_id: 6754
  channel: 11
  network_key:
    - 1
    - 3
    - 5
    - 7
    - 9
    - 11
    - 13
    - 15
    - 0
    - 2
    - 4
    - 6
    - 8
    - 10
    - 12
    - 13
  availability_blacklist: []
ban: []
whitelist: []
queue: {}
socat:
  enabled: true
  master: 'pty,raw,echo=0,link=/dev/ttyZ2M,mode=777'
  slave: >-
    192.168.10.171:8485,keepalive,nodelay,reuseaddr,keepidle=1,keepintvl=1,keepcnt=5
  restartdelay: 1
  initialdelay: 1
  options: '-d -d'
  log: false

The log file gives the following error:

2020/06/06 22:23:08 socat[9706] N PTY is /dev/pts/0
2020/06/06 22:23:08 socat[9706] E unknown device/address "192.168.10.171"
2020/06/06 22:23:08 socat[9706] N exit(1)
[Info] Socat process terminated, restarting after 1 sec

Anyone who can tell what is wrong?

You haven’t followed the howto.

Thanks for your reply Nick. Can you let me know where I can find the relevant howto - I have gone through many pages already but I can’t find it.

Your configuration simply doesn’t match the howto you pointed to.

Why Socat?

The Howto you linked is using ser2net.

This looks very different from what the howto explains.

serial:
  port: /dev/ttyZ2M

Easiest way is to run zigbee2mqtt on the machine your USB is plugged in, and let it point to your HA mqtt. The native version of zigbee2mqtt runs fine even on a RbPI 1.

I spent a few hours getting the configuration to work, this ended up doing the job:

 serial:
  port: /dev/ttyZ2M
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: []
  rtscts: false
device_options: {}
blocklist: []
passlist: []
queue: {}
experimental: {}
socat:
  enabled: true
  master: 'pty,raw,echo=0,link=/dev/ttyZ2M,mode=777,end-close'
  slave: 'tcp4:172.16.0.1:8485,ignoreeof'
  restartdelay: 1
  initialdelay: 1
  options: '-d -d'
  log: true

I had ser2net running with

8485:raw:0:/dev/ttyUSB0:115200 8DATABITS NONE 1STOPBIT

in /etc/ser2net.conf on the machine connected to the dongle.