Open fencepost-error opened 4 months ago
+1 for this please.
In the meantime, for people who want this right now, you can do it with template sensors, it just means doing things in YAML rather than via the UI, e.g to get total power consumption as a template sensor:
template:
# Note double indentation step for sensor: -> name:
- sensor:
- name: "Power Total"
unique_id: uniqueid__power_total
unit_of_measurement: "W"
device_class: energy
state_class: measurement
state: >
{% set thing1 = states('sensor.thing1_power') | float %}
{% set thing2 = states('sensor.thing2_power') | float %}
{% set thing3 = states('sensor.thing3_power') | float %}
{% set thing4 = states('sensor.thing4_power') | float %}
{{ ( thing1 + thing2 + thing3 + thing4 ) | round(0) }}
Then select the template sensor as the value to display.
I did it a similar way to you: Just didn't bother creating variables first.. lol
In the meantime, for people who want this right now, you can do it with template sensors, it just means doing things in YAML rather than via the UI, e.g to get total power consumption as a template sensor:
template: # Note double indentation step for sensor: -> name: - sensor: - name: "Power Total" unique_id: uniqueid__power_total unit_of_measurement: "W" device_class: energy state_class: measurement state: > {% set thing1 = states('sensor.thing1_power') | float %} {% set thing2 = states('sensor.thing2_power') | float %} {% set thing3 = states('sensor.thing3_power') | float %} {% set thing4 = states('sensor.thing4_power') | float %} {{ ( thing1 + thing2 + thing3 + thing4 ) | round(0) }}
Then select the template sensor as the value to display.
Hi
I am very new to Home Assistant. This is my first project. Could you please tell me, where do you put that code and how I get the new value in the power flow card.
Best regards Marko
I am very new to Home Assistant. This is my first project. Could you please tell me, where do you put that code and how I get the new value in the power flow card.
See this post which should cover everything you need to do.
Is your feature request related to a problem? Please describe. At the moment it looks like the only way to combine data from multiple sensors, e.g. solar panel strings, batteries, etc, is to use template sensors to do the addition for you, which involves lots of playing around at the YAML level, copying and pasting sensor names around, etc.
Describe the solution you'd like It would be nice if the UI allowed you to add more than one sensor, a bit like the default Energy dashboard does with "Add battery system", "Add solar production", etc.
Describe alternatives you've considered Doing it via formulae in YAML also works, but given the number of times it's come up in discussions it seems like having it in the UI would make things easier for many people.
Additional context It's a convenience feature, but it would be very convenient to have.