I’m not an expert on yaml. How do I set a value of an entity with another entity?
In my case I want to set number.inverter_backup_power_soc with the value of sensor.batteries_state_of_capacity. Both are percentage values ranging from 0 to 100.
I tried with the automation below but it doesn’t work. Any ideas what I’m doing wrong? Thank you!
It’s often personal preference, but I find it easier to maintain. In this case you can avoid the if statement, so you’re ending up with less code. Maybe try both versions and see how it works for you.
I tend to go with fewer automations. Meaning more code in each. It keeps similar things in one place as opposed to multiple automations spreading the code out.
You might be better off with using a numeric_state trigger instead of a state trigger if you’re waiting for 1 minute to trigger.
If your wallbox reports 0 > 1 > 2 in less than a minute, then your automation will not trigger.
Something like the below should do it. Note I also added a condition which prevents unnecessary triggers if your wallbox is unavailable:
I think the wallbox reports the charging power in float, kW with 2 decimals (I added 1 minute wait just to prevent debouncing). Would a numeric_state still work in this case?