egguy / grott-home-assistant-add-on

Grott Home Assistant add-on - Native MQTT plugin
33 stars 11 forks source link

grott docker with HA add-on #15

Closed wjansenw closed 1 year ago

wjansenw commented 1 year ago

HI, I'm moving away from the supervised HA installation, and going the Docker-mode. That also means I will no longer be able to use the HA Add-on (https://github.com/egguy/grott-home-assistant-add-on).

I have grott running on my server. The data gets in correctly, but processing of the grott_ha add-on seems to fail:

     - Grott extension processing started :  grott_ha
    [Grott HA] 0.0.7-RC7 Can't configure device: DEF1A21093
     - Grott extension processing ended :  7

Mosquitto is running correctly: I can telnet from the grott-docker to the mosquitto-docker on the correct port, so I think that MQTT-wise everything is OK.

From HA, I can also send test-mqtt messages, and they work correctly.

Currently, I have disabled authentication on MQTT, and use the following config:

extension = True
extname = grott_ha
extvar = {
        "ha_mqtt_host": "192.168.0.249",
        "ha_mqtt_port": "1883",
        "ha_mqtt_user": "mosquitto"
        }

The standard mqtt set-up does seem to arrive in mosquitto:

[MQTT]
nomqtt = False
ip = 192.168.0.249
port = 1883
auth = False

Anyone has an idea what I'm doing wrong? @egguy - I believe you made this add-on?

Regards, Wim

egguy commented 1 year ago

Could you start it in debug mode ? (I think the -v flag is enough), You should see how gortt parse the extvar config line, it shoud look like this (This is an example):

grott-grott-1      | _Extension:
grott-grott-1      |    extension:               True
grott-grott-1      |    extname:                 grott_ha
grott-grott-1      |    extvar:                  {'ha_mqtt_host': 'mosquitto', 'ha_mqtt_port': 1883}

If there's not all the vars, try to put all the information on a single line, I know it’s not aesthetic, but it will probably help.

I'm also trying to publish a multi arch docker container with the add-on preloaded if you are interested.

wjansenw commented 1 year ago

the variables get loaded correctly:

_Extension:
    extension:       True
    extname:         grott_ha
    extvar:          {'ha_mqtt_host': '192.168.0.249', 'ha_mqtt_port': 1883, 'ha_mqtt_user': 'mosquitto'}

What I do see, is that the below check does not give the expected result. As this is the first time processing is done, it should end up configuring the device, right? It never goes in that section:

    # Layout can be undefined
    if not MqttStateHandler.is_configured(device_serial) and getattr(
        conf, "layout", None
    ):

==> getattr returns None, and the device set-up is not done.

wjansenw commented 1 year ago

I was using the docker image from https://hub.docker.com/r/ledidobe/grott - but that seems to be a bit outdated. Testing now with the same image, but with pulling latest versions.

wjansenw commented 1 year ago

and it is working now: image

egguy commented 1 year ago

The grott version, was my second guess, the layout bug happens on the 2.6 branch. There is a correction in the 2.7 branch