Help figuring out why my addon won't start

I’ve tried to create a new hass-addon the last few days, and have the program itself working. It’s a server built in rust that talks to something called an enet gateway and posts to MQTT (so that hopefully I can controll the lights in HA). I was quite excited to get this to work, but I have stumbled on the last part of the journey which is getting the docker image working. I’ve managed to get the repository set up, and installed the image into a HASS instance I have, but it just dies pretty immediately, and I can’t figure out why. I’m using the home-assistant ubuntu 18:04 base image (the server I’m trying to run expect glibc), which includes the s6-overlay (which I have no experience with), so I tried to copy what other addons do and create a /etc/services.d/enet-mqtt/run script, but it doesn’t seem to ever be invoked.

To debug further, I added a bunch of log statements to the run script (which now looks like this):

#!/usr/bin/with-contenv bashio
# ==============================================================================
# Start enet service
# ==============================================================================

bashio::log.info "enet/run..."

ENET_GATEWAY=$(bashio::config 'gateway')
bashio::log.info "enet/run 1..."
MQTT_PASSWORD="$(bashio::jq /data/auth.json '.enet_password')"
bashio::log.info "enet/run 2..."

# Wait until mosqitto is up and running
bashio::log.info "Starting enet-mqtt..."
bashio::net.wait_for 1883

bashio::log.info "enet/run 3..."
export ENET_MQTT_PASS="${MQTT_PASSWORD}"

# Run daemon
bashio::log.info "enet/run 4..."
exec /usr/bin/enet-mqtt \
  --gateway "${ENET_GATEWAY}" \
  --mqtt-host 127.0.0.1 \
  --mqtt-port 1883 \
  --mqtt-user "enet"

However, I see none of this in my logs:

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[cmd] /bin/bash exited 0
[cont-finish.d] executing container finish scripts...
[cont-finish.d] done.
[s6-finish] waiting for services.
[s6-finish] sending all processes the TERM signal.
[s6-finish] sending all processes the KILL signal and exiting.

The docker image and the code used to build all of this is available here: hass-addons/enet at main · YoloDev/hass-addons · GitHub. I’m kind of at a loss of how to proceed here, so any help would be much appreciated.

Hi,

I have done quite some searching, to find a enet integration (not a programmer myself) in order to get this working for my home assistant configuration.

It seems that the iobroker solution has a working adapter, did you check that one on github:

Maybe take a look at this: https://github.com/mnordseth/enet2mqtt

Thomas, this worked like a charm! Have the enet server now fully connected via mqtt! Let the home automation begin!

1 Like