Send notification when a specific user turns on the light

Hello everyone,
I’ve been trying for a few days to create an automation that would send me a notification when a user turns on a light, for example.

Unfortunately, I can’t figure it out!

I searched the forum for the same question but I didn’t find anything about it.

logical scheme:
JOHN TURN ON LIVING LIGHT > SEND A NOTIFICATION TO STEVE

Look at context.

This used to a WTH subject and yes it would be nice to have this more in GUI or a simpler way.
But take a look at:

That and the discussion there should help out.

1 Like

I read the suggested.

I tried to create a test automation but doesn’t work

triggers:
  - trigger: state
    entity_id:
      - light.living
    from:
      - "off"
    to:
      - "on"
conditions:
  - condition: template
    value_template: "{{ trigger.to_state.context.user_id == ddxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx7285 }}"
actions:
  - action: notify.mobile_app_sm_a528b
    metadata: {}
    data:
      message: >-
        living light change state from off to on

You need quotes around the string.

value_template: "{{ trigger.to_state.context.user_id == 'ddxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx7285' }}"
1 Like

I posted the message. And then I realized the quotas were missing.

With the quote It seems to work