How to access HASSIO sudo command (for zigbee2mqtt config)

Hi everybody,

I am new to HASSIO, therefore forgive me if I my questions are silly/basic…

I am trying to configure a CC2531 USB stick to connect to IKEA lightbulb…

I am following the instructions here: https://www.zigbee2mqtt.io/, but when I need to run Zigbee2mqtt on Raspberry Pi 3B+ I am facing some challenges…

once flashed the USB, the instructions ask to perform some modifications as per code below

# Setup Node.js repository
sudo curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -

# NOTE 1: If you see the message below please follow: https://gist.github.com/Koenkk/11fe6d4845f5275a2a8791d04ea223cb.
# ## You appear to be running on ARMv6 hardware. Unfortunately this is not currently supported by the NodeSource Linux distributions. Please use the 'linux-armv6l' binary tarballs available directly from nodejs.org for Node.js 4 and later.
# IMPORTANT: In this case instead of the apt-get install mentioned below; do: sudo apt-get install -y git make g++ gcc

# NOTE 2: On x86, Node.js 10 may not work. It's recommended to install an unofficial Node.js 12 build which can be found here: https://unofficial-builds.nodejs.org/download/release/ (e.g. v12.16.3)

# Install Node.js;
sudo apt-get install -y nodejs git make g++ gcc

# Verify that the correct nodejs and npm (automatically installed with nodejs)
# version has been installed
node --version  # Should output v12.X or v10.X
npm --version  # Should output 6.X

# Clone zigbee2mqtt repository
sudo git clone https://github.com/Koenkk/zigbee2mqtt.git /opt/zigbee2mqtt
sudo chown -R pi:pi /opt/zigbee2mqtt

# Install dependencies (as user "pi")
cd /opt/zigbee2mqtt
npm ci

