Simple and Effective Alerting

Sorry, yep, totally got it working now!


views:
  - title: test space
    sections:
      - type: grid
        layout:
          - grid-template-columns: 1fr
        cards:
          - type: conditional
            conditions:
              - condition: numeric_state
                entity: sensor.active_crit_alerts_count
                above: 0
            card:
              type: custom:auto-entities
              show_empty: true
              card:
                type: entities
                title: Active Critical Alerts
                card_mod:
                  style: |
                    ha-card {
                      background-color: red;
                      --primary-text-color: white;
                      --secondary-text-color: white;
                      --paper-item-icon-color: white;
                    }
              filter:
                include:
                  - entity_id: /^alert.*_crit_alert_active/
                    options:
                      secondary_info: last-changed
                exclude:
                  - state: 'off'
                  - state: idle
              sort:
                method: last_changed
                reverse: true
          - type: conditional
            conditions:
              - condition: numeric_state
                entity: sensor.active_warn_alerts_count
                above: 0
            card:
              type: custom:auto-entities
              show_empty: true
              card:
                type: entities
                title: Active Warning Alerts
                card_mod:
                  style: |
                    ha-card {
                      background-color: orange;
                      --primary-text-color: white;
                      --secondary-text-color: white;
                      --paper-item-icon-color: white;
                    }
              filter:
                include:
                  - entity_id: /^alert.*_warn_alert_active/
                    options:
                      secondary_info: last-changed
                exclude:
                  - state: 'off'
                  - state: idle
              sort:
                method: last_changed
                reverse: true
          - type: conditional
            conditions:
              - condition: numeric_state
                entity: sensor.active_info_alerts_count
                above: 0
            card:
              type: custom:auto-entities
              show_empty: true
              card:
                type: entities
                title: Active Information Alerts
                card_mod:
                  style: |
                    ha-card {
                      background-color: var(--app-header-background-color);
                      --primary-text-color: var(--app-header-text-color);
                      --secondary-text-color: var(--app-header-text-color);
                      --paper-item-icon-color: var(--app-header-text-color);
                    }
              filter:
                include:
                  - entity_id: /^alert.*_info_alert_active/
                    options:
                      secondary_info: last-changed
                exclude:
                  - state: 'off'
                  - state: idle
              sort:
                method: last_changed
                reverse: true
          - type: conditional
            conditions:
              - condition: numeric_state
                entity: sensor.acknowledged_alerts_count
                above: 0
            card:
              type: custom:auto-entities
              show_empty: true
              card:
                type: entities
                title: Acknowledged Alerts
                card_mod:
                  style: |
                    ha-card {
                      background-color: var(--app-header-background-color);
                      --primary-text-color: var(--app-header-text-color);
                      --secondary-text-color: var(--app-header-text-color);
                      --paper-item-icon-color: var(--app-header-text-color);
                    }
              filter:
                include:
                  - domain: alert
                    options:
                      secondary_info: last-changed
                exclude:
                  - state: 'on'
                  - state: idle
              sort:
                method: last_changed
                reverse: true
          - type: conditional
            conditions:
              - condition: numeric_state
                entity: sensor.water_issues_count
                above: 0
            card:
              type: custom:auto-entities
              show_empty: true
              card:
                type: entities
                title: Water Issues
                card_mod:
                  style: |
                    ha-card {
                      background-color: red;
                      --primary-text-color: white;
                      --secondary-text-color: white;
                      --paper-item-icon-color: white;
                    }
              filter:
                include:
                  - attributes:
                      device_class: moisture
                    options:
                      secondary_info: last-changed
                exclude:
                  - state: 'off'
                  - state: unavailable
                  - state: unknown
                  - entity_id: '*weather*'
          - type: conditional
            conditions:
              - condition: numeric_state
                entity: sensor.tech_issues_count
                above: 0
            card:
              type: custom:auto-entities
              show_empty: true
              card:
                type: entities
                title: Tech Issues
                card_mod:
                  style: |
                    ha-card {
                      background-color: orange;
                      --primary-text-color: white;
                      --secondary-text-color: white;
                      --paper-item-icon-color: white;
                    }
              filter:
                include:
                  - group: group.network_devices
                    options:
                      secondary_info: last-changed
                  - group: group.server_devices
                    options:
                      secondary_info: last-changed
                  - group: group.wan_devices
                    options:
                      secondary_info: last-changed
                exclude:
                  - state: 'on'
                  - state: unavailable
          - type: conditional
            conditions:
              - condition: numeric_state
                entity: sensor.information_count
                above: 0
            card:
              type: custom:auto-entities
              show_empty: true
              card:
                type: entities
                title: Information
                card_mod:
                  style: |
                    ha-card {
                      background-color: var(--app-header-background-color);
                      --primary-text-color: var(--app-header-text-color);
                      --secondary-text-color: var(--app-header-text-color);
                      --paper-item-icon-color: var(--app-header-text-color);
                    }
              filter:
                template: |
                  {{
                    expand('group.device_uptimes') 
                    | selectattr('state', 'match', '[0-9]+ [0-9]+ [Mm]inutes') 
                    | map(attribute='entity_id') 
                    | list 
                  }}
          - type: conditional
            conditions:
              - condition: state
                entity: input_boolean.show_possible_issues
                state: 'on'
            card:
              type: custom:auto-entities
              show_empty: false
              card:
                type: entities
                title: Possible Issues
                show_header_toggle: false
                card_mod:
                  style: |
                    ha-card {
                      background-color: var(--app-header-background-color);
                      --primary-text-color: var(--app-header-text-color);
                      --secondary-text-color: var(--app-header-text-color);
                      --paper-item-icon-color: var(--app-header-text-color);
                    }
              filter:
                include:
                  - state: unknown
                  - state: unavailable
                exclude:
                  - entity_id: device_tracker.*
      - type: grid
        cards:
          - type: heading
            heading: First Section
          - type: entities
            entities:
              - input_boolean.show_possible_issues
          - type: markdown
            content: Other content here
