muppet3000 / homeassistant-grott

Home Assistant Integration for Grott - MQTT
MIT License
65 stars 14 forks source link

Incompatible with Grott HA Addon #42

Open bacobart opened 9 months ago

bacobart commented 9 months ago

Instead of manually running Grott in docker, I tried to use this extension in combination with https://github.com/egguy/grott-home-assistant-add-on -- it does not seem to be working. One thing I noticed is that the expected topic for this extension is hardcoded. The HA grott addon uses a different topic ("homeassistant/sensor/grott"). I changed that in the code, but then I run into the following error:

2023-10-02 11:41:19.141 WARNING (MainThread) [homeassistant.components.mqtt.mixins] MQTT entity name starts with the device name in your config {'name': 'RBL2CHV033 Datalogger serial', 'unique_id': 'grott_RBL2CHV033_datalogserial', 'state_topic': 'homeassistant/grott/RBL2CHV033/state', 'device': {'identifiers': ['RBL2CHV033'], 'name': 'RBL2CHV033', 'manufacturer': 'GrowWatt', 'connections': []}, 'value_template': Template<template=({{ value_json.datalogserial }}) renders=0>, 'payload_not_available': 'offline', 'enabled_by_default': True, 'availability_mode': 'latest', 'payload_available': 'online', 'force_update': False, 'encoding': 'utf-8', 'qos': 0}, this is not expected. Please correct your configuration. The device name prefix will be stripped off the entity name and becomes 'Datalogger serial'

2023-10-02 11:41:19.160 ERROR (MainThread) [homeassistant.util.logging] Exception in mqtt_message_received when handling msg on 'homeassistant/sensor/grott/RBL2CHV033_datalogserial/config': '{"name": "RBL2CHV033 Datalogger serial", "unique_id": "grott_RBL2CHV033_datalogserial", "state_topic": "homeassistant/grott/RBL2CHV033/state", "device": {"identifiers": ["RBL2CHV033"], "name": "RBL2CHV033", "manufacturer": "GrowWatt"}, "value_template": "{{ value_json.datalogserial }}"}'
Traceback (most recent call last):
  File "/config/custom_components/grott/sensor.py", line 70, in mqtt_message_received
    if (payload["buffered"] == "no"):
        ~~~~~~~^^^^^^^^^^^^
KeyError: 'buffered'

So couple of errors here, one being "MQTT entity name starts with the device name in your config this is not expected. Please correct your configuration" but i'm not sure how I should go about that.

The other error being it expecting a buffered property which doesn't exist. But maybe that is because of the previous configuration error?

Is this scenario I'm trying even supposed to be working? Should I change something in the Grott HA addon so this extension will work?

As a feature request I think it would make sense to make the MQTT topic configurable?

muppet3000 commented 9 months ago

Yes, this is definitely a supported configuration - myself and @egguy just need to coordinate on updating our documentation to point at each other to make it easy for people to get working. @egguy - Would you be able to assist here?

From a previous discussion on this over here: https://github.com/muppet3000/homeassistant-grott/issues/16#issuecomment-1623172859 You can see there are a few options you can change, I believe you need to enable "Enable grott mqtt" and disable "Home Assistant Plugin" and then this integration should work correctly.

If you could test and let me know then I can start to update the documentation to support the @egguy addon as another installation method.

gogobu commented 8 months ago

Yes, this is definitely a supported configuration - myself and @egguy just need to coordinate on updating our documentation to point at each other to make it easy for people to get working. @egguy - Would you be able to assist here?

From a previous discussion on this over here: #16 (comment) You can see there are a few options you can change, I believe you need to enable "Enable grott mqtt" and disable "Home Assistant Plugin" and then this integration should work correctly.

If you could test and let me know then I can start to update the documentation to support the @egguy addon as another installation method.

Can confirm the setting works for me. Thank you for the great work!