Trigger automation on tellstick event

I have a switch connected via a tellstick duo (433 MHz receiver)

I want to trigger on the event, but I can not manage to get the trigger to work. Anyone have any ideas of why this minimalistic trigger do not work. It seems very similar to how my deconz event triggers work.

Event:

{
    "event_type": "state_changed",
    "data": {
        "entity_id": "switch.hallway_remote",
        "old_state": {
            "entity_id": "switch.hallway_remote",
            "state": "on",
            "attributes": {
                "friendly_name": "Hallway Remote",
                "assumed_state": true
            },
            "last_changed": "2020-12-02T21:24:51.037782+00:00",
            "last_updated": "2020-12-02T21:24:51.037782+00:00",
            "context": {
                "id": "c457279172c653a9abc58d129eb500cc",
                "parent_id": null,
                "user_id": null
            }
        },
        "new_state": {
            "entity_id": "switch.hallway_remote",
            "state": "on",
            "attributes": {
                "friendly_name": "Hallway Remote",
                "assumed_state": true
            },
            "last_changed": "2020-12-02T21:24:52.235174+00:00",
            "last_updated": "2020-12-02T21:24:52.235174+00:00",
            "context": {
                "id": "90f42f37ce4dc6ca932dbde029ca1cd6",
                "parent_id": null,
                "user_id": null
            }
        }
    },
    "origin": "LOCAL",
    "time_fired": "2020-12-02T21:24:52.235174+00:00",
    "context": {
        "id": "90f42f37ce4dc6ca932dbde029ca1cd6",
        "parent_id": null,
        "user_id": null
    }
}

Trigger

alias: 433MHz Event Trigger Test
description: ''
trigger:
  - platform: event
    event_type: state_change
    event_data:
      entity_id: switch.hallway_remote

I also tried:

alias: 433MHz Event Trigger Test
description: ''
trigger:
  - platform: event
    event_type: state_change
    event_data:
      entity_id: switch.hallway_remote
      new_state:
        state: "on"

make it ‘state_changed’ :wink:

Thank you!!! It was such a small and simple misstake :rofl:

I have spent many hours and given up on this several times without finding that misspelling. Thank you!

Ehm why are you using an event trigger? You can just use a simple state trigger.

trigger:
  - platform: state
    entity_id: switch.hallway_remote
    to: 'on'

Because it is a remote, that is exposed to HA as a switch. Because of that the remote has a state and that trigger would only be triggered on state change on the switch, I want it to trigger every time someone push that button, not when the state of the remote change. (the state of the remote is independent of what it controls)

But maybe I was a bit premature,

It triggers on this:

  - platform: event
    event_type: state_changed
    event_data:
      entity_id: switch.hallway_remote

but it does not trigger on this:

  - platform: event
    event_type: state_changed
    event_data:
      entity_id: switch.hallway_remote
      new_state:
        state: 'on'

or on this:

  - platform: event
    event_type: state_changed
    event_data:
      new_state:
        entity_id: switch.hallway_remote
        state: 'on'

I use the one it triggers on for my new automation but it bothers me a bit that I can not manage to control the trigger better.

I don’t think you can nest the event_data like that to check new_state.

trigger:
- platform: event
  event_type: state_changed
  event_data:
    entity_id: switch.hallway_remote
condition:
  - "{{ trigger.event.data.new_state.state == 'on' }}"

Seems like it.

I did it like this in the end to use the new automation features:

  trigger:
    - platform: event
      event_type: state_changed
      event_data:
        entity_id: switch.hallway_remote
  action:
    - choose:
    # If statement
      - conditions:
          - condition: template
            value_template: "{{ trigger.event.data.new_state.state == 'on' }}"
        sequence:
          - service: light.turn_on
            entity_id:
              - light.hallway_dimmer
      - conditions:
          - condition: template
            value_template: "{{ trigger.event.data.new_state.state == 'off' }}"
        sequence:
          - service: light.turn_off
            entity_id:
              - light.hallway_dimmer