mirror of
https://github.com/CCOSTAN/Home-AssistantConfig.git
synced 2025-02-19 07:47:27 +00:00
Closes #111 added device tracker package.
This commit is contained in:
parent
10a1210d58
commit
80c8e4ea08
@ -6,6 +6,7 @@ homeassistant:
|
||||
unit_system: imperial
|
||||
time_zone: America/New_York
|
||||
customize: !include_dir_merge_named customize
|
||||
packages: !include_dir_named packages
|
||||
|
||||
http:
|
||||
base_url: !secret http_base_url
|
||||
|
@ -417,7 +417,7 @@ sensor.since_last_boot:
|
||||
|
||||
|
||||
sensor.since_last_boot_templated:
|
||||
friendly_name: 'Homeassistant Uptime'
|
||||
friendly_name: 'Raspberry Pi Uptime'
|
||||
emulated_hue: False
|
||||
hidden: False
|
||||
icon: mdi:clock-start
|
||||
|
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 %}
|
Loading…
x
Reference in New Issue
Block a user