-
Notifications
You must be signed in to change notification settings - Fork 1
/
uart-sniffer.yaml
111 lines (101 loc) · 3.7 KB
/
uart-sniffer.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
substitutions:
device_name: "dev-wood-pellet-stove"
device_description: dev Wood Pellet Stove running ESPHome
friendly_name: dev Wood Pellet Stove
loc: dev #location
esphome:
name: "uart-sniffer"
includes:
- uart_read_line_sensor.h
web_server:
port: 80
esp8266:
board: nodemcu
logger:
level: VERBOSE #makes uart stream available in esphome logstream
baud_rate: 0 #disable logging over uart
uart:
id: uart_bus
# tx_pin: GPIO15 #D8 to tx pin on mcu board
rx_pin: GPIO13 #D7 to rx pin on mcu board
baud_rate: 2400
rx_buffer_size: 80
# stop_bits: 2
# data_bits: 7
# parity: ODD
debug:
direction: RX
dummy_receiver: true
after:
delimiter: [0xCC, 0x33]
sequence:
- lambda: |-
UARTDebug::log_hex(direction, bytes, ' ');
//Still log the data
//Some packets have 5 bytes
//might have to make this 3 if delimitar bytes get removed....
if (bytes.size()==5) {
if(bytes[0]==0xAA && bytes[1]==0x00) {
//id(rawString).publish_state("Heartbeat");
//4B heartbeat, ignore
if(bytes[2]==0x20)
id(rawString).publish_state("Welcome to use");
if(bytes[2]==0x6A)
id(rawString).publish_state("Goodbye!");
if(bytes[2]==0x69)
id(rawString).publish_state("Cleaning");
if(bytes[2]==0x63)
id(rawString).publish_state("Cleaning");
if(bytes[2]==0x65)
id(rawString).publish_state("Lighting");
if(bytes[2]==0x66)
id(rawString).publish_state("Stabilization");
if(bytes[2]==0x67)
id(rawString).publish_state("Stabilization");
if(bytes[2]==0x62)
id(rawString).publish_state("Switching OFF");
if(bytes[2]==0x69)
id(rawString).publish_state("Cooling");
}
}
//Some packets have 6 bytes
if (bytes.size()==6) {
if(bytes[1]==0x01 && bytes[2]==0x46 && bytes[3]==0x02)
id(rawString).publish_state("Welcome to use");
if(bytes[1]==0x01 && bytes[2]==0x49 && bytes[3]==0x80)
id(rawString).publish_state("Stabilization");
if(bytes[1]==0x01 && bytes[2]==0x49 && bytes[3]==0x81)
id(rawString).publish_state("ECO2");
if(bytes[1]==0x01 && bytes[2]==0x48 && bytes[3]==0x80)
id(rawString).publish_state("ECO1");
if(bytes[1]==0x01 && bytes[2]==0x48 && bytes[3]==0xC0)
id(rawString).publish_state("Idling - ECO2");
if(bytes[1]==0x01 && bytes[2]==0x48 && bytes[3]==0x83)
id(rawString).publish_state("ECO1");
if(bytes[1]==0x01 && bytes[2]==0x48 && bytes[3]==0xC3)
id(rawString).publish_state("ECO2");
if(bytes[1]==0x01 && bytes[2]==0x49 && bytes[3]==0x81)
id(rawString).publish_state("Idling - ECO2");
if(bytes[1]==0x01 && bytes[2]==0x49 && bytes[3]==0x00)
id(rawString).publish_state("Switching off");
}
text_sensor:
- platform: template
id: rawString
name: ${loc}_display_text_sensor
# on_value: # When value simply changes
# then:
# - logger.log:
# format: "text_sensor = %s"
# args: ['id(rawString)']
# Enable Home Assistant API
api:
ota:
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Esphome-Web-360942"
password: !secret wifi_password
captive_portal: