CharlesGillanders / homeassistant-alphaESS

Monitor your energy generation, storage, and usage data using the official API from Alpha ESS.
MIT License
101 stars 22 forks source link

Service call format? #55

Closed Spookster closed 1 year ago

Spookster commented 1 year ago

Can someone give me a pointer on how to run a service call to setbatterycharge with helper values?

eg: this errors with 'extra keys not allowed'

alias: Alpha Set Battery Charge
sequence:
  - service: alphaess.setbatterycharge
    data:
      serial: AL1234567890
      enabled: true
      dp1start: "{{ state_attr('input_datetime.ess_charge_period_1_on', 'timestamp') | timestamp_custom('%H.%M', False) }}"
      dp1end: "{{ state_attr('input_datetime.ess_charge_period_1_off', 'timestamp') | timestamp_custom('%H.%M', False) }}"
      dp2start: "00:00"
      dp2end: "00:00"
      dischargecutoffsoc: 100
mode: single
icon: mdi:battery-charging
Spookster commented 1 year ago

Helps if you use the correct values.....

alias: Alpha Set Battery Charge
sequence:
  - service: alphaess.setbatterycharge
    data:
      serial: AL1234567890
      enabled: true
      cp1start: >-
        {{ state_attr('input_datetime.ess_charge_period_1_on', 'timestamp') |
        timestamp_custom('%H:%M', False) }}
      cp1end: >-
        {{ state_attr('input_datetime.ess_charge_period_1_off', 'timestamp') |
        timestamp_custom('%H:%M', False) }}
      cp2start: "00:00"
      cp2end: "00:00"
      chargestopsoc: 100
mode: single
icon: mdi:battery-charging

`