#Need help triggering on event

2 messages · Page 1 of 1 (latest)

alpine idol
#

I have this event:

trigger:
  id: snooze
  idx: '5'
  alias: null
  platform: event
  event:
    event_type: call_service
    data:
      domain: python_script
      service: set_state
      service_data:
        alarm: snooze
        mode: normal
        entity_id: sensor.viewassist_masterbedroom
    origin: LOCAL
    time_fired: '2024-09-26T19:14:45.501221+00:00'
    context:
      id: 01J8QW3NKX2KE3YFY8PX2NV3W0
      parent_id: null
      user_id: caef47a4fe5a457895a684a39d57b095
  description: event 'call_service'

I want to trigger when the value 'alarm' has the value 'snooze'. I am trying this:

platform: event
event_type: call_service
event_data:
  domain: python_script
  service: set_state
  service_data:
    alarm: snooze
id: snooze
enabled: true

Unfortunately this does not always work so I'm guessing I am doing something wrong. This is tied to a custom button card button for triggering that event like this:

  snooze:
    card:
      type: custom:button-card
      name: Snooze
      show_icon: false
      show_name: true
      tap_action:
        action: call-service
        service: python_script.set_state
        service_data:
          alarm: snooze
          mode: normal
          entity_id: '[[[ return variables.var_assistsat_entity ]]]'

I'm trying to somehow trigger the 'snooze' function of my automation by pressing the button. Perhaps there's a better way to do this and if so I'm open to changing things around. At the moment I have to press the button twice before the trigger actually fires. I am super confused as to why though.

brave relic
#

Make your trigger less specific by leaving out the service_data. Then use conditions to check for "snooze". As I understand it, the trigger listener expects an exact match for the object contained in the value of service_data.