Hi All,
I have been an HA user for a little while now but have managed to all but avoid writing Yaml. I want to start getting a bit more adventurous with my automation but I have hit my coding limit already!
For background I have a SunSynk Solar installation that is connected to HA via Solar Assistant’s MQTT integration. This allows me to monitor and control the inverter from HA (Yay!)
However, the native methods in Sola Assistant and on the inverter itself for controlling battery charging are clunky at best - so I want to use HA to build my charging rules
I have set up a basic dashboard with some input helpers and template sensors (to use as global variables) as follows:
The idea is to create an automation that uses the start and stop times of the cheap rate electricity and the current and desired states of battery charge to calculate the charging current (Amps) needed to hit the desired charge % in the calculated time window. The automation itself will be triggered by the start time.
As I know every one battery percent equates to 0.2048kW, if I need to get from 20% charge to 70% (10.24kW) charge in three hours i need to charge at 3.413kW which is 66.66 amps at 51.2V. I want to do this so as to charge the batteries as slowly as I can.
The bit I am struggling with is the syntax/filters format for calculating the time window (duration) value by subtracting the start time from the end time and subtracting the desired and current battery charge percentages to give the % charge required to use in the calculation to derive the charge current. I have had a read through the template instructions and about states & filters, but I don’t really understand it fully.
Once I have the value calculated - setting it in the automation itself will be easy!
Any guidance would be hugely appreciated