YunoHost Package for Zigbee2MQTT

I started to package https://www.zigbee2mqtt.io

It’s on the whishlist: YunoHost app store | Application Wishlist and i use it outside of YunoHost.

I will install it via Python virtual environment: Python Virtual Environment | Zigbee2MQTT

Pull request welcome: GitHub - YunoHost-Apps/zigbee2mqtt_ynh: zigbee2mqtt as YunoHost package :wink:

Currently the idea is to just bring the frontend online and the user must configure zigbee2mqtt in the frontend, e.g.: Insert MQTT server settings and the /dev/serial/by-id/... path.

2 Likes

I didn’t use the Python Virtual Environment | Zigbee2MQTT way. I just use the node helper :wink:

The install looks ok. But there is a problem: The Zigbee2MQTT frontend will not work, if a supported Zigbee Adapter can be accessed!

I just add this to manifest.toml:

    [install.serial_port] # __SERIAL_PORT__
    ask.en = "Serial port of our Zigbee adapter"
    type = "string"
    example = "/dev/serial/by-id/your-CC2652RB_usb_stick_id"
    default = "/dev/ttyUSB0"
    help.en = "See also: https://www.zigbee2mqtt.io/guide/configuration/adapter-settings.html - Use 'ls /dev/serial/by-id/*' to find the correct serial port."

This string will be used in systemd.service, e.g.:

...
[Service]
# https://www.zigbee2mqtt.io/guide/configuration/#configuration
# Overwrite ./data/configuration.yaml
Environment="ZIGBEE2MQTT_CONFIG_SERIAL_PORT=__SERIAL_PORT__"
...

This is all okay.

Starting the app without a stick will looks like:

Zigbee2MQTT:error: Error while starting zigbee-herdsman
Zigbee2MQTT:error: Failed to start zigbee
Zigbee2MQTT:error: Check https://www.zigbee2mqtt.io/guide/installation/20_zigbee2mqtt-fails-to-start.html for possible solutions
Zigbee2MQTT:error: Exiting...

Specify a not existing adapter path like /dev/ttyUSB0 will also just ran into: Error while opening serialport 'Error: Error: No such file or directory, cannot open /dev/ttyUSB0'

So: The YunoHost CI will always ran into 502 Bad Gateway, see: See: YunoRunner for CI

So the question is: How to get the YunoHost CI green?!?
Just skip all tests is a bad idea, isn’t it?

I also start this question here: YunoHost package for Zigbee2MQTT · Koenkk/zigbee2mqtt · Discussion #20799 · GitHub Because i think it would be great if the Zigbee2MQTT frontend would be usable, but would indicate to the user that no working stick was found.

nobody any idea?

Can’t you just create a fake file /dev/tty/USB0 as a preinstall step?
Or maybe try installing this in the preinstall steps: Technology Blog About Everything!: Emulating USB Devices In Python With No Additional Hardware! ?

Maybe, but i think there is no way to setup a mock in YunoHost CI, isn’t it?!?

nobody a other idea?