updating configuration
This commit is contained in:
+103
@@ -0,0 +1,103 @@
|
||||
blueprint:
|
||||
name: Unavailable entity detection & notification
|
||||
description: Regularly test all entities' status to check for unavailability.
|
||||
domain: automation
|
||||
source_url: https://github.com/gmlupatelli/blueprints_repo/blob/master/unavailable_entities_notification/unavailable_entities_notification.yaml
|
||||
input:
|
||||
time:
|
||||
name: Time to test on
|
||||
description: Test is run at configured time
|
||||
default: '10:00:00'
|
||||
selector:
|
||||
time: {}
|
||||
monday_enabled:
|
||||
name: Monday
|
||||
description: Run test on Monday
|
||||
default: true
|
||||
selector:
|
||||
boolean: {}
|
||||
tuesday_enabled:
|
||||
name: Tuesday
|
||||
description: Run test on Tuesday
|
||||
default: true
|
||||
selector:
|
||||
boolean: {}
|
||||
wednesday_enabled:
|
||||
name: Wednesday
|
||||
description: Run test on Wednesday
|
||||
default: true
|
||||
selector:
|
||||
boolean: {}
|
||||
thursday_enabled:
|
||||
name: Thursday
|
||||
description: Run test on Thursday
|
||||
default: true
|
||||
selector:
|
||||
boolean: {}
|
||||
friday_enabled:
|
||||
name: Friday
|
||||
description: Run test on Friday
|
||||
default: true
|
||||
selector:
|
||||
boolean: {}
|
||||
saturday_enabled:
|
||||
name: Saturday
|
||||
description: Run test on Saturday
|
||||
default: true
|
||||
selector:
|
||||
boolean: {}
|
||||
sunday_enabled:
|
||||
name: Sunday
|
||||
description: Run test on Sunday
|
||||
default: true
|
||||
selector:
|
||||
boolean: {}
|
||||
exclude:
|
||||
name: Excluded Entities
|
||||
description: Entities (e.g. smartphone) to exclude from detection. Only entities
|
||||
and devices are supported, areas must be expanded!
|
||||
default: {}
|
||||
selector:
|
||||
target: {}
|
||||
actions:
|
||||
name: Actions
|
||||
description: Notifications or similar to be run. {{entities}} is replaced with
|
||||
the names of unavailable entities.
|
||||
selector:
|
||||
action: {}
|
||||
variables:
|
||||
monday_enabled: !input monday_enabled
|
||||
tuesday_enabled: !input tuesday_enabled
|
||||
wednesday_enabled: !input wednesday_enabled
|
||||
thursday_enabled: !input thursday_enabled
|
||||
friday_enabled: !input friday_enabled
|
||||
saturday_enabled: !input saturday_enabled
|
||||
sunday_enabled: !input sunday_enabled
|
||||
current_day: '{{ now().weekday() | int }}'
|
||||
exclude: !input exclude
|
||||
entities: "{% set result = namespace(includedEntities=[], excludedEntities = [])
|
||||
%}\n{% if exclude.entity_id is defined %} \n {% set result.excludedEntities
|
||||
= result.excludedEntities + exclude.entity_id %}\n{% endif %}\n{% if exclude.device_id
|
||||
is defined %}\n {% for device_id in exclude.device_id %}\n {% set result.excludedEntities
|
||||
= result.excludedEntities + device_entities(device_id) %}\n {% endfor %}\n{%
|
||||
endif %}\n{% for state in states | selectattr('state', 'eq', 'unavailable') %}\n
|
||||
\ {% if state.state == 'unavailable' and not state.entity_id in result.excludedEntities
|
||||
%}\n {% set result.includedEntities = result.includedEntities + [state.name]
|
||||
%}\n {% endif %}\n{% endfor %}\n{{\"⤵ \\n- \"}}{{result.includedEntities|join('\\n-
|
||||
')}}"
|
||||
trigger:
|
||||
- platform: time
|
||||
at: !input time
|
||||
condition:
|
||||
- condition: template
|
||||
value_template: "{{ \n (current_day == 0 and monday_enabled) or \n (current_day
|
||||
== 1 and tuesday_enabled) or \n (current_day == 2 and wednesday_enabled) or\n
|
||||
\ (current_day == 3 and thursday_enabled) or \n (current_day == 4 and friday_enabled)
|
||||
or\n (current_day == 5 and saturday_enabled) or\n (current_day == 6 and sunday_enabled)\n}}"
|
||||
- condition: template
|
||||
value_template: '{{ entities != "⤵ \n-"}}'
|
||||
action:
|
||||
- choose: []
|
||||
default: !input actions
|
||||
mode: single
|
||||
max_exceeded: silent
|
||||
Reference in New Issue
Block a user