Skip to content

Commit 2bedca2

Browse files
realkibouswoboda1337claude
authored
Added tuya pir (#1378)
* added device Tuya PIR Alarm * added device Tuya PIR Alarm * Fix CI issues: remove key files, fix directory name and line length - Remove accidentally committed github-key and github-key.pub files - Rename directory to remove space (PIR Motion-Alarm -> PIR-Motion-Alarm) - Wrap long line to satisfy markdown lint (120 char limit) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> * Rename images to match naming convention - 1.jpg -> tuya-pir-motion-alarm.jpg - 2.svg -> tuya-pir-motion-alarm-pinout.svg 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> --------- Co-authored-by: Jonathan Swoboda <[email protected]> Co-authored-by: Claude <[email protected]>
1 parent 79c01db commit 2bedca2

File tree

3 files changed

+604
-0
lines changed

3 files changed

+604
-0
lines changed
Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
---
2+
title: Tuya Wifi Mini Sensor PIR Motion Alarm
3+
date-published: 2025-12-09
4+
type: Sensor
5+
standard: global
6+
board: bk72xx
7+
made-for-esphome: false
8+
difficulty: 2
9+
---
10+
11+
![Tuya Wifi Mini Sensor PIR Motion Alarm](tuya-pir-motion-alarm.jpg "Tuya Wifi Mini Sensor PIR Motion Alarm")
12+
13+
This is a PIR Motion device with an LED and a passive buzzer. It is simple and built with a CBU chip.
14+
15+
## Setup
16+
17+
It is not vulnerable to tuya-cloudcutter so you need to solder to the chip and serial flash it. This requires
18+
disassembly, soldering, a USB-to-Serial-TTL, and a tool like [ltchiptool](https://github.com/libretiny-eu/ltchiptool)
19+
or [BK7231 GUI Flash Tool](https://github.com/openshwprojects/BK7231GUIFlashTool).
20+
The PIN-out is available [here](https://docs.libretiny.eu/boards/cbu/#usage).
21+
22+
## YAML configuration
23+
24+
```yaml
25+
esphome:
26+
name: tuya-pir-alarm
27+
friendly_name: tuya-pir-alarm
28+
29+
bk72xx:
30+
board: cbu
31+
32+
logger:
33+
34+
web_server:
35+
36+
ota:
37+
password: "CHANGE-THIS-PASSWORD-OR-REMOVE-OTA"
38+
39+
wifi:
40+
ssid: !secret wifi_ssid
41+
password: !secret wifi_password
42+
43+
captive_portal:
44+
45+
api:
46+
encryption:
47+
key: "GET-A-KEY-HERE-https://esphome.io/components/api.html#configuration-variables"
48+
services:
49+
- service: pir_notification
50+
then:
51+
- output.libretiny_pwm.set_frequency:
52+
id: buzzer
53+
frequency: 800
54+
- output.set_level:
55+
id: buzzer
56+
level: 50%
57+
- delay: 120ms
58+
- output.turn_off: buzzer
59+
- delay: 200ms
60+
- output.libretiny_pwm.set_frequency:
61+
id: buzzer
62+
frequency: 1000
63+
- output.set_level:
64+
id: buzzer
65+
level: 50%
66+
- delay: 120ms
67+
- output.turn_off: buzzer
68+
- service: pir_alarm
69+
then:
70+
- repeat:
71+
count: 8
72+
then:
73+
- output.libretiny_pwm.set_frequency:
74+
id: buzzer
75+
frequency: 5200
76+
- output.set_level:
77+
id: buzzer
78+
level: 90%
79+
- delay: 200ms
80+
81+
- output.libretiny_pwm.set_frequency:
82+
id: buzzer
83+
frequency: 2200
84+
- output.set_level:
85+
id: buzzer
86+
level: 90%
87+
- delay: 200ms
88+
89+
- output.turn_off: buzzer
90+
91+
binary_sensor:
92+
- platform: gpio
93+
pin: P22
94+
name: "PIR Motion Sensor P22"
95+
device_class: motion
96+
97+
- platform: gpio
98+
id: pir_button
99+
pin:
100+
number: P16
101+
mode: INPUT_PULLUP
102+
inverted: true
103+
on_state:
104+
then:
105+
- if:
106+
condition:
107+
binary_sensor.is_on: pir_button
108+
then:
109+
- output.turn_off: buzzer
110+
else:
111+
- output.turn_on: buzzer
112+
name: "PIR Button P16"
113+
device_class: light
114+
115+
light:
116+
- platform: binary
117+
name: "Delete PIR Alarm Output P6"
118+
output: buzzer
119+
120+
- platform: binary
121+
name: "PIR Button Enabler P14"
122+
output: output_p14
123+
124+
- platform: binary
125+
name: "PIR Internal LED P20"
126+
output: internal_led
127+
128+
output:
129+
- platform: libretiny_pwm
130+
pin: P6
131+
frequency: 1000 Hz
132+
id: buzzer
133+
134+
- id: internal_led
135+
platform: gpio
136+
pin:
137+
number: P20
138+
inverted: true
139+
140+
- id: output_p14
141+
platform: gpio
142+
pin:
143+
number: P14
144+
inverted: true
145+
```

0 commit comments

Comments
 (0)