gmlupatelli / blueprints_repo Goto Github PK
View Code? Open in Web Editor NEWLicense: GNU General Public License v3.0
License: GNU General Public License v3.0
Can't exclude all the entities linked to an area or device when executing automation from the following blueprints: unavailable_entities_notification and low_battery_notification.
As a workaround, I can expand the areas and the devices into entities inside the target selector.
Hey, thanks for the blueprint!!!
While looking through the code I stumbled over
Is the explicit second check for the unavailable
literal really required, as this is already part of the reject filter before? Did I miss something?
Thanks for a quick heads up. And thanks again for publishing!
hello, I have a problem, because notifications of unvailability entities are not received on my smartphone via telegram or mobile app using {{entities}} or {{ entities|replace('_', ' ') }}, how can I do to obtain my entities in notifications?
thank you
For unavailable_entities_notification.yaml
, you just have to change the end of variables
→ entities
from {{result.sensors|join(', ')}}
to {{result.entities|join('\n')}}
.
For unavailable_entities_notification.yaml
, you just have to change the end of variables
→ sensors
from {{result.sensors|join(', ')}}
to {{result.entities|join('\n')}}
.
I also implemented this.
Add this to the blueprint
→ input
:
exclude_regex:
name: Excluded Entities (Regex)
description: Entities to exclude from detection, using regex on entity IDs. One line per expression.
default: ""
selector:
text:
multiline: true
Add this to variables
:
exclude_regex: !input 'exclude_regex'
Replace variables
→ entities
with this:
entities: >-
{% set result = namespace(entities=[]) %}
{% for state in states %}
{% if state.state == 'unavailable' and
(not exclude.entity_id is defined or not state.entity_id in exclude.entity_id) and
(not exclude_regex.strip() or not state.entity_id is match(exclude_regex | replace('\n', '|'))) %}
{% set result.entities = result.entities + [state.name] %}
{% endif %}
{% endfor %}
{{ result.entities | sort | join('\n') }}
New behaviors besides: this will also join entities with newlines instead of comma and space (#4) and sort them alphabetically for display.
The automation template requires an action even when the user deselects the option to run the start or stop blocks.
When attempting to save the blueprint to my local HASS, I get an error stating: 'Message malformed: Missing input actions'.
You can simply paste in this modification by Pedolsky on the Home Assistant forums:
sensors: >-
{% set result = namespace(sensors=[]) %}
{% set exclude = [] %}
{% set threshold = 40 |int(0) %}
{% for state in states.sensor | selectattr('attributes.device_class', '==', 'battery') %}
{% if (0 <= state.state | int(-1) < threshold or state.state in ['unavailable', 'unknown', 'none']) and not state.entity_id in exclude.entity_id -%}
{% set result.sensors = result.sensors + [state.name ~ ' (' ~ state.state ~ ' %)'] %}
{% endif %}
{% endfor %}
{% for state in states.binary_sensor | selectattr('attributes.device_class', '==', 'battery') | selectattr('state', '==', 'on') %}
{% if not state.entity_id in exclude.entity_id -%}
{% set result.sensors = result.sensors + [state.name] %}
{% endif %}
{% endfor %}
{{result.sensors|join('\n') }}
I would go beyond this and do two more things:
You can do this by using this following one instead:
sensors: >-
{% set result = namespace(sensors=[]) %}
{% set exclude = [] %}
{% set threshold = 40 |int(0) %}
{% for state in states.sensor | selectattr('attributes.device_class', '==', 'battery') %}
{% if (0 <= state.state | int(-1) < threshold or state.state in ['unavailable', 'unknown', 'none']) and not state.entity_id in exclude.entity_id -%}
{% set result.sensors = result.sensors + [state.name ~ ' ' ~ (('(' ~ state.state ~ '%)') if state.state not in ['unavailable', 'unknown', 'none'] else ('(' ~ state.state ~ ')'))] %}
{% endif %}
{% endfor %}
{% for state in states.binary_sensor | selectattr('attributes.device_class', '==', 'battery') | selectattr('state', '==', 'on') %}
{% if not state.entity_id in exclude.entity_id -%}
{% set result.sensors = result.sensors + [state.name] %}
{% endif %}
{% endfor %}
{{ result.sensors | join('\n') }}
(This includes the newline separation as requested in #4)
Since I added it this Sunday, scheduled to run every day, it hasn't run since the first time.
Also, it doesn't report my Netatmo Valves when they have low battery.
When importing the simply_weekly_scheduler blueprint in Home Assistant no error is displayed, however, the automation created using it will not show on the Automation page, indicating that there is something wrong with the blueprint.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.