1 Like

I now have whole additional month under my belt (2 months total now

:upside_down_face: ) I have a thought on making it into a Blueprint…

Entity creation/deletion would be inside a script, which is called from the Blueprint’s action.

As you noted using @Blacky :round_pushpin: State Notifications & Actions - Blueprints Exchange - Home Assistant Community … maybe you could collaborate given his expertise in making BPs, and yours in scripting this all together… thus create an Alerts specific BP.

Coming from using several other commercial automations systems over the past 20 years, Alerting and Notifications in HA needs a lot of work and methods like you have designed, and BPs like @Blacky has made, are far more appreciated than I think you may know!

Id like a way to automatically create a notification group - let me notifiy all devices

Are you looking for something different than what is described in the Notification Group Setup in the instructions above?

Yes, in the example you have to explicitly define the various phones that are in a group. I’d love to be able to do a notification to all mobile_app, or a notification to every device that can recieve a notification. (like send to all mobileapps, pushbullet, kodi, google home, etc).

I know I am replying to old post but it might help someone.

Essentially you need to snapshot the media player (and volume), set the TTS (notification) volume, play the TTS message, and then put everything back. This will vary by what you are using for media players and sources, however as an example I did a write-up on my own setup here.

One thing I am particularly proud of is the dynamic setting of volume based on the hour of the day. :smiley:

Have a look at GitHub - Grumblezz/Home-Assistant-Notify-Mobile-Companion-App-Devices: Struggling to make use of the notification options of the Home Assistant Companion App on your mobile device? Then this script can help you in the right direction.

The variable definition for ‘all_devices’ includes code to get all the mobile devices.

Hi,
Looks nice… Can you share your yaml project? Especially for actionable notify.
Will be appreciate …

Thanks Andy

1 Like
1 Like

Hi.
Great work…… :+1:t2: and thank you for that.
Will try to implement it in my gates automation soon.

One more thing……. So you not using alert integration (alert.yaml) at all?

Thanks

1 Like

No, because my snooze actions are more nuanced than what it provides. You can also have a look at the Alert2 custom integration.

1 Like

you might be interested in the fact auto-entities is full speed again, and maybe use it for your messaging system