bluetti_mqtt icon indicating copy to clipboard operation
bluetti_mqtt copied to clipboard

Fix entities for HAs Energy Management

Open mbay0r opened this issue 2 years ago • 4 comments

I can't find/add the entity DC Input Power and AC Input Power into the HAs Energy Management.

It is possible to add here maybe two more entities following this guide or customize it?

https://developers.home-assistant.io/docs/core/entity/sensor/#long-term-statistics

This would also be good for DC Output Power and AC Output Power.

thank you very much!

mbay0r avatar Jan 05 '23 18:01 mbay0r

In order to add metrics to your HA Energy Dashboard it must be in a format that is accepted for the Energy Dashboard. You'll need to create a sensor in your configuration.yaml file like such:

sensor:

  • platform: integration unique_id: ac500_a_total_dc_input_power source: sensor.ac500_dc_input_power name: "AC500-A TOTAL DC INPUT POWER" unit_prefix: k unit_time: h

Then you can add the new entity "AC500-A TOTAL DC INPUT POWER" in your energy dashboard.

Note, this isn't a Bluetti-MQTT issue.. this a question for the HA community on how to take the data coming into HA and format it so it works within in HA as you wish.

twister36 avatar Jan 10 '23 23:01 twister36

Thanks @twister36 !

Just so I understand it better:

But with other products that I have in use, it works directly. The addon creates the entity, doesn't it? So it could also create them directly correctly, so I don't have to add a new sensor?

mbay0r avatar Jan 11 '23 06:01 mbay0r

So it could also create them directly correctly, so I don't have to add a new sensor?

@mbay0r The Bluetti devices don't have kWh data, so the only way to get that is to approximate it by taking various wattage readings over time and estimating how many kWh have been used. If done incorrectly, this estimate can be off by quite a bit. I haven't had any opportunity to understand how well the integration sensor works for Home Assistant, so I currently don't auto-configure it.

I know that long-term kWh statistics is something that users want, and it is on my list to support.

warhammerkid avatar Jan 15 '23 21:01 warhammerkid

@warhammerkid Thanks for the background here. If I might be of some help, here is a template to calculate time to full charge for a AC200M: sensor:

  • platform: template sensors: ac200m_timetofull: name: "Time left to full charge" unit_of_measurement: "Hours" value_template: >-"{% set inputWatts = states('sensor.ac200m_dc_input_power') | int + states('sensor.ac200m_ac_input_power') | int * 0.9 %} {% set storage = 2040 %} {% set wattsToStore = storage - (storage * (states('sensor.ac200m_pack_percent1') | int / 100)) %} {% set wattsCharging = inputWatts - (states('sensor.ac200m_ac_output_power') | int) %} {% set timetofull = (wattsToStore / wattsCharging) | round(1) %} {% if timetofull < 0.01 %} 0 {% else %} {{ timetofull }} {% endif %} {{ (wattsToStore / wattsCharging) | round(1), inputWatts, wattsToStore, wattsCharging }}"

katomic avatar Apr 19 '23 14:04 katomic