-
Notifications
You must be signed in to change notification settings - Fork 9
/
example_aht10_esp32h2.yaml
163 lines (154 loc) · 4.09 KB
/
example_aht10_esp32h2.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
esphome:
name: zb-sensor
external_components:
- source: components
components: [ zigbee ]
esp32:
board: esp32-h2-devkitm-1
flash_size: 4MB
partitions: partitions_zb.csv
framework:
type: esp-idf
version: 5.1.4
source: https://github.com/pioarduino/esp-idf/releases/download/v5.1.4.240921/esp-idf-v5.1.4.zip
platform_version: https://github.com/pioarduino/platform-espressif32/releases/download/51.03.05/platform-espressif32.zip
sdkconfig_options:
CONFIG_ESPTOOLPY_FLASHSIZE_4MB: y
variant: esp32h2
# Enable logging
logger:
hardware_uart: UART0
globals:
- id: color_x
type: float
restore_value: no
initial_value: '0'
- id: color_y
type: float
restore_value: no
initial_value: '0'
i2c:
sda: 12
scl: 22
sensor:
- platform: aht10
variant: AHT10
temperature:
name: "Living Room Temperature"
id: "temp"
filters:
- delta: 0.1
on_value:
then:
- zigbee.setAttr:
id: zb
endpoint: 2
cluster: TEMP_MEASUREMENT
attribute: 0x0
value: !lambda "return x*100;"
humidity:
name: "Living Room Humidity"
id: "hum"
filters:
- delta: 1
on_value:
then:
- zigbee.setAttr:
id: zb
endpoint: 2
cluster: REL_HUMIDITY_MEASUREMENT
attribute: 0x0
value: !lambda "return x*100;"
update_interval: 60s
zigbee:
id: "zb"
endpoints:
- num: 1
device_type: COLOR_DIMMABLE_LIGHT
clusters:
- id: ON_OFF
attributes:
- id: 0
type: bool
on_value:
then:
- light.control:
id: light_1
state: !lambda "return (bool)x;"
- id: LEVEL_CONTROL
attributes:
- id: 0
type: U8
on_value:
then:
- light.control:
id: light_1
brightness: !lambda "return ((float)x)/255;"
- id: COLOR_CONTROL
attributes:
- id: 3
type: U16
on_value:
then:
- lambda: id(color_x) = (float)x/65536;
- light.control:
id: light_1
red: !lambda "return zigbee::get_r_from_xy(id(color_x), id(color_y));"
green: !lambda "return zigbee::get_g_from_xy(id(color_x), id(color_y));"
blue: !lambda "return zigbee::get_b_from_xy(id(color_x), id(color_y));"
- id: 4
type: U16
on_value:
then:
- lambda: id(color_y) = (float)x/65536;
- light.control:
id: light_1
red: !lambda "return zigbee::get_r_from_xy(id(color_x), id(color_y));"
green: !lambda "return zigbee::get_g_from_xy(id(color_x), id(color_y));"
blue: !lambda "return zigbee::get_b_from_xy(id(color_x), id(color_y));"
- device_type: TEMPERATURE_SENSOR
num: 2
clusters:
- id: REL_HUMIDITY_MEASUREMENT
attributes:
- id: 0
type: U16
report: true
value: 200
- id: TEMP_MEASUREMENT
attributes:
- id: 0x0
type: S16
report: true
value: 100
on_join:
then:
- logger.log: "Joined network"
light:
- platform: esp32_rmt_led_strip
rgb_order: GRB
pin: 8
num_leds: 1
rmt_channel: 0
id: light_1
bit0_high: 100ns # rmt clk freq seems to be different on H2
bit0_low: 300ns
bit1_high: 300ns
bit1_low: 100ns
binary_sensor:
- platform: gpio
pin:
number: 9
mode:
input: true
pullup: true
inverted: true
id: button_1
on_press:
then:
- zigbee.report: zb
on_click:
min_length: 5s
max_length: 20s
then:
- zigbee.reset: zb