I have tried to following with no luck:

  1. I have installed Terminal & SSH add-on and accessed the WebUI: when I try the first command I get the following error: bash: sudo: command not found

  2. I have tried to access the Raspberry Pi with Putty (via SSH), but I dont even know how to access (credentials/login etc…

  3. I have logged in directly to the Raspberry Pi (home assistant login: root - no password asked - and then I type login to access the “host system”). Once logged in, if i type the suggested commands I get the same error as “bullet point 1”… bash: sudo: command not found

It seems to me that I am not performing the command with the right permissions and/or “in the right place”…

anybody can help me on this?

thank you so much

First of all, the name hassio was retired months ago. You’re running home assistant OS.
Second, no need to compile zigbee2mqtt yourself on home assistant OS. Search for the zigbee2mqtt add-on by Daniel Welch.

1 Like

Thank you so much @francisp

I had a look at Home Assistant last year, while choosing between HA and openHAB… therefore my bad I missed the "re-branding/renaming … sorry for that… I have made now the decision to fully implement HA :slight_smile:

Thank you also for suggesting the Daniel Welch add-on… here what I have done:

  • Plugged Zigbee USB into PaspBerry Pi 3 B+

  • Installed Daniel Welch the add-on

  • Configured Daniel Welch add-on:
    * Installed homeassistant: true
    * permit_join: true
    * mqtt:
    * base_topic: zigbee2mqtt
    * server: ‘mqtt://core-mosquitto:1883’
    * user: zigbee2mqtt
    * password: password

  • Verified the Daniel Welch the add-on log and confirm that it is successfully started

  • Moved to Integrations and added Zigbee Home Automation:
    * Serial Device Path : /dev/ttyACM0 - TI CC2531 USB CDC, s/n: __0X00124B00014F1725 - Texas Instruments
    * Radio Type: TI_CC = Texas Instruments Z-Stack ZNP protocol: CC253x, CC26x2, CC13x2
    * port speed: 115200
    * data flow control: no info

now what should I do? :stuck_out_tongue: how do I verify that everything is set right?

under integrations I see the zigbee component, but it does not pick up any “device”… should it list at least the Zigbee USB (as bridge)?

Oh no.

Either you use zigbee2mqtt with the zigbee2mqtt add-on, or the ZHA integration. You can’t use both at the same time. Only 1 zigbee stack can use your CC2531 at a time. You have to choose.

I am really sorry… but I need some guidance… please…

lets assume I have successfully installed and configure the zigbee2mqtt add-on… what are be the next steps? how do I see the USB key as bridge? how to I add ikea light bulbs?

Thank you again…

Zigbee2mqtt coordinator (bridge) is not visible in HA.

To pair ikea lights :

Make sure permit_join: true is set and power your lights 6 times on and off.

I feel like I don’t know what to do :frowning:

I have removed the ZHA integration, restarted HA and looking at the log under zigbee2mqtt add-on I have found the below:

[Info] Socat is DISABLED and not started
2020-07-21T16:26:41: PM2 log: Launching in no daemon mode
2020-07-21T16:26:41: PM2 log: App [npm:0] starting in -fork mode-
2020-07-21T16:26:42: PM2 log: App [npm:0] online
> [email protected] start /app
> node index.js
zigbee2mqtt:info  2020-07-21 16:26:47: Logging to console and directory: '/share/zigbee2mqtt/log/2020-07-21.16-26-47' filename: log.txt
zigbee2mqtt:info  2020-07-21 16:26:48: Starting zigbee2mqtt version 1.14.1-dev (commit #)
zigbee2mqtt:info  2020-07-21 16:26:48: Starting zigbee-herdsman...
zigbee2mqtt:info  2020-07-21 16:26:51: zigbee-herdsman started
zigbee2mqtt:info  2020-07-21 16:26:51: Coordinator firmware version: '{"type":"zStack12","meta":{"transportrev":2,"product":0,"majorrel":2,"minorrel":6,"maintrel":3,"revision":20190608}}'
zigbee2mqtt:info  2020-07-21 16:26:51: Currently 1 devices are joined:
zigbee2mqtt:info  2020-07-21 16:26:51: 0x90fd9ffffe29a242 (0x90fd9ffffe29a242): LED1623G12 - IKEA TRADFRI LED bulb E27 1000 lumen, dimmable, opal white (Router)
zigbee2mqtt:warn  2020-07-21 16:26:51: `permit_join` set to  `true` in configuration.yaml.
zigbee2mqtt:warn  2020-07-21 16:26:51: Allowing new devices to join.
zigbee2mqtt:warn  2020-07-21 16:26:51: Set `permit_join` to `false` once you joined all devices.
zigbee2mqtt:info  2020-07-21 16:26:51: Zigbee: allowing new devices to join.
zigbee2mqtt:info  2020-07-21 16:26:51: Connecting to MQTT server at mqtt://core-mosquitto:1883
zigbee2mqtt:info  2020-07-21 16:26:53: Connected to MQTT server
zigbee2mqtt:info  2020-07-21 16:26:53: MQTT publish: topic 'zigbee2mqtt/bridge/state', payload 'online'
zigbee2mqtt:info  2020-07-21 16:26:53: MQTT publish: topic 'zigbee2mqtt/0x90fd9ffffe29a242', payload '{"update_available":false}'
zigbee2mqtt:info  2020-07-21 16:26:53: MQTT publish: topic 'zigbee2mqtt/bridge/config', payload '{"version":"1.14.1-dev","commit":"","coordinator":{"type":"zStack12","meta":{"transportrev":2,"product":0,"majorrel":2,"minorrel":6,"maintrel":3,"revision":20190608}},"log_level":"info","permit_join":true}'
zigbee2mqtt:info  2020-07-21 16:26:53: MQTT publish: topic 'homeassistant/light/0x90fd9ffffe29a242/light/config', payload '{"brightness":true,"schema":"json","command_topic":"zigbee2mqtt/0x90fd9ffffe29a242/set","brightness_scale":254,"state_topic":"zigbee2mqtt/0x90fd9ffffe29a242","json_attributes_topic":"zigbee2mqtt/0x90fd9ffffe29a242","name":"0x90fd9ffffe29a242_light","unique_id":"0x90fd9ffffe29a242_light_zigbee2mqtt","device":{"identifiers":["zigbee2mqtt_0x90fd9ffffe29a242"],"name":"0x90fd9ffffe29a242","sw_version":"Zigbee2mqtt 1.14.1-dev","model":"TRADFRI LED bulb E27 1000 lumen, dimmable, opal white (LED1623G12)","manufacturer":"IKEA"},"availability_topic":"zigbee2mqtt/bridge/state"}'
zigbee2mqtt:info  2020-07-21 16:26:53: MQTT publish: topic 'homeassistant/sensor/0x90fd9ffffe29a242/linkquality/config', payload '{"icon":"mdi:signal","unit_of_measurement":"lqi","value_template":"{{ value_json.linkquality }}","state_topic":"zigbee2mqtt/0x90fd9ffffe29a242","json_attributes_topic":"zigbee2mqtt/0x90fd9ffffe29a242","name":"0x90fd9ffffe29a242_linkquality","unique_id":"0x90fd9ffffe29a242_linkquality_zigbee2mqtt","device":{"identifiers":["zigbee2mqtt_0x90fd9ffffe29a242"],"name":"0x90fd9ffffe29a242","sw_version":"Zigbee2mqtt 1.14.1-dev","model":"TRADFRI LED bulb E27 1000 lumen, dimmable, opal white (LED1623G12)","manufacturer":"IKEA"},"availability_topic":"zigbee2mqtt/bridge/state"}'
zigbee2mqtt:info  2020-07-21 16:26:53: MQTT publish: topic 'homeassistant/binary_sensor/0x90fd9ffffe29a242/update_available/config', payload '{"payload_on":true,"payload_off":false,"value_template":"{{ value_json.update_available}}","state_topic":"zigbee2mqtt/0x90fd9ffffe29a242","json_attributes_topic":"zigbee2mqtt/0x90fd9ffffe29a242","name":"0x90fd9ffffe29a242_update_available","unique_id":"0x90fd9ffffe29a242_update_available_zigbee2mqtt","device":{"identifiers":["zigbee2mqtt_0x90fd9ffffe29a242"],"name":"0x90fd9ffffe29a242","sw_version":"Zigbee2mqtt 1.14.1-dev","model":"TRADFRI LED bulb E27 1000 lumen, dimmable, opal white (LED1623G12)","manufacturer":"IKEA"},"availability_topic":"zigbee2mqtt/bridge/state"}'
zigbee2mqtt:info  2020-07-21 16:31:43: MQTT publish: topic 'zigbee2mqtt/bridge/log', payload '{"type":"device_announced","message":"announce","meta":{"friendly_name":"0x90fd9ffffe29a242"}}'
zigbee2mqtt:info  2020-07-21 16:31:44: MQTT publish: topic 'zigbee2mqtt/bridge/log', payload '{"type":"device_announced","message":"announce","meta":{"friendly_name":"0x90fd9ffffe29a242"}}'
zigbee2mqtt:info  2020-07-21 16:31:46: MQTT publish: topic 'zigbee2mqtt/bridge/log', payload '{"type":"device_announced","message":"announce","meta":{"friendly_name":"0x90fd9ffffe29a242"}}'
zigbee2mqtt:info  2020-07-21 16:31:47: MQTT publish: topic 'zigbee2mqtt/bridge/log', payload '{"type":"device_announced","message":"announce","meta":{"friendly_name":"0x90fd9ffffe29a242"}}'
zigbee2mqtt:info  2020-07-21 16:31:49: MQTT publish: topic 'zigbee2mqtt/bridge/log', payload '{"type":"device_announced","message":"announce","meta":{"friendly_name":"0x90fd9ffffe29a242"}}'
zigbee2mqtt:info  2020-07-21 16:31:51: MQTT publish: topic 'zigbee2mqtt/bridge/log', payload '{"type":"device_announced","message":"announce","meta":{"friendly_name":"0x90fd9ffffe29a242"}}'
zigbee2mqtt:info  2020-07-21 16:32:06: MQTT publish: topic 'zigbee2mqtt/bridge/log', payload '{"type":"device_announced","message":"announce","meta":{"friendly_name":"0x90fd9ffffe29a242"}}'

I know that I have silly questions, but:

  • where the device will “appear”? will it appear automatically or I need to add it manually some how?
  • form the log it seems that the RaspBerry Pi “sees” the Ikea light bulb… is there any way to understand where is the connection error?

Thank you again

You should see it here :

image

nothing on my side :frowning:

but the log file seems to see the light bulb… I was also reading that other people had some issue with ikea lights… could it be the problem?

Sometime the mosquitto add-on has problems auto-discovering devices. Removing the integration and restarting might help.

mqtt - fixed

Success!!! you are a legend!! only worry is if every time I need to uninstall and reinstall, will I keep the setting or will I need to reset all over again add devices?

Once the mqtt addon starts auto-discovering, it should continuing doing so without reinstalling.

@francisp you are a legend! thank you