Hi,
first time trying to build my own sensor. It should give me the kW of my Battery-Pack, which has 6,2kW in total and has an entity that shows it in %
So I included a template.yaml in my configuration.yaml and added the following in the template.yaml:
- sensor:
- name: Batterie Kapazität kW
unique_id: solax_battery_capacity_kW
unit_of_measurement: kW
icon: mdi:battery-sync
state: >
{{ (states('sensor.solax_battery_capacity_2')/100*6.2 |round(2)) }}
In the developer tools the sensor shows up but with an “unavailable” state. The state of the “%”-entitiy was 65.
If I write it in the template-editor, it shows the state “4,03”, which is the right kW-Value.
What’s wrong with the template?