Trigger light when receiving Whatsapp Or Facebook Message?

its working perfectly.

If anyone else wants to re-create this ill post the final setup here.
You need to change the following bits to match your own:

  • sensor.sm_a520f_last_notification <— the phone that You are using
  • person 1 and person 2 <— names of the people on your facebook
  • entity_id: light.wled <— the light you are using
alias: Facebook Notification Per Person
description: Adds a individual colour representation to your facebook friends
trigger:
  - platform: state
    entity_id: sensor.sm_a520f_last_notification
    for:
      hours: 0
      minutes: 0
      seconds: 0
condition:
  - condition: template
    value_template: |-
      {% set pk = state_attr('sensor.sm_a520f_last_notification','package') %}
      {{ 'com.facebook.orca' in pk }}
action:
  - choose:
      - conditions:
          - condition: template
            value_template: >-
              {{ 'Person 1' in
              state_attr('sensor.sm_a520f_last_notification','android.title') }}
        sequence:
          - service: light.turn_on
            target:
              entity_id: light.wled
            data:
              rgb_color:
                - 255
                - 255
                - 0
              brightness_pct: 100
              effect: Sine
          - delay:
              hours: 0
              minutes: 0
              seconds: 2
              milliseconds: 0
          - service: light.turn_off
            target:
              entity_id: light.wled
      - conditions:
          - condition: template
            value_template: >-
              {{ 'Person 2' in
              state_attr('sensor.sm_a520f_last_notification','android.title') }}
        sequence:
          - service: light.turn_on
            target:
              entity_id: light.wled
            data:
              rgb_color:
                - 0
                - 255
                - 255
              brightness_pct: 100
              effect: Sine
          - delay:
              hours: 0
              minutes: 0
              seconds: 2
              milliseconds: 0
          - service: light.turn_off
            target:
              entity_id: light.wled
    default: []
mode: single


2 Likes

Is something like this also possible with iOS? Thanks!

Awesome guys! Thank you so much!

So I was doing something similar and actually also got it working. However, I want the light to remain on until the (in my case whatsapp) notifications are cleared. To do so I wanted to check the ****_active_notification_count sensor, and look at it’s state attributes. However, I’m not entirely sure on what to look for. Therefore, I was hoping to scan all the attribute names as well as attribute values for the string ‘whatsapp’, and if it does not exist, clear the light. However, I’m not sure on how to achieve this. Is there anyone that could point me in the right direction?

so I hope someone can help me with this I got this code but it docent work thanks in advances and sorry for the necro

alias: Whatsap Notification Per Person
description: Adds a individual colour representation to your facebook friends
trigger:
  - platform: state
    entity_id: sensor.a_fold_4_last_notification
    for:
      hours: 0
      minutes: 0
      seconds: 0
condition:
  - condition: template
    value_template: |-
      {% set pk = state_attr('sensor.a_fold_4_last_notification','package') %}
      {{ 'com.whatsapp' in pk }}
action:
  - choose:
      - conditions:
          - condition: template
            value_template: >-
              {{ 'Mouk' in
              state_attr('sensor.a_fold_4_last_notification','android.title') }}
        sequence:
          - service: light.turn_on
            target:
              entity_id: light.wled
            data:
              rgb_color:
                - 255
                - 255
                - 0
              brightness_pct: 100
              effect: Sine
          - delay:
              hours: 0
              minutes: 0
              seconds: 2
              milliseconds: 0
          - service: light.turn_off
            target:
              entity_id: light.wled
            data: {}
      - conditions:
          - condition: template
            value_template: >-
              {{ 'Mom' in
              state_attr('sensor.a_fold_4_last_notification','android.title') }}
        sequence:
          - service: light.turn_on
            target:
              entity_id: light.wled
            data:
              rgb_color:
                - 255
                - 0
                - 255
              brightness_pct: 100
              effect: Sine
          - delay:
              hours: 0
              minutes: 0
              seconds: 2
              milliseconds: 0
          - service: light.turn_off
            target:
              entity_id: light.wled
            data: {}
    default: []
mode: single