I have 2 solar inverters that each create a sensor by using the Huawei plugin.
I created a manual sensor in configuration.yaml that combines the output of both inverters into a new sensor.
- platform: template
sensors:
totalinverterpower:
friendly_name: "Inverters Input Power"
device_class: energy
unit_of_measurement: "kWh"
value_template: "{{ (states('sensor.inverter_input_power_1') | float) + (states('sensor.inverter_input_power_2') | float) }}"
The sensor is working when I look at it. The problem is that I cannot select this sensor as a solar input in the energy dashboard. I gave it the energy class but that also did not help.
What am I missing here?
tom_l
March 10, 2023, 9:03am
2
Use the template integration for new sensors. Supply default values for your float filters. Include a state_class and an availability template.
configuration.yaml
template:
- sensor:
- name: "Inverters Input Power"
device_class: energy
state_class: total_increasing
unit_of_measurement: "kWh"
state: "{{ states('sensor.inverter_input_power_1') | float(0) + states('sensor.inverter_input_power_2') | float(0) }}"
availability: "{{ states('sensor.inverter_input_power_1') | is_number and states('sensor.inverter_input_power_2') | is_number }}"
so I should NOT put this under sensors?
what does the total_increasing mean? I dont want to have it added up. I want the current inverter output. Or did I understand this wrong?
tom_l
March 10, 2023, 11:02am
5
If these are power sensors you have the wrong device class and unit of measurement.
template:
- sensor:
- name: "Inverters Input Power"
device_class: power
state_class: measurement
unit_of_measurement: "kW"
state: "{{ states('sensor.inverter_input_power_1') | float(0) + states('sensor.inverter_input_power_2') | float(0) }}"
availability: "{{ states('sensor.inverter_input_power_1') | is_number and states('sensor.inverter_input_power_2') | is_number }}"
Power and energy are two different things. You can not use power sensors with the energy dashboard.
And yes, that does not go in your sensors.yaml file.