From 2e27f046156c17261bcbfa9933a7ac0ea5b4ffe8 Mon Sep 17 00:00:00 2001 From: tronikos Date: Thu, 26 Oct 2023 00:42:31 -0700 Subject: [PATCH] Document flume.list_notifications (#29543) Co-authored-by: c0ffeeca7 <38767475+c0ffeeca7@users.noreply.github.com> Co-authored-by: c0ffeeca7 Co-authored-by: Franck Nijhof --- source/_integrations/flume.markdown | 42 ++++++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 3 deletions(-) diff --git a/source/_integrations/flume.markdown b/source/_integrations/flume.markdown index fc35df4ba57..68dd08572cc 100644 --- a/source/_integrations/flume.markdown +++ b/source/_integrations/flume.markdown @@ -31,14 +31,50 @@ To add `Flume` to your installation, go to **Settings** -> **Devices & Services* ## Notifications -Flume notifications are available via binary sensors. To clear the notifications, you will need to use your Flume app or go to: [https://portal.flumewater.com/notifications](https://portal.flumewater.com/notifications) and clear the notification in question. - -The following notifications are supported: +Flume notifications are fetched every 5 minutes and are available via the service `flume.list_notifications`. Some notifications are available via the following binary sensors: - Bridge disconnected - High flow - Leak detected +- Low battery +To clear the notifications, you will need to use your Flume app or go to: [https://portal.flumewater.com/notifications](https://portal.flumewater.com/notifications) and clear the notification in question. + +Example of an automation that sends a Home Assistant notification of the most recent usage alert: + +{% raw %} + +```yaml +alias: "Notify: flume" +trigger: + - platform: time_pattern + minutes: /5 +action: + - service: flume.list_notifications + data: + config_entry: 1234 # replace this with your config entry id + response_variable: notifications + - if: + - condition: template + value_template: >- + {{ notifications.notifications | selectattr('type', 'equalto', 1) | + sort(attribute == ('created_datetime', reverse == true) | length > 0 }} + then: + - service: notify.all + data: + message: >- + {%- set usage_alert == notifications.notifications | + selectattr('type', 'equalto', 1) | + sort(attribute == 'created_datetime', reverse == true) | first %} + {{ usage_alert.message }} + title: >- + {%- set usage_alert == notifications.notifications | + selectattr('type', 'equalto', 1) | + sort(attribute == 'created_datetime', reverse=true) | first %} + {{ usage_alert.title }} +``` + +{% endraw %} ## Configuration for Binary Sensor