mirror of
https://github.com/CCOSTAN/Home-AssistantConfig.git
synced 2025-08-18 11:16:37 +00:00
Closes #111 added device tracker package.
This commit is contained in:
34
packages/Network_monitor
Executable file
34
packages/Network_monitor
Executable file
@@ -0,0 +1,34 @@
|
||||
################################################################
|
||||
## Packages / Network Devices
|
||||
################################################################
|
||||
|
||||
{% set group = states.group.network_devices -%}
|
||||
{%- set templateGroup = 'network_devices_template' -%}
|
||||
{%- set entities = group.attributes.entity_id -%}
|
||||
group:
|
||||
{{ group.entity_id.split('.')[1] }}:
|
||||
name: "{{ group.name }}"
|
||||
# This is invalid for the group component: hidden: true
|
||||
entities:
|
||||
{% for entity_id in entities -%}
|
||||
- {{ entity_id }}
|
||||
{% endfor %}
|
||||
{{ templateGroup }}:
|
||||
name: "{{ group.name }}"
|
||||
entities:
|
||||
{% for entity_id in entities -%}
|
||||
- {{ ('sensor.' ~ entity_id.split('.')[1] ~ '_template') if entity_id.split('.')[0] == 'device_tracker' else entity_id }}
|
||||
{% endfor %}
|
||||
|
||||
{%- set newline = joiner("\n ") %}
|
||||
sensor:
|
||||
- platform: template
|
||||
sensors:
|
||||
{% for entity_id in entities if entity_id.split('.')[0] == 'device_tracker' -%}
|
||||
{{ newline() }}
|
||||
{%- set entity = states[entity_id.split('.')[0]][entity_id.split('.')[1]] -%}
|
||||
{{- entity_id.split('.')[1] }}_template:
|
||||
friendly_name: "{{ entity.name }}"
|
||||
value_template: "{{ '{{' }} 'online' if is_state('{{ entity_id }}', 'home') else 'offline' {{ '}}' }}"
|
||||
icon_template: "{{ '{{' }} 'mdi:check-circle' if is_state('{{ entity_id }}', 'home') else 'mdi:alert-circle' {{ '}}' }}"
|
||||
{% endfor %}
|
Reference in New Issue
Block a user