home-assistant-configuration/config/sensors/power.yaml

68 lines
2.0 KiB
YAML
Executable File

- platform: mqtt
name: "Washer"
state_topic: "zwave2mqtt/washer/50/1/0"
device_class: "power"
unit_of_measurement: "kWh"
- platform: mqtt
name: "Washer Power 1"
state_topic: "zwave2mqtt/washer/49/1/4"
device_class: "power"
unit_of_measurement: "W"
- platform: mqtt
name: "Washer_Power 2"
state_topic: "zwave2mqtt/washer/50/1/2"
device_class: "power"
unit_of_measurement: "W"
- platform: mqtt
name: "Washer Power"
state_topic: "zwave2mqtt/washer/50/1/9"
device_class: "power"
unit_of_measurement: "W"
- platform: mqtt
name: "Washer Power kwh"
state_topic: "zwave2mqtt/washer/50/1/1"
device_class: "power"
unit_of_measurement: "kWh"
# zooz
- platform: mqtt
name: "theater light up"
state_topic: "zwave2mqtt/theater/91/1/1"
- platform: mqtt
name: "theater light down"
state_topic: "zwave2mqtt/theater/91/1/2"
- platform: template
sensors:
# washer_power:
# friendly_name: "Washer Power"
# entity_id: sensor.time
# unit_of_measurement: ''
# value_template: >-
# {{ states.switch.washer.attributes.current_power_w | int }}
low_battery:
friendly_name: 'Low Battery'
entity_id: sensor.time
value_template: >
{%- set threshold = 15 -%}
{%- set domains = ['light', 'switch', 'sensor', 'zwave', 'lock', 'binary_sensor'] -%}
{%- for domain in domains -%}
{%- for item in states[domain] if ((item.attributes.battery_level is defined and item.attributes['battery_level'] | int < threshold) or ("battery" in item.name | lower and ((item.state | int < threshold and item.state|int != 0) or item.state | lower == "low" or item.state | lower == "unknown"))) -%}
{{ item.attributes.friendly_name }} (
{%- if item.attributes.battery_level is defined -%}
{{ item.attributes.battery_level}}
{%- else -%}
{{item.state}}
{%- endif -%}%)
{%- if not loop.last -%}
{{', '}}
{%- endif -%}
{%- endfor -%}
{%- endfor -%}