-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrotelmini.yaml
99 lines (85 loc) · 2.06 KB
/
rotelmini.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
esphome:
name: rotelmini
friendly_name: rotelmini
includes:
- uart_read_line_sensor.h
esp32:
board: esp32-c3-devkitm-1
framework:
type: arduino
# Enable logging
logger:
baud_rate: 0 #disable logging over uart
uart:
id: uart_bus
rx_pin: GPIO20
tx_pin: GPIO21
baud_rate: 115200
debug:
direction: BOTH
dummy_receiver: false
after:
delimiter: "\n"
sequence:
- lambda: UARTDebug::log_string(direction, bytes);
text_sensor:
- platform: custom
lambda: |-
auto my_custom_sensor = new UartReadLineSensor(id(uart_bus));
App.register_component(my_custom_sensor);
return {my_custom_sensor->volume, my_custom_sensor->input, my_custom_sensor->raw_data};
text_sensors:
- id: "volume"
name: "Volume"
- id: "input"
name: "Input"
- id: "raw_data"
name: "Raw serial data" # Geen naam, dan wordt hij niet zichtbaar in HA
button:
- platform: template
name: "Vol Up"
icon: "mdi:volume-plus"
on_press:
- uart.write: "vol_up!"
- platform: template
name: "Vol Down"
icon: "mdi:volume-minus"
on_press:
- uart.write: "vol_dwn!"
- platform: template
name: "Get source"
icon: "mdi:audio-input-rca"
on_press:
- uart.write: "source?"
switch:
- platform: template
name: "Power"
icon: "mdi:audio-video"
lambda: |-
if (id(raw_data).state == "power=on") {
return true;
} else if(id(raw_data).state == "power=standby") {
return false;
} else {
return {};
}
turn_on_action:
- uart.write: "power_on!"
turn_off_action:
- uart.write: "power_off!"
# Enable Home Assistant API
api:
encryption:
key: !secret secret_ha_api
ota:
password: !secret ota_password
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
output_power: 8.5
power_save_mode: none
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Rotelmini Fallback Hotspot"
password: !secret access_point_password
captive_portal: