Files
sarah/packages/devices/bathroom/bathroom_switch.yaml
T
2022-12-01 16:02:00 +02:00

25 lines
745 B
YAML

input_number:
bathroom_high_volume:
name: Bathroom high volume
min: 0
max: 1
step: 0.05
icon: mdi:speaker
automation:
- alias: Bathroom · Switch
use_blueprint:
path: aqara_switch.yaml
input:
action_entity: sensor.bathroom_switch_action
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 %}