AnotherDaniel / smahub

SMAHub is a flexible and modular solution for collecting data from SMA photovoltaic (PV) products and publishing it to various output channels, such as MQTT.
GNU General Public License v2.0
28 stars 8 forks source link

EVCHARGER only working with MQTT Sink? #21

Closed gandalfb closed 7 months ago

gandalfb commented 8 months ago

Hi, I just started with HA and SMA. It reads like a really difficult story. Thank you for this Hub.

I tried the docker image with ENV Setting and tried the EVCHARGER.

It looks like it is only usable with mqtt sink?

      -  EVCHARGER_ENABLED=true
      -  EVCHARGER_ADDRESS=192.168.2.xx
      -  EVCHARGER_PROTOCOL=https
      -  EVCHARGER_VERIFYTLS=false
      -  EVCHARGER_USER=<user>
      -  EVCHARGER_PASSWORD=<pw>
      -  HA_MQTT_ENABLED=true
      -  HA_MQTT_ADDRESS=192.168.2.xx
      -  HA_MQTT_USER=<user>
      -  HA_MQTT_PASSWORD=<pw>
      -  MQTT_ENABLED=false

Starting it will result in:

smahub  | 2023-12-28 08:52:35 INFO     Starting SHM2 source
smahub  | 2023-12-28 08:52:35 INFO     demo source plugin disabled
smahub  | 2023-12-28 08:52:35 INFO     Starting Tripower X source
smahub  | 2023-12-28 08:52:35 INFO     Starting EV Chargersource
smahub  | 2023-12-28 08:52:35 INFO     Starting HA-MQTT sink
smahub  | 2023-12-28 08:52:35 INFO     demo sink plugin disabled
smahub  | 2023-12-28 08:52:35 INFO     gen_ha_sensors sink plugin disabled
smahub  | 2023-12-28 08:52:35 INFO     MQTT sink plugin disabled
smahub  | 2023-12-28 08:52:45 ERROR    HA-MQTT sensor definitions for EVCharger not found
smahub  | 2023-12-28 08:52:45 ERROR    HA-MQTT sensor definitions for EVCharger not found

Type is SMA EVCharger 22

Thanks Gandalf

AnotherDaniel commented 8 months ago

Hi @gandalfb , I don't have an SMA EVCharger myself so that is the reason for this functional gap - the cause for the issue is likely that the EVCharger plugin is missing the Homassistant Sensors dictionary. For example, for the TripowerX plugin there is a longish list of sensor definitions, starting like this:

'''
Home Assistant MQTT autodiscovery sensor definitions for TripowerX
'''
SENSORS_TRIPOWERX = [
    # device info
    {
        'key': "device_info.name",
        'enabled': "true",
        'name': "Device name",
        'entity_category': "diagnostic",
    },

So essentially, we'd need to create such a sensor definition dict for EVCharger, to magically work with ha_mqtt. Do you maybe want to look into that? At the minimum, I'd need output of the gen_ha_sensors plugin for EVCharger to do this, or maybe a data dump of what gets published via the regular MQTT plugin for this device...

derTim commented 8 months ago

Updating the EVCharger plugin and migrating from manually configured entities to ha_mqtt (which I somehow missed, i thought manually configuring the HA entities is the only way...) is on my todo list, and after some very stressfull months I am quite positive that I find some time to do that on one of the following weekends.

I just have to setup a secondary homeassistant instance first, so I don't break anything on my main one 😄

AnotherDaniel commented 7 months ago

Hey @derTim, any update on some EVCharger measurement definition data?

derTim commented 7 months ago

Thanks @AnotherDaniel for the reminder 😄

I managed to setup a dev instance, started to create the sensor definitions, then got distracted by other stuff and totally forgot it.

I just created a PR with the updated plugin

AnotherDaniel commented 7 months ago

Brilliant, thank you! Merged, will do a release later today.