I am completely new to Home Assistant and I am trying to calculate the kWh of my battery based on the SOC sensor and its designed capacity sensor.
The State of charge must be first transformed in to a 0.something
I have already achieved this by using the following I found
{{ states(‘sensor.byd_battery_box_premium_hv_state_of_charge’) | float / 100 * 11059 }}
However when I replace the 11059 (which is the current capacity of the battery) with its sensor it looks like the below
{{ states(‘sensor.byd_battery_box_premium_hv_state_of_charge’) | float / 100 * states(‘sensor.byd_battery_box_premium_hv_maximum_capacity’) }}
but doesn’t give a preview so I don’t save it to avoid errors.
Can you please advice how to formulate the script.
Thank you all in advance.
Because boheme61 copied your unformatted text it contains “fancy” quotes. These will cause errors and need to be replaced with “straight” quotes. There were also some extraneous parentheses that were not required as the normal order of operations (multiplication and division are performed left to right) will ensure it does what you want:
Upps , did saw they looked peculiar, but i guess i was to fast to get out of the Forum
Thanks for “stepping in”
Just watched “Gentleman Thief Thomas Crown” (again) , of to bed now