Giter Site home page Giter Site logo

blueprints_repo's People

Contributors

gmlupatelli avatar jimmyfortinx avatar xamadevp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

blueprints_repo's Issues

Can't exclude all entities linked to an area or device

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.

Additional availability check required?

Hey, thanks for the blueprint!!!

While looking through the code I stumbled over

{% for state in states | selectattr('state', 'eq', 'unavailable') %}
{% if state.state == 'unavailable' and not state.entity_id in result.excludedEntities %}

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!

Notifications missed!

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

Make entities separated by newline instead of comma and space for readability

For unavailable_entities_notification.yaml, you just have to change the end of variablesentities from {{result.sensors|join(', ')}} to {{result.entities|join('\n')}}.

For unavailable_entities_notification.yaml, you just have to change the end of variablessensors from {{result.sensors|join(', ')}} to {{result.entities|join('\n')}}.

(Feature) Add ability to use regex to exclude entities

I also implemented this.

Add this to the blueprintinput:

    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 variablesentities 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.

Newbie question

Sorry for the dumb question - I would REALY love to use this blueprint, but what do I add here to get the sensors data?

image

Thanks

Tony

Include unavailable entities for Low Battery Detection (it being the final stage of a low battery)

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:

  1. Get rid of the space in front of the percentage sign, it's unnecessary.
  2. Don't show the percentage sign if the state is unavailable/unknown (i.e. not a number).

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)

[Low Battery]

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.

simply_weekly_scheduler not working

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.