Actionable notification to turn off lights

I am trying to get a notification that will run if specific lights are on at a specific time (that part is working)

The only part I can’t get to work, is to get the actionable notification to work. I want a simple notification with a button to “turn off” the lights.

But whatever I put and tried in the “data” section. I can’t get any button to turn off the light.

Does someone has a example to run a “call service” in a actionable notification?

An actionable notification emits an event for which you will then create an automation to react accordingly.

Yes I tried to do that, but without any succes.

alias: test
description: ""
  - platform: state
      - light.bedroom
    to: "on"
  - condition: sun
    before: sunset
    after: sunrise
  - service: notify.mobile_app_samsung
      message: lights still on
      title: bedroom
          - action: TURN_OFF
            title: Turn off lights
  - wait_for_trigger:
      - platform: event
        event_type: mobile_app_notification_action
          action: TURN_OFF
      hours: 0
      minutes: 1
      seconds: 0
      milliseconds: 0
  - type: turn_off
    device_id: df09843a801c6cb2101983a7ac
    entity_id: afc822c2e7503c51131203f4cd8
    domain: light
mode: single

Your trigger is the lights turning on. If you want to send a notification if this lights are on at a certain time then your trigger needs to be the time and condition should be lights are on.

But if I delete the trigger part, and only run the action. The light wont turn off, and also I don’t receive the last notification.

So the trigger is not the problem here. For now I turn on the light manually, just to check if the actionable notification works, but that doesn’t work.

What does your trace show?

Do you get other HA notifications?

That gives a older trace (from yesterday)

But if I just simplefy the automation that I just want to receive a message when the actionable notification button is pressed. It still won’t work

If I use the code below, en just run the automation. I imidiatly receive both messages. I just want to receive the message, only when de actionable notification button is pressed.

alias: test
description: ""
trigger: []
condition: []
  - service: notify.mobile_app_oneplus
      message: Lampen nog aan
          - action: uit
            title: Zet lampen uit
  - event: mobile_app_notification_action
      action: uit
  - service: notify.mobile_app_oneplus
      message: Lampen zijn uit
mode: single

One thing at a time.

Go back to what you had. Trigger it normally (i.e. by switching your test light on). Share the trace of what’s happening here. And check your logs. Don’t run the automation manually.

One sensible change for the previous version is to split that automation: one for sending the first notification and one to trigger on the actionable notification event. But, don’t do that just yet. One thing at a time.

This last version will.of course send the notifications I quick succession: that is what it’s set to do. There’s nothing that will make it wait.

BTW, instead of a test light you can also use an input boolean. It’s more convenient.