BMW remaining fuel automation

Hi there,

New to this forum and also new in using home assistant, but i really love it!
I have managed to create some automations, however the automation i want to do now is:
When remaining fuel in my car tank is 12liters or below i want home assistant to send a message to myself and my wife reminding us to fuel up next time one of us uses the car.

There is a entity for the fuel sensor and i can read the data, but i fail to create an automation that sends out the message…
If i try to run the automation manually, i recieve the message, but not when the value is at or below 12.
i am new in this area so i use the HA GUI to create the automations, but i can post the yaml data the automation created for me:

id: ‘1604846989188’
alias: skicka push när bil behöver tanka
description: ‘’
trigger:

  • platform: numeric_state
    entity_id: sensor.520d_xdrive_remaining_fuel
    attribute: unit_of_measurement
    below: ‘12’
    for: 00:05:00
    condition:
  • condition: time
    after: 08:00
    before: ‘21:00’
    action:
  • service: notify.mobile_app_patriks_telefon
    data:
    title: Dags att tanka!
    message: Det är dags att tanka, det är bara {{ states(“sensor.520d_xdrive_remaining_fuel”)
    }} liter kvar i tanken och vi kommer max {{ states(“sensor.520d_xdrive_remaining_range_fuel”)
    }} kilometer.
  • service: notify.mobile_app_fridas_iphone_2
    data:
    title: Dags att tanka!
    message: Det är dags att tanka, det är bara {{ states(“sensor.520d_xdrive_remaining_fuel”)
    }} liter kvar i tanken och vi kommer max {{ states(“sensor.520d_xdrive_remaining_range_fuel”)
    }} kilometer.
    mode: single

Can someone of you see what is wrong? i am starting to think that the problem is related to the attribute: unit_of_measurement , but i really don’t know.

Help please :slight_smile:

Maybe depends on time condition? The above automation works only from 08:00 to 21:00 that means that if you go below fuel at 21.30 automation does not work. I would take out also for: 00:05:00 in the trigger