forked from luar123/zigbee_esphome
-
Notifications
You must be signed in to change notification settings - Fork 0
/
example_tsl2561_esp32h2.yaml
152 lines (143 loc) · 3.87 KB
/
example_tsl2561_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
esphome:
name: zb-example-2561-h2
platformio_options:
platform: https://github.com/luar123/platform-espressif32H2/archive/refs/tags/v6.6.1.0.zip
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.2.1
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: 26
scl: 27
sensor:
- platform: internal_temperature
name: "Internal 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;"
- platform: tsl2561
name: "TSL2561 Ambient Light"
address: 0x39
id: "lum"
on_value:
then:
- zigbee.setAttr:
id: zb
endpoint: 2
cluster: ILLUMINANCE_MEASUREMENT
attribute: 0x0
value: !lambda "return 10000*log10 (x+1);"
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: ILLUMINANCE_MEASUREMENT
attributes:
- id: 0
type: U16
value: 1
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