forked from pruwait/Nice_BusT4
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnice-bust4-uart.yaml
163 lines (122 loc) · 5.44 KB
/
nice-bust4-uart.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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
#отправляет пакеты через uart в шину Nice BUS T4
#тест на Wemos D1 mini
substitutions:
device_name: "nice-bust4-uart"
esphome:
name: ${device_name}
platform: ESP8266
board: d1_mini
external_components:
- source:
type: git
url: https://github.com/pruwait/Nice_BusT4
# - source: my_components
# включаем отладку для поиска причины перезагрузки через лог
debug:
# Enable logging
logger:
level: DEBUG
# level: VERBOSE
baud_rate: 0
# Enable Home Assistant API
api:
reboot_timeout: 0s # иначе перезагружается при отключении от hassio
services:
# для отправки hex команд на привод
- service: raw_command
variables:
raw_cmd: string
then:
lambda: |-
my_nice_cover -> NiceBusT4::send_raw_cmd(raw_cmd);
- service: send_inf_command
variables:
to_addr: string
whose: string
command: string
type_command: string
next_data: string
data_on: bool
data_command: string
then:
lambda: |-
my_nice_cover -> NiceBusT4::send_inf_cmd(to_addr, whose, command, type_command, next_data, data_on, data_command);
# распознавание длины створки
- service: gate_length_recognition
then:
lambda: |-
my_nice_cover -> NiceBusT4::set_mcu("0b","01");
# распознавание устройств BlueBus
- service: devices_recognition
then:
lambda: |-
my_nice_cover -> NiceBusT4::set_mcu("0a","01");
# std::vector < uint8_t > v_to_addr = my_nice_cover -> NiceBusT4::raw_cmd_prepare (to_addr);
# std::vector < uint8_t > v_whose = my_nice_cover -> NiceBusT4::raw_cmd_prepare (whose);
# std::vector < uint8_t > v_command = my_nice_cover -> NiceBusT4::raw_cmd_prepare (command);
# std::vector < uint8_t > v_type_command = my_nice_cover -> NiceBusT4::raw_cmd_prepare (type_command);
# std::vector < uint8_t > v_data_command = my_nice_cover -> NiceBusT4::raw_cmd_prepare (data_command);
# if (data_on) {
# my_nice_cover -> NiceBusT4::tx_buffer_.push(my_nice_cover -> NiceBusT4::gen_inf_cmd(v_to_addr[0], v_to_addr[1], v_whose[0], v_command[0], v_type_command[0], v_data_command, v_data_command.size()));
# } else {
# my_nice_cover -> NiceBusT4::tx_buffer_.push(my_nice_cover -> NiceBusT4::gen_inf_cmd(v_to_addr[0], v_to_addr[1], v_whose[0], v_command[0], v_type_command[0]));
# }
ota:
# Set statul led for Wemos D1 mini
status_led:
pin:
number: D4
inverted: true
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "${device_name} Hotspot"
password: !secret ota_pass
captive_portal:
# Enable web server (can be disabled)
web_server:
port: 80
# Кнопки для отправки команд
button:
- platform: template
name: Пошагово
id: sbs
on_press:
lambda: |-
my_nice_cover -> NiceBusT4::send_cmd(bus_t4::SBS);
# my_nice_cover -> NiceBusT4::send_raw_cmd("55 0c 00 ff 00 66 01 05 9D 01 82 01 64 E6 0c");
- platform: template
name: Частичное открытие 1
id: p_opn1
on_press:
lambda: |-
my_nice_cover -> NiceBusT4::send_cmd(bus_t4::P_OPN1);
# my_nice_cover -> NiceBusT4::send_cmd(bus_t4::STOP);
# my_nice_cover -> NiceBusT4::send_cmd(bus_t4::OPEN);
# my_nice_cover -> NiceBusT4::send_cmd(bus_t4::CLOSE);
# my_nice_cover -> NiceBusT4::send_cmd(bus_t4::P_OPN2);
# my_nice_cover -> NiceBusT4::send_cmd(bus_t4::P_OPN3);
# my_nice_cover -> NiceBusT4::send_cmd(bus_t4::P_OPN4);
# my_nice_cover -> NiceBusT4::send_cmd(bus_t4::P_OPN5);
# my_nice_cover -> NiceBusT4::send_cmd(bus_t4::P_OPN6);
# my_nice_cover -> NiceBusT4::send_cmd(bus_t4::UNLK_OPN); # Разблокировать и открыть
# my_nice_cover -> NiceBusT4::send_cmd(bus_t4::CLS_LOCK); # Закрыть и блокировать
# my_nice_cover -> NiceBusT4::send_cmd(bus_t4::UNLCK_CLS); # Разблокировать и Закрыть
# my_nice_cover -> NiceBusT4::send_cmd(bus_t4::LOCK); # Блокировать
# my_nice_cover -> NiceBusT4::send_cmd(bus_t4::UNLOCK); # Разблокировать
# my_nice_cover -> NiceBusT4::send_cmd(bus_t4::HOST_SBS); # Ведущий SBS
# my_nice_cover -> NiceBusT4::send_cmd(bus_t4::HOST_OPN); # Ведущий открыть
# my_nice_cover -> NiceBusT4::send_cmd(bus_t4::HOST_CLS); # Ведущий закрыть
# my_nice_cover -> NiceBusT4::send_cmd(bus_t4::SLAVE_SBS); # Ведомый SBS
# my_nice_cover -> NiceBusT4::send_cmd(bus_t4::SLAVE_OPN); # Ведомый открыть
# my_nice_cover -> NiceBusT4::send_cmd(bus_t4::SLAVE_CLS); # Ведомый закрыть
# my_nice_cover -> NiceBusT4::send_cmd(bus_t4::AUTO_ON); # Автооткрывание активно
# my_nice_cover -> NiceBusT4::send_cmd(bus_t4::AUTO_OFF); # Автооткрывание неактивно
cover:
- platform: bus_t4
name: "Nice RB500HS"
id: my_nice_cover
# address: 0x0003 # адрес привода
# use_address: 0x0081 # адрес шлюза