Notification_id to use in trigger

I am trying to create couple of automations to charge my Tesla when electricity prices are at certain values as I am in Hourly pricing. I created an automation to start charging when prices go below certain prices, and I am trying to create a second automation to stop the charging if the prices go above that threshold again but only if the charging was started by first automation as I don’t want the second automation to stop charging whenever I charge the vehicle. So, I am trying to create the second automation using the notification trigger but to use that, the trigger needs something called ‘notification_id’ which I am unable to find anywhere, can anyone help me where I can find the notification_id for the notification I send in the first notification (I am trying to use the message data attribute but automation doesn’t let me save it and only wants the ‘notification_id’)

Hi,

Can i suggest that you might be better off with just one automation to do it all.

Trigger

  • low electricity price
  • manual charge start

Condition

  • low electricty price

Action

  • start charging
  • wait until
    • price too high or
    • battery full/charging stopped
  • stop charging

I use this technique to play music on my bathroom speaker until the light turns off.

1 Like

Understand that this technique will not survive an HA restart.

I’d suggest a boolean helper. Turn it on when your automation triggers due to low pricing. Check it when the pricing goes high before stopping the charge. Turn off the boolean when charging is stopped.

Thanks, didn’t know there is wait option in actions. Does the below code look good? (I did not use the second option in wait as my battery charge is set to 80% in Tesla app and it auto stops the charging when this is reached.

description: ""
mode: single
trigger:
  - platform: numeric_state
    entity_id:
      - sensor.comed_5_minute_price
    below: 0
    for:
      hours: 0
      minutes: 6
      seconds: 0
condition:
  - condition: device
    device_id: d95247ad8feff6bd1944b2b720939a24
    domain: cover
    entity_id: 73c5f2569a9da3e6cacb7b3758e8b4a6
    type: is_open
  - condition: device
    device_id: d95247ad8feff6bd1944b2b720939a24
    domain: device_tracker
    entity_id: 46ca85744c81f422e6de339fdb7c4177
    type: is_home
  - condition: numeric_state
    entity_id: sensor.chow_s_y_battery
    attribute: raw_soc
    below: 78
action:
  - device_id: 9af769c1dd4bd709617505a6062d2687
    domain: mobile_app
    type: notify
    message: ComEd price in negative, starting charging
    title: ComEd price in negative
  - type: turn_on
    device_id: d95247ad8feff6bd1944b2b720939a24
    entity_id: 286d727ab6c8df4f3fa45a9a10c31499
    domain: switch
  - wait_for_trigger:
      - platform: numeric_state
        entity_id:
          - sensor.comed_5_minute_price
        above: 0
    continue_on_timeout: true
  - type: turn_off
    device_id: d95247ad8feff6bd1944b2b720939a24
    entity_id: 286d727ab6c8df4f3fa45a9a10c31499
    domain: switch
  - service: notify.mobile_app_chows_iphone
    metadata: {}
    data:
      message: ComEd prices went up, stopping Tesla charging
      title: ComEd prices went up, stopping Tesla charging
1 Like