Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Template will not exclude browser_mod domain #51

Open
dnestico opened this issue Apr 27, 2024 · 1 comment
Open

Template will not exclude browser_mod domain #51

dnestico opened this issue Apr 27, 2024 · 1 comment

Comments

@dnestico
Copy link

dnestico commented Apr 27, 2024

All Im trying to do is create a sensor that will count the number of offline devices but I don't need many of them including browser_mod which has a ton of entities, I tried this code but still all the browser_mod sensors and media_players still show in the template sensor under developer tools test page, please help. Thanks.

Screenshot 2024-04-27 at 1 49 14 AM Screenshot 2024-04-27 at 1 49 25 AM
                {% set ignore_seconds = 60 %}
                {% set ignored = state_attr('group.ignored_unavailable_entities','entity_id') %}
                {% set ignore_ts = (now().timestamp() - ignore_seconds)|as_datetime %}
                {% set entities = states
                    |rejectattr('domain','in',['button','event','group','input_button','input_text','scene', 'binary_sensor', 'device_tracker', 'select', 'todo', 'browser_mod' ])
                    |rejectattr('entity_id','search','browser_')      
                    |rejectattr('entity_id','search','_alarm_volume|_next_alarm|_alarms')
                    |rejectattr('entity_id','contains','_memory_percent')
                    |rejectattr('entity_id','in', integration_entities('hassio'))
                    |rejectattr('entity_id', 'in', integration_entities('browser_mod'))
                    |rejectattr('last_changed','ge',ignore_ts) %}
                {% set entities =  entities|rejectattr('entity_id','in',ignored) if ignored != none else entities %}
                {{ entities|map(attribute='entity_id')|reject('has_value')|list|sort }}
@jazzyisj
Copy link
Owner

jazzyisj commented Apr 28, 2024

I'm betting those are all orphaned entities that no longer belong to the browser_mod integration. After a while an integration drops unavailable entities. You can tell when this happens when you can delete the entity from the front end. If they don't belong to devices you normally use you just delete them.

image

In my own case, I've had browser_mod name all my devices so I can filter out entities for any of those devices. The side effect of that being that they aren't monitored at all by this template which is fine for me because they always go unknown/unavailable when the devices isn't on and I don't need to know about it.

| rejectattr('entity_id', 'search', 'jphone_app|jtablet_app|jlaptop_chrome|jwork_chrome)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants