iOS actionable notification

Hi guys,

the automation makes the check of total power consumption and if above 3500w all the wemo switches are turned off. Then a message reaches my iPhone asking which switch I’l like to turn on.

The issue I’m facing is that I receive the message but without any multiple selection. Just the message with no switch choice
Do you have any idea where I’ve done any mistake?

My files:

automations.yaml:

- id: wemo_superano_soglia
  alias: Wemo superano soglia
  initial_state: true
  hide_entity: false
  trigger:
  - above: '3500'
    entity_id: sensor.tot_current_power
    platform: numeric_state
  action:
    - service: homeassistant.turn_off
      entity_id: switch.lavastoviglie
    - service: homeassistant.turn_off
      entity_id: switch.lavatrice
    - service: homeassistant.turn_off
      entity_id: switch.forno
    - service: notify.notify
      data:
        title: "Attenzione:"
        message: "superato il consumo consentito, cosa vuoi ri-accendere?"
        data:
          push:
            badge: 0
            category: 'SCELTAWEMO'

ios.yaml:

push:
  categories:
    - name: sceltawemo
      identifier: 'SCELTAWEMO'
      actions:
        - identifier: 'LAVATRICE_ON'
          title: 'Accendi lavatrice'
        - identifier: 'LAVASTOVIGLIE_ON'
          title: 'Accendi lavastoviglie'
        - identifier: 'FORNO_ON'
          title: 'Accendi forno'

configuration.yaml:

#iOS
ios: !include ios.yaml

Thank you!

The action is normally

      service: notify.ios_<your_device_id_here>

but I see yours is

    - service: notify.notify

Did you create a notification group?
I can’t see otherwise what could be wrong…

Hi lolouk44,

with notify.notify every iPhones receive the notifications.
That works.
Anyway I’ve tried also your suggest with no results (notify.ios_<your_device_id_here>)

Thanks

thanks.

Then I really don’t know why it’s not working.
Have a look at my files in case you spot something I’ve missed…


1 Like

Thank you for sharing. I check and let you know

Thank you lolouk44, I’ve checked your files and find out that I’ve done some small mistakes in code writing.
Plus I’ve understood from your GitHub how to split automation files into folder.
Thank you!

Great stuff. Care to share what was wrong?

There were mistakes on the use of hyphen [-]
Now is in this way:

configuration.yaml

automation: !include_dir_merge_list automation/
ios: !include ios.yaml

iOS.yaml

push:
  categories:
    - name: Sceltawemo
      identifier: 'sceltawemo'
      actions:
        - identifier: 'LAVATRICE_ON'
          title: 'Accendi lavatrice'
          activationMode: 'background'
          authenticationRequired: yes
          destructive: yes
          behavior: 'default'
        - identifier: 'LAVASTOVIGLIE_ON'
          title: 'Accendi lavastoviglie'
          activationMode: 'background'
          authenticationRequired: yes
          destructive: yes
          behavior: 'default'
        - identifier: 'FORNO_ON'
          title: 'Accendi forno'
          activationMode: 'background'
          authenticationRequired: yes
          destructive: yes
          behavior: 'default'

\automation\ios.yaml

#- id: wemo_superano_soglia
- alias: Wemo superano soglia
#  initial_state: true
#  hide_entity: false
  trigger:
    platform: numeric_state
    entity_id: sensor.tot_current_power
    above: '3500'
  action:
    - service: homeassistant.turn_off
      entity_id: switch.lavastoviglie
    - service: homeassistant.turn_off
      entity_id: switch.lavatrice
    - service: homeassistant.turn_off
      entity_id: switch.forno
    - service: notify.notify
      data:
        title: "Attenzione:"
        message: "superato il consumo consentito, cosa vuoi ri-accendere?"
        data:
          push:
            badge: 0
            category: "sceltawemo"

#- id: wemo_superano_soglia_con_TV
- alias: Wemo superano soglia con TV
#  initial_state: true
#  hide_entity: false
  trigger:
    platform: numeric_state
    entity_id: sensor.tot_current_power
    above: '3200'
  condition:
    condition: and
    conditions:
      condition: state
      entity_id: switch.switch_tv
      state: 'on'
  action:
    - service: homeassistant.turn_off
      entity_id: switch.lavastoviglie
    - service: homeassistant.turn_off
      entity_id: switch.lavatrice
    - service: homeassistant.turn_off
      entity_id: switch.forno
    - service: notify.notify
      data:
        title: "Attenzione:"
        message: "superato il consumo consentito, cosa vuoi ri-accendere?"
        data:
          push:
            badge: 0
            category: "sceltawemo"

#- id: wemo_superano_soglia_con_KODI
- alias: Wemo superano soglia con KODI
#  initial_state: true
#  hide_entity: false
  trigger:
    platform: numeric_state
    entity_id: sensor.tot_current_power
    above: '3200'
  condition:
    condition: and
    conditions:
      condition: state
      entity_id: switch.switch_kodi
      state: 'on'
  action:
    - service: homeassistant.turn_off
      entity_id: switch.lavastoviglie
    - service: homeassistant.turn_off
      entity_id: switch.lavatrice
    - service: homeassistant.turn_off
      entity_id: switch.forno
    - service: notify.notify
      data:
        title: "Attenzione:"
        message: "superato il consumo consentito, cosa vuoi ri-accendere?"
        data:
          push:
            badge: 0
            category: "sceltawemo"

#- id: accendi_lavatrice
- alias: Accendi lavatrice
#  initial_state: true
#  hide_entity: false
  trigger:
    platform: event
    event_type: ios.notification_action_fired
    event_data:
      actionName: LAVATRICE_ON
  action:
    service: homeassistant.turn_on
    entity_id: switch.lavatrice

#- id: accendi_lavastoviglie
- alias: Accendi lavastoviglie
#  initial_state: true
#  hide_entity: false
  trigger:
    platform: event
    event_type: ios.notification_action_fired
    event_data:
      actionName: LAVASTOVIGLIE_ON
  action:
    service: homeassistant.turn_on
    entity_id: switch.lavastoviglie

#- id: accendi_forno
- alias: Accendi forno
#  initial_state: true
#  hide_entity: false
  trigger:
    platform: event
    event_type: ios.notification_action_fired
    event_data:
      actionName: FORNO_ON
  action:
    service: homeassistant.turn_on
    entity_id: switch.forno

Thanks again

1 Like

Ah the freaking hyphens :joy: