HA的 templates 页面指引
1、查看所有HA接入设备id及属性
在HA中的 templates 页面中输入以下代码:
{{ "_".ljust(90, "_") }}
{%- set domains = [states.alarm_control_panel,states.automation,states.binary_sensor,states.calendar,states.camera,states.climate,states.cover,states.device_tracker,states.fan,states.group,states.input_boolean,states.input_select,states.input_text,states.light,states.lock,states.media_player,states.person,states.proximity,states.remote,states.scene,states.script,states.sensor,states.sun,states.switch,states.timer,states.vacuum,states.weather,states.zone ] %}
{{ "Entity ID".ljust(50) }}{{ "Entity Name" }}
{{ "Attribute Name".ljust(50) }}{{ "Attribute Value" }}
{%- for domain in domains -%}
{% for item in domain %}
{{ "_".ljust(90, "_") }}
{{ item.entity_id.ljust(50) }}
{{ "State".ljust(50) }}: {{ item.state}}
{{ "Domain".ljust(50) }}: {{ item.domain}}
{{ "Object ID".ljust(50) }}: {{ item.object_id}}
{{ "Last Updated".ljust(50) }}: {{ item.last_updated}}
{{ "Last Changed".ljust(50) }}: {{ item.last_changed}}
{%- for attrib in item.attributes|sort() %}
{%- if attrib is defined %}
{{attrib.ljust(50)}}: {{ item.attributes[attrib] }}
{%- endif %}
{%- endfor %}
{%- endfor %}
{%- endfor %}
2、只查看所有HA接入设备id,不含属性
在HA中的 templates 页面中输入以下代码:
{%- set domains = [states.alarm_control_panel,states.automation,states.binary_sensor,states.calendar,states.camera,states.climate,states.cover,states.device_tracker,states.fan,states.group,states.input_boolean,states.input_select,states.input_text,states.light,states.lock,states.media_player,states.person,states.proximity,states.remote,states.scene,states.script,states.sensor,states.sun,states.switch,states.timer,states.vacuum,states.weather,states.zone ] %}
{{ "Entity ID".ljust(50) }} {{ "Entity Name" }}
{%- for domain in domains %}
{% for item in domain %}
{{ item.entity_id.ljust(50) }} {{ item.name }}
{%- endfor %}
{%- endfor %}
文档更新时间: 2020-10-08 20:33 作者:Tristan