Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
1.1 kB
1
Indexable
Never
alias: adjust_charging_amps
sequence:
  - variables:
      pv_power: "{{ states('sensor.pv_power') | float }}"
      load_power: "{{ states('sensor.load_power') | float }}"
      charger_power: "{{ states('sensor.eh9bdkjp_power') | float * 1000 }}"
      phases: 3
      voltage: 230
      availablePower: "{{ pv_power - load_power + charger_power }}"
      calculated_apms: "{{ ((availablePower / (phases * voltage)) | round(0)) }}"
  - condition: template
    value_template: "{{ 1 <= calculated_apms <= 16 }}"
  - service: number.set_value
    target:
      entity_id: number.pgu_charging_amps
    data:
      value: "{{ calculated_apms }}"
  - choose:
      - conditions: "{{ availablePower < phases * voltage }}"
        sequence:
          - service: switch.turn_off
            target:
              entity_id: switch.pgu_charger
            data: {}
      - conditions: "{{ availablePower >= phases * voltage }}"
        sequence:
          - service: switch.turn_on
            target:
              entity_id: switch.pgu_charger
            data: {}
mode: single
icon: mdi:car-electric