Thank you for the help yesterday. I got the hang of adding up sensor values. Now I have different question.
I have entity sensor.shunt_instantaneous_power which has both positive and negative values. I am trying to create new sensor which will display only positive values or that entity or 0 for negative values. Is that possible?
Thank you again. In above template 1000 can be any number I would assume? Well, I guess I will see once the solar system starts producing today.
Now for the negative values of the shunt measurement. How can that negative value be converted into positive. Reason for my asking is because of the requirement of this card Tesla Style Card
From git hub page:
**templates for missing sensors or for negative sensors
Remember you can create template sensors if you are missing one like solar yield out of solar_consumption and grid_feed_in or if you are missing another one like home_consumption. Some inverters have positive and negative values, here all sensors need to be positive values, so create template sensors like:
battery_consumption:
value_template: '{% set batter_cons = sensor.powerwall_battery_now | int %}
{% if batter_cons > 0 %}
{{ batter_cons | int }}
{% else %}
0
{% endif %}'
device_class: power
unit_of_measurement: W**
Solution to show Power Wall (negative) discharge values of the sensor as positive and showing 0 for all the positive values of the sensor. It works. Thank you again. Would you change anything?
I have similar question. I would like to have data from multiple sensors and get mean value, but statistics platform does not support multiple entities. Any ideas for this?
All three of the sensors give a reading in developers tools. Any ideas how to troubleshoot this?
Mine now works.
The issue I had was the default unit of measure on the template sensors was different.
Application of this format generated this errormessage in dev_tools:
ValueError: Template error: float got invalid input 'unknown' when rendering template
template:
-sensor:
- name: "Total Charging Power"
unit_of_measurement: "W"
device_class: power
state: >
{{ [ states('sensor.sessy_d5mr_charge_power' ),
states('sensor.sessy_dma4_charge_power' )]
| map('float') | sum }}
availability: >
{{ not 'unavailable' in
[ states('sensor.sessy_d5mr_charge_power'),
states('sensor.sessy_dma4_charge_power') ] }}'
but no default was specified.