Unable to trigger Automation Dexcom sensor

Hi everyone,

I have a Dexcom G6 sensor setup in Home Assistant. Everything work fine, but I can’t get an automation to trigger. Is there something I am doing wrong?
I have a lot of other automations working.

Automation is this:

- id: '1663771038673'
  alias: Ny automasjon 22
  description: RedAlert when BS is under 190
  trigger:
  - platform: numeric_state
    below: '190'
    entity_id: sensor.dexcom_myname_glucose_value
  condition: []
  action:
  - service: scene.turn_on
    target:
      entity_id: scene.boda_redalert
    metadata: {}
  - service: media_player.play_media
    target:
      entity_id: media_player.garasje
    data:
      media_content_id: media-source://media_source/local/TNG - Red Alert.mp3
      media_content_type: audio/mpeg
    metadata:
      title: TNG - Red Alert.mp3
      thumbnail:
      media_class: music
      children_media_class:
      navigateIds:
      - {}
      - media_content_type: app
        media_content_id: media-source://media_source
  - service: notify.pushover
    data:
      title: RedAlert
      message: Wii Wii Wii
  mode: single

That will only trigger when the sensor value changes from above 190 to below 190. If you start up and it’s already below 190, nothing will happen. We can add code to work around that if needed.

Does the action work as expected if you execute the automation manually from Settings / Automations?

Can you post a screenshot of the state page for that sensor? Like this, but for your BS sensor (redacting the myname bit if necessary):

Thank you for the reply. The action work if I run it manually yes.

Here is the state page:

sensor.dexcom_myname_glucose_value

MynameBS
6.8	unit_of_measurement: mmol/L
icon: mdi:diabetes
friendly_name: Myname BS

I’m no expert on blood sugar (yet, but four generations of type 2 are staring down my family tree at me), but 6.8 seems to be much lower than 190…

Yeah, sorry. I hade 2 automation, on for mmol/L and one for mg/dL. Just to test.

Make sure you have the right sensor in the trigger for the value, then. Like I said, the automation will only trigger when the state changes from above to below the threshold. You could do this, to also check when HA is started or automations are reloaded — note the added condition:

- id: '1663771038673'
  alias: Ny automasjon 22
  description: RedAlert when BS is under 190

  trigger:
    - platform: numeric_state
      below: '190'
      entity_id: sensor.dexcom_myname_glucose_value

    - platform: homeassistant
      event: start

    - platform: event
      event_type: automation_reloaded

  condition:
    - condition: numeric_state
      entity_id: sensor.dexcom_myname_glucose_value
      below: 190

  action:

Thank you, will do some more testing :slight_smile:

Did you find a solution to this?
My daughter of 20 months was diagnosed with Type 1, and we want to get her on a Dexcom (like my wife has)
I want to be able to setup a trigger than when her sugar drops below 4, it want it to alert the Google hub in our bedroom. To wake us up.
I’ve been doing some early stage testing with my wife’s sensor. But I can only get it to send a TTS when I first run the automation.
If you happened to get yours working. I’d love to see it.