54 lines
1.1 KiB
YAML
54 lines
1.1 KiB
YAML
# ===== Web UI / HA Entities =====
|
|
|
|
script:
|
|
- id: publish_current_time
|
|
then:
|
|
- lambda: |-
|
|
auto time_now = id(homeassistant_time).now();
|
|
id(current_time_sensor).publish_state(time_now.strftime("%H:%M"));
|
|
|
|
time:
|
|
- platform: homeassistant
|
|
id: homeassistant_time
|
|
on_time_sync:
|
|
- script.execute: publish_current_time
|
|
on_time:
|
|
- seconds: 0
|
|
minutes: /1
|
|
then:
|
|
- script.execute: publish_current_time
|
|
|
|
text_sensor:
|
|
- platform: template
|
|
name: "Current device time"
|
|
id: current_time_sensor
|
|
icon: mdi:clock
|
|
|
|
number:
|
|
- platform: template
|
|
name: "Volume"
|
|
id: volume_number
|
|
icon: mdi:volume-high
|
|
entity_category: config
|
|
min_value: 0
|
|
max_value: 100
|
|
step: 5
|
|
unit_of_measurement: "%"
|
|
lambda: return id(volume_level) * 100.0f;
|
|
set_action:
|
|
- lambda: |-
|
|
float vol = x / 100.0f;
|
|
id(volume_level) = vol;
|
|
id(spk).set_volume(vol);
|
|
|
|
select:
|
|
- platform: logger
|
|
name: "Logger Level"
|
|
disabled_by_default: true
|
|
|
|
button:
|
|
- platform: restart
|
|
name: "Restart"
|
|
icon: mdi:restart
|
|
entity_category: config
|