Pylontech in Home Assistant Energy Dashboard #523
-
Hi, I guess many of you are using openDTU-onBattery and Pylontech Battery along with the home assistant, so maybe you can help me out. :) Thanks in advance. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 18 replies
-
Hey @meisterlampe , I recently had the same issue and can share what I did to solve it. In my case, I have a Pylontech US2000 connected with the DTU via CAN Step 1: Make sure you populate your data to MQTT
When you have set up everything correctly, the dtu devices (including the battery) and its sensors should show up as MQTT integration in Home Assistant Step 2: Create custom helper sensors to measure the charge and dischargeNow we need 2 data points from the MQTT data to calculate the power that charges or discharges the battery:
What I did was that I created custom sensors. You can add them to the Here is how my sensors look like: sensor:
- platform: template
sensors:
# Current charge/discharge power of the battery
pylontech_battery_power:
unit_of_measurement: 'W'
value_template: >-
{{ states('sensor.battery_0001_battery_current')|float(0) * states('sensor.battery_0001_battery_voltage')|float(0) }}
# Sensor for discharge power (if the value is negative)
pylontech_battery_power_discharge:
unit_of_measurement: 'W'
value_template: >-
{% if states('sensor.pylontech_battery_power')|float(0) < 0 %}
{{ states('sensor.pylontech_battery_power')|float(0) * -1 }}
{% else %}
0
{% endif %}
# Sensor for charge power (if the value is positive)
pylontech_battery_power_charge:
unit_of_measurement: 'W'
value_template: >-
{% if states('sensor.pylontech_battery_power')|float(0) > 0 %}
{{ states('sensor.pylontech_battery_power')|float(0) }}
{% else %}
0
{% endif %} Quick explanation:
Step 3: Create Rieman sum integral sensors" that can be used by the Energy DashboardNow that we have the sensors, you can create helper sensors. This also works In the Home Assistant interface when you go to `Settings -> Devices & Services -> Helpers (tabs at the top). In my case I created 2 "Rieman sum integral sensors" The settings could look something like this: Step 4: Add your Rieman sum sensors to the energy dashboardThis is how you could do it: Note that even though there is a warning for me, it still works: |
Beta Was this translation helpful? Give feedback.
-
With the recent ESPHome Update Pylontech Batteries are now supported. Details here: esphome/esphome#4688 |
Beta Was this translation helpful? Give feedback.
-
No. We are three!
You, my Brother and me. We should start an issue. I think others are also affected .
U.
Freundliche Grüße
U. Dörr
…________________________________
From: meisterlampe ***@***.***>
Sent: Friday, February 2, 2024 6:27:34 PM
To: helgeerbe/OpenDTU-OnBattery ***@***.***>
Cc: futzicomp ***@***.***>; Comment ***@***.***>
Subject: Re: [helgeerbe/OpenDTU-OnBattery] Pylontech in Home Assistant Energy Dashboard (Discussion #523)
OK. So I checked using mqttexplorer and the problem is, that there is no battery entry in the homeassistant/ topic. All other devices are shown there (and if I delete them, they are recreated after i.e. restarting opendtu). The battery values are also shown and beeing updated in the solar/-Topic. I can also integrate them manually in HomeAssistant, but it really should work automatically using Home Assistant MQTT Auto Discovery.
Disabling and re-enabling the battery, mqtt or HA-Autodsicovery did not help.
I will try to investigate a bit further. I guess it is not a general problem with openDTU-onBattery because many other users would have complained already in this case :)
—
Reply to this email directly, view it on GitHub<#523 (reply in thread)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ABOXJYU7YSFEFUAXPP6J3PTYRUOYNAVCNFSM6AAAAAA64E3QKKVHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM4DGNBZGE3DO>.
You are receiving this because you commented.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
Hey @meisterlampe ,
I recently had the same issue and can share what I did to solve it.
In my case, I have a Pylontech US2000 connected with the DTU via CAN
Step 1: Make sure you populate your data to MQTT
solar/battery
in my case):When you have set up everything correctly, the dtu devices (including the battery) …