Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- alias: "Solar control: Change EV charging ampere"
- description: >-
- This automation changes the EV charging rate based on current solar
- production.
- trigger:
- - platform: state
- entity_id: sensor.solar_control_excess_solar_energy
- condition:
- - condition: state
- entity_id: input_boolean.solar_control_auto_adjust_charging
- state: "on"
- action:
- - service: input_number.set_value
- target:
- entity_id: number.lightspeed_charge_current
- data_template:
- value: >
- {% set max_charging = states('sensor.solar_control_excess_solar_energy')
- | float %} {% if max_charging > 0 %}
- {% set desired_current = max_charging / 230 %} # Assuming a standard voltage of 230V
- {% if desired_current > 16 %}
- 16 # Cap the current at 16A
- {% elif desired_current < 1 %}
- 1 # Set minimum current at 1A
- {% else %}
- {{ desired_current | round(0) }} # Round to the nearest whole number
- {% endif %}
- {% else %}
- 1 # Default to 1A if excess solar energy is not available
- {% endif %}
- mode: single
Advertisement
Add Comment
Please, Sign In to add comment