Files
sarah/config/packages/devices/bathroom/bathroom_switch.yaml
T
2022-05-28 12:26:37 +03:00

43 lines
1.2 KiB
YAML

input_number:
bathroom_high_volume:
name: Bathroom high volume
mode: box
min: 0
max: 1
step: 0.05
icon: mdi:speaker
sensor:
- platform: mqtt
name: "Bathroom switch battery"
state_topic: "z2m_deconz/bathroom_switch"
availability_topic: "z2m_deconz/bridge/state"
unit_of_measurement: "%"
device_class: "battery"
value_template: "{{ value_json.battery }}"
- platform: mqtt
name: "Bathroom switch LQI"
state_topic: "z2m_deconz/bathroom_switch"
availability_topic: "z2m_deconz/bridge/state"
icon: "mdi:signal"
unit_of_measurement: "lqi"
value_template: "{{ value_json.linkquality }}"
automation:
- alias: Bathroom · Switch
use_blueprint:
path: aqara_switch.yaml
input:
z2m_topic: "z2m_deconz/bathroom_switch"
click:
- service: media_player.volume_set
entity_id: media_player.bathroom
data_template:
volume_level: >-
{% if state_attr('media_player.bathroom', 'volume_level')|float > (states('input_number.bathroom_high_volume')|float - 0.05) %}
0.25
{% else %}
{{ states('input_number.bathroom_high_volume')|float }}
{% endif %}