#Home charger session info

1 messages · Page 1 of 1 (latest)

full quail
#

I am trying to track each session that I use my Emporia home charger. I have the following automation, but it never gets to the second trigger when the session ends.
'''
alias: Home charger session
description: Calculate charging session length and cost and send notification
triggers:

  • trigger: state
    entity_id:

    • sensor.home_charger_status
      from: Standby
      to: Charging
      actions:
  • target:
    entity_id: input_datetime.charger_start_time
    data:
    datetime: "{{ now().strftime('%Y-%m-%d %H:%M:%S') }}"
    action: input_datetime.set_datetime

  • wait_for_trigger:

    • trigger: state
      entity_id:
      • sensor.home_charger_status
        from: Standby
        to: Charging
  • target:
    entity_id: input_datetime.charger_end_time
    data:
    datetime: "{{ now().strftime('%Y-%m-%d %H:%M:%S') }}"
    action: input_datetime.set_datetime

  • action: notify.mobile_app_sm_s938u
    data:
    message: Charge session finished
    data: >-
    Start - {{ input_datetime.charger_start_time }}

    End - {{ input_datetime.charger_end_time }}
    
    Total time - {{ input_datetime.charger_end_time }} - {{
    input_datetime.charger_start_time }}
    

mode: single '''

timber pantherBOT
#

To format your text as code, enter three backticks on the first line, press Enter for a new line, paste your code, press Enter again for another new line, and lastly three more backticks.
```yaml
example: here
```
Don't forget you can edit your post rather than repeatedly posting the same thing.

royal vale
#

Shouldn't the 2nd trigger be Charging to Standby?

Personally I avoid using Wait for for long running items,
Just add a trigger ID and add both triggers at the top and use an IF condition to control. That way they will work even if HA is restarted while charging is in progress.