You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Was trying to get a script going to charge my battery over my 3hr free power period based on the soc charge. I'm not sure why but this script grok made put my battery into standby mode. I had to totally shutdown my system complete to get function back. I'll leave the script here as it might give some insite on what not to do
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Was trying to get a script going to charge my battery over my 3hr free power period based on the soc charge. I'm not sure why but this script grok made put my battery into standby mode. I had to totally shutdown my system complete to get function back. I'll leave the script here as it might give some insite on what not to do
`alias: Optimize Charge for Globird
sequence:
target:
entity_id: number.saj_app_mode_input
data:
value: 1 # Time-of-Use mode
current_soc: "{{ states('sensor.saj_battery_soc') | float(0) }}"
target_soc: "{{ states('input_number.target_soc_percent') | float(100) }}"
capacity_kwh: "{{ states('input_number.battery_capacity_kwh') | float(0) }}"
max_power_w: "{{ states('input_number.max_charge_power_w') | float(5000) }}"
now_hour: "{{ now().hour + now().minute / 60 }}"
hours_left: "{{ max(0, 14 - now_hour) }}"
energy_needed_kwh: "{{ ((target_soc - current_soc) / 100 * capacity_kwh) }}"
ideal_rate_kwh: "{{ energy_needed_kwh / hours_left if hours_left > 0 else 0 }}"
ideal_power_w: "{{ (ideal_rate_kwh * 1000) | round(0) }}"
capped_power_w: "{{ min(ideal_power_w, max_power_w) }}"
power_percent: "{{ (capped_power_w / 10) | round(0) | int }}" # Exact 0-1000 scaling
target:
entity_id: number.saj_battery_charge_power_limit
data:
value: "{{ power_percent }}"
data:
name: Charge Optimizer
message: >-
Set charge to {{ capped_power_w }}W ({{ power_percent }}%) for {{ energy_needed_kwh | round(1) }}kWh needed in {{ hours_left | round(1) }}h
target:
entity_id: switch.saj_charging_control
mode: single`
Beta Was this translation helpful? Give feedback.
All reactions