Guest User

Untitled

a guest
Apr 3rd, 2024
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. alias: "Solar control: Change EV charging ampere"
  2. description: >-
  3. This automation changes the EV charging rate based on current solar
  4. production.
  5. trigger:
  6. - platform: state
  7. entity_id: sensor.solar_control_excess_solar_energy
  8. condition:
  9. - condition: state
  10. entity_id: input_boolean.solar_control_auto_adjust_charging
  11. state: "on"
  12. action:
  13. - service: input_number.set_value
  14. target:
  15. entity_id: number.lightspeed_charge_current
  16. data_template:
  17. value: >
  18. {% set max_charging = states('sensor.solar_control_excess_solar_energy')
  19. | float %} {% if max_charging > 0 %}
  20. {% set desired_current = max_charging / 230 %} # Assuming a standard voltage of 230V
  21. {% if desired_current > 16 %}
  22. 16 # Cap the current at 16A
  23. {% elif desired_current < 1 %}
  24. 1 # Set minimum current at 1A
  25. {% else %}
  26. {{ desired_current | round(0) }} # Round to the nearest whole number
  27. {% endif %}
  28. {% else %}
  29. 1 # Default to 1A if excess solar energy is not available
  30. {% endif %}
  31. mode: single
  32.  
Advertisement
Add Comment
Please, Sign In to add comment