DasLetzteEinhorn / AlphaESS_Monitor_Hass

Apache License 2.0
12 stars 1 forks source link

Help with setup #13

Closed sonarthreader closed 2 years ago

sonarthreader commented 2 years ago

I need help at setting up my Alpha ESS Monitoring at home.

My goal (big picture): I like to have a permanent display of my current PV kW and battery level. I'll build a device with two LED stripes, driven by an ESP32 or ESP8266 with WLED. Each stripe will show a percentage of power from PV and SOC. Connecting WLED with Home Assistant is no problem :) but I need some values from Alpha ESS to display ;)

My Home Assistant runs on Raspberry Pi 3 (pre-build Home Assistant Operating System 8.1) and downgraded to Home Assistant Core 2022.6.2 (read about #12 ), Alpha ESS to MQTT version 0.1.4, Mosquitto broker 6.1.2

Configuration YAML from Alpha ESS to MQTT log_level: debug base_topic: alphaess timeout: 60 username: xxxxx password: xxxxx

Running in debug log level, I can see values from my ESS in the log viewer:

Monitor data key: ALA00nnnnnnnnnn {"_id": "xxxxxxxxxxxxxxxxxxxxxxxx", "createtime": "2022-07-17 18:47:36", "uploadtime": "2022-07-17 20:47:25", "sn": "ALA00nnnnnnnnnn", "ppv1": 0.0, "ppv2": 0.0, "ppv3": 0.0, "ppv4": 0.0, "preal_l1": 423.0, "preal_l2": 0.0, "preal_l3": 0.0, "pmeter_l1": -261.0, "pmeter_l2": 225.0, "pmeter_l3": 36.0, "pmeter_dc": 84.0, "soc": 100.0, "factory_flag": 0, "pbat": 302.0, "sva": 0.0, "varac": 0.0, "vardc": 0.0, "ev1_power": 0, "ev1_chgenergy_real": 0.0, "ev1_mode": 0, "ev2_power": 0, "ev2_chgenergy_real": 0.0, "ev2_mode": 0, "ev3_power": 0, "ev3_chgenergy_real": 0.0, "ev3_mode": 0, "ev4_power": 0, "ev4_chgenergy_real": 0.0, "ev4_mode": 0, "poc_meter_l1": 0.0, "poc_meter_l2": 0.0, "poc_meter_l3": 0.0} Waiting 60 seconds

The Mosquitto broker is installed and default config is not changed:

Configuration YAML from Mosquitto broker logins: [] require_certificate: false certfile: fullchain.pem keyfile: privkey.pem customize: active: false folder: mosquitto

I did create a Home Assistant user named "mosquitto" according to the install documentation. This user is "active" but not an "administrator" and got a password.

Log output from Mosquitto broker: [services.d] starting services [services.d] done. [21:10:21] INFO: Starting NGINX for authentication handling... [21:10:21] INFO: Starting mosquitto MQTT broker... 1658085021: Warning: Mosquitto should not be run as root/administrator. [21:10:26] INFO: Successfully send discovery information to Home Assistant. [21:10:27] INFO: Successfully send service information to the Supervisor.

On my Integration overview I see a panel named "localhost MQTT". I configured the following broker options: Broker: core-mosquitto Port: 1883 Username: mosquitto Password: (same as defined in User management :) ) Discovery is "enabled"

When I start listening the the topic "alphaess" no messages are received for a plenty of minutes. On the other hand the Alpha ESS add-on pulls values every minute :)

My Question is: How can I ensure the Alpha ESS add-on delivers to mosquitto? Did I connect them properly? Where should the messages be viewable? And how can I generate events from the messages to update the WLED device?

DasLetzteEinhorn commented 2 years ago

So you're not getting any messages on any alphaess/# topic? I just tried to listen to alphaess/# here: https://my.home-assistant.io/redirect/config_mqtt/

If the addon connects to your mosquitto MQTT Broker, you should see something like this as soon as the alphaess addon started:

1658088731: New connection from 172.30.33.11:40065 on port 1883.
1658088731: New client connected from 172.30.33.11:40065 as auto-7F808..some-id.. (p2, c1, k60, u'addons').
sonarthreader commented 2 years ago

I think I forgot to attach /# :+1:

Listining to alphaess/# I see messages :)

Message 2 received on alphaess/ALA001021091154 at 18:21:

{
    "_id": "xxxxxxxxxxxxxxxxxxxxxxxx",
    "createtime": "2022-07-18 16:20:54",
    "uploadtime": "2022-07-18 18:20:43",
    "sn": "ALAnnnnnnnnnn",
    "ppv1": 164,
    "ppv2": 190,

Where do I configure the sensors from alphaess.yaml? I tried to add them to the Alpha ESS add-on but it doesn't change(reduce) the amount of data sent via mqtt.

I'm mainly interested in Solar Generation and Solar Battery SOC and like to trigger an automation with WLED, when a value gets updated

DasLetzteEinhorn commented 2 years ago

You configure these sensors in Home Assistant itself, not in the Addon. Basically you can add them to your configuration.yaml with something like this:

mqtt:
  sensor:
    - name: "Battery SOC"
      state_topic: "alphaess/ALxxx"
      unit_of_measurement: "%"
      icon: mdi:battery
      value_template: "{{ value_json.soc }}"

but i'd recommend, you take a look into splitting up your configuration to make sure, in the future you can find everything easily: https://www.home-assistant.io/docs/configuration/splitting_configuration/

sonarthreader commented 2 years ago

Thank you, that worked 👍

activitymore-7D228A4B-3221-4246-A0ED-D9FCD9BF1499

The left part of the circle show the PV power (max is 9600), right part is the battery state of charge

For testing I have 14 automation defined (0-13 LEDs on), with their according ranges. Works but not smart :) Since WLED expects a value between 0 and 100, can I skip the condition and use the sensor.solar_battery_soc as value in action? like:

alias: Battery SOC
description: ''
mode: single
trigger:
  - platform: mqtt
    topic: alphaess/#
action:
  - device_id: f0b7606ddacb2e93067f5189017ceaf8
    domain: number
    entity_id: number.wled_intensity
    type: set_value
    value: '{{ sensor.solar_battery_soc }}'

Complains with Message malformed: expected float for dictionary value @ data['value']

sonarthreader commented 2 years ago

Issue is resolved, thank you :)