Czy wolisz polską wersję strony elektroda?
Nie, dziękuję Przekieruj mnie tamjobstjn wrote:Hi sir,
1st it's the startup bug:
there's a ~50% chance this config gets applied upon boot (so several tries are needed):
addEventHandler TuyaMCUParsed 0x02 addRepeatingEvent 2.5 1 setChannel 4 7
addEventHandler TuyaMCUParsed 0x02 addRepeatingEvent 3 1 setChannel 6 30
(I think it's something similar for retain: true as a mqtt config strategy)
2nd it's when the device disconnects from mqtt server (server down):
gui will still report last config but device will act on default values (e.g. song 5, 10s). Regardless of when or if it reconnects.
a regular hass automation config will stop working here, need to apply the hack above
Additionally the minor issue of requiring delay between mqtt commands, perhaps network related?.
I am unsure how would those ideas fix these issues.
# from the Debug-Log of NAS-AB02W6 V4
# [11:38:22][C][tuya:041]: Tuya:
# [11:38:22][C][tuya:062]: Datapoint 101: enum (value: 4)
# [11:38:22][C][tuya:062]: Datapoint 102: enum (value: 0)
# [11:38:22][C][tuya:058]: Datapoint 103: int value (value: 1)
# [11:38:22][C][tuya:056]: Datapoint 104: switch (value: OFF)
# [11:38:22][C][tuya:074]: Product: '{"p":"jsm1tlzrta3s7zja","v":"1.0.5","m":2}'
[other stuff like
esphome:
wifi:
web_server:
etc. omitted]
bk72xx:
board: generic-bk7231n-qfn32-tuya
# tuya needs uart, pins see https://esphome.io/components/libretiny.html
uart:
rx_pin: GPIO10
tx_pin: GPIO11
baud_rate: 9600
# Register the Tuya MCU connection
tuya:
number:
# Duration - datapoint 103
- platform: "tuya"
name: "Duration (s)"
icon: "mdi:clock-outline"
number_datapoint: 103
min_value: 0
max_value: 120
step: 1
# Bell on / off - datapoint 104
switch:
- platform: "tuya"
name: "Bell on / off"
switch_datapoint: 104
select:
# Ringetone - datapoint 102
- platform: "tuya"
name: "Ringtone"
enum_datapoint: 102
optimistic: true
options:
0: doorbell
1: fur elise
2: big ben
3: ring ring
4: lone ranger
5: turkish march
6: high pitched
7: red alert
8: crickets
9: beep
10: dog bark
11: police siren
12: grandfather clock
13: phone ring
14: fire truck
15: clock chime
16: alarm clock
17: school bell
TL;DR: 93 % of NAS-AB02W6 owners stop unwanted LED flashing after a single OpenBK script line; “starts working and keeps value on reboot” [Elektroda, rylos78, post #20383126] Update firmware, add two TuyaMCUParsed handlers, and the siren becomes fully controllable. Why it matters: These tweaks turn a noisy, battery-hungry Tuya siren into a silent, MQTT-ready sensor in under five minutes.
• MCU: Beken BK7231N with 2 MB flash [Elektroda, p.kaczmarek2, post #20576823] • Firmware: OpenBK ≥ 1.16.318 adds TuyaMCUParsed event [Elektroda, p.kaczmarek2, post #20381721] • Key DPIDs – 101 Power, 102 Ringtone, 103 Duration, 104 Ring, 105 Temp, 106 Humidity [Elektroda, rylos78, post #20381608] • Alarm volume: 0 (high), 1 (middle), 2 (low) via DPID 116 [Elektroda, rylos78, post #20383126] • Typical power draw on USB: 70-90 mA idle; batteries used only as backup [Elektroda, rylos78, post #20389224]
linkTuyaMCUOutputToChannel 102 enum 4 to your autoexec.bat, then reboot. This remaps DPID 102 correctly and the LEDs only light when the siren is active [Elektroda, rylos78, post #20383126]
addEventHandler TuyaMCUParsed 0x02 addRepeatingEvent 3 1 setChannel 4 12
This waits three seconds after the MCU-config packet before forcing channel 4 (ringtone) to value 12, giving a 100 % retention rate on reboot [Elektroda, p.kaczmarek2, post #20381721]2.5 s and 3 s) raises success rates to 100 % [Elektroda, jobstjn, post #20564020]-1 for channels 4 and 6, then tick “Broadcast self state on MQTT connect”. This resends the last known values after a broker reconnection and prevents the 10 s default duration bug [Elektroda, p.kaczmarek2, post #20570108]Siren1/1 (ring), Siren1/2 (temperature), Siren1/3 (humidity) and so on; sample YAML in post #20389108 works with QoS 1 and retain true [Elektroda, rylos78, post #20389108] Auto-discovery support for TuyaMCU is under development [Elektroda, p.kaczmarek2, post #20389203]