-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathexample_esp32h2.yaml
129 lines (121 loc) · 3.22 KB
/
example_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
esphome:
name: zb-example-h2
external_components:
- source: components
components: [zigbee]
esp32:
board: esp32-h2-devkitm-1
#flash_size: 4MB
partitions: partitions_zb.csv
framework:
type: esp-idf
#sdkconfig_options:
#CONFIG_ESPTOOLPY_FLASHSIZE_4MB: y
# 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'
sensor:
- platform: internal_temperature
name: "Internal Temperature"
id: "temp"
filters:
- delta: 0.1
zigbee:
id: "zb"
endpoints:
- num: 1
device_type: COLOR_DIMMABLE_LIGHT
clusters:
- id: ON_OFF
attributes:
- attribute_id: 0
type: bool
on_value:
then:
- light.control:
id: light_1
state: !lambda "return x;"
- id: LEVEL_CONTROL
attributes:
- attribute_id: 0
type: U8
value: 255
on_value:
then:
- light.control:
id: light_1
brightness: !lambda "return ((float)x)/255;"
- id: COLOR_CONTROL
attributes:
- attribute_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));"
- attribute_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: TEMP_MEASUREMENT
attributes:
- attribute_id: 0x0
type: S16
report: true
value: 100
device: temp
scale: 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
chipset: ws2812
#bit0_high: 100ns # rmt clk freq seems to be different on H2. Fixed in esphome 2025.02
#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