Card update automation not triggering

I have this automation to alert me when there are updates for custom cards available:

- id: card_update_available
  alias: 'Card Update Available'
  initial_state: true
  trigger:
    platform: numeric_state
    entity_id: sensor.custom_card_tracker
    above: 0
  condition:
    condition: state
    entity_id: input_boolean.dnd
    state: "off"
  action:
    service: notify.ios_iphonex
    data:
      message: 'Update for custom card available.'
      data:
        push:
          sound: "Update.wav"

I noticed today that there is an update for one of my custom cards available but this automation did not run.

The sensor sensor.custom_card_tracker has changed from 0 to 1, and the input boolean input_boolean.dnd is off.
There seems to be little else that could go wrong unless I’m missing something obvious.
Any ideas?

Maybe just use state so it will alert for every change in state. above 0 is not really a trigger.

Then it would trigger an update alert when it returns to 0 after I update everything. I suppose I could add a condition for that. I’ll give it a go. I think it might be because the state has no unit of measurement and thus is not a number?

Let’s see how this goes:

- id: card_update_available
  alias: 'Card Update Available'
  initial_state: true
  trigger:
    platform: state
    entity_id: sensor.custom_card_tracker
  condition:
  - condition: state
    entity_id: input_boolean.dnd
    state: "off"
  - condition: template
    value_template: "{ states('sensor.custom_card_tracker') | int > 0 }}"
  action:
    service: notify.ios_iphonex
    data:
      message: 'Update for custom card available.'
      data:
        push:
          sound: "Update.wav"

Nope. This does not work either.

Because I’m an idiot:

    value_template: "{ states('sensor.custom_card_tracker') | int > 0 }}"

Have you tried:

- id: card_update_available
  alias: 'Card Update Available'
  initial_state: true
  trigger:
    platform: state
    entity_id: sensor.custom_card_tracker, sensor.custom_component_tracker
    from: '0'
  action:
    service: notify.me
    data_template:
      title: 'HA - Information'
      message: "Custom Lovelace card/Component update available."

The state is a string, and we are only interested in triggering when state moves away from the string “0”. I have not tested it out due to not having any cards to update at the moment.

UPDATE:
This works. Just got a notification.

I reckon it will work now that I have the template right. Was missing a {

Was it a custom component that updated and not a card? I always thought it was weird that it separates updates into 2 categories. Also, you could just make the trigger into a value_template but it might trigger less.

Two custom cards, mini-media-player and mini-graph-card-bundle. My template was incorrect so it’s no wonder it did not fire.

I only really want one alert per bunch of updates (till I get to updating) so that might be a good idea.

Nope. Still fails:

- id: card_update_available
  alias: 'Card Update Available'
  initial_state: true
  trigger:
    platform: template
    value_template: "{{ states('sensor.custom_card_tracker') | int > 0 }}"
  action:
    service: notify.ios_iphonex
    data:
      message: 'Update for custom card available.'
      data:
        push:
          sound: "Update.wav"

The template evaluates as true in the template editor. No error in the log. Calling it from the services menu works. :man_shrugging:

did the state for the sensor change though?

Yeah it did.

I mean the best advice I can give at the moment is to turn on debug in the logs and watch for the events and see if the state change event is occurring.