Hi All! Great project I didn't know until 2 hours ago, keep up the good work!
Now I'm just started programming a recent Tuya Siren+Temperature+Humidity sensor (old ESP8266 version was named NAS-AB02W (without 6) this one is the old: https://templates.blakadder.com/neo_coolcam_NAS-AB02W.html ; the one I got from aliexpress has the BK7231N and it's using TuyaMCU.
I've programmed it just fine using RXD-TXD pins and touching CEN pin with UART3v3 GND pin just after flash program starts.
I've figured out how to map the dpid I need for now, but there is a thing I'm not able to change: this siren has LEDS that are flashing when siren is ringing and stay off in all other states, with original firmware.
With OpenBK flashed, the leds just flash after boot and I'm not able to stop them. Any suggestion what to look for?
Many thanks in advance
RyLoS
Hello @rylos78 , can you post your autoexec.bat, how advanced are you with this device?
We already had a report from a user saying that his device buzzer was going off when there was no MQTT connected, it was strange, but can you check this - do you have both WiFi and MQTT online when testing this device?
Have you checked is there a setting for those LEDs in TuyaMCU dpIds?
I've tried a lot of things and the results are: dpid 103 is alarm duration time (in seconds), default is 10. When 104 (toggle) is set to 1 (switch on) the bell will ring for dpid 103 duration, after switch 102 is returned to 0. Temperature is dpid 105 and humidity is 106. 104 - 105 - 106 are working fine with openbeken.
There is a problem on dpid 102 that is chime sound selection (it's a value from 0 to 17) = 18 ring tones. At startup it's defaulted to value 5. I can change it with setchannel on command of webapp (channel is set to textField). I need value 12 permanent. If I put this on web config as startup value, it remains 5 after a reboot. I've tried also setChannel 4 12 on autoexec.bat but value after reboot is still 5. I've tried also a delay before setchannel but value is still 5. I can change it only from command line. Any clue?
Good job with writing the config. I will try to help you with the further steps.
rylos78 wrote:
There is a problem on dpid 102 that is chime sound selection (it's a value from 0 to 17) = 18 ring tones.
At startup it's defaulted to value 5. I can change it with setchannel on command of webapp (channel is set to textField). I need value 12 permanent.
If i put this on web config as startup value, it reamains 5 after a reboot.
I've tried also setChannel 4 12 on autoexec.bat but value after reboot is still 5.
I've tried also a dealy before setchannel but value is still 5.
I can change it only from commandline. Any clue?
We do not have implemented yet the initial state sending to TuyaMCU, it was never needed, but I will try to figure out something for you.
I haven't tested it so tell me if there is any problem.
Futhermore...
I don't know when exactly can you already start setting channels So you might need to try one of these:
You will need some experiments to get it running. It's up to you to choose the working way. You can just use a delay like 5 seconds and assume that it will be ok, or you can try using the Event Handler I've just added for you. Good luck!
Wow! Thank you for your support.
Ok first problem was this linkTuyaMCUOutputToChannel 102 val 4, apparently it was working and setting a value was working too but in reality chime sound was not changing.
After setting it as linkTuyaMCUOutputToChannel 102 enum 4 it was starting working and set value was retained on reboot too.
However I've also tested your new event and put this on autoexec.bat "addEventHandler TuyaMCUParsed 0x02 setChannel 4 11" and it's working fine if I change value then reboot.
As of now I can say this device is fully supported right now.
Will edit this message later adding my actual autoexec.bat. Here it is:
Thank you, would you be able to at least provide few more photos of the device inside (PCB board) or/and packaging to make the entry to https://openbekeniot.github.io/webapp/devicesList.html complete? Or maybe where the device was bought?
It's important to use to provide enough documentation so future users so they can easily flash their devices.
Thank you. We will soon have Automatic Home Assistant Discovery for TuyaMCU as well, but that's not ready yet.
I will post here a backup screenshots from the offer you linked (because links tends to expire):
Are you using PowerSave for this device, as according to the photos is supports battery mode? But even if it's powered by wire... PowerSave can always save some energy.
We're also working on deep sleep feature, a feature where basically WiFi module goes into total hibernation for a given amount of time and then wakes up for few seconds and checks the sensors, only to report values (if needed) and sleep again.
It's up to you, @ionoleinic , but it's always safe to do both packet capture and firmware backup first.
Keep in mind that TuyaMCU is using the same port which one is used for flashing, so not much extra work is needed to do the capture. It should be easy. As far as I remember you already did UART capture in the past, right?
As far as I remember you already did UART capture in the past, right?
Yes, with Temp and Hum sensor.
I will try to do capture and backup.
I also got another BL-602 based device, it is a Magic home Led Controller. What to do with it? Try to flash or not? The bulb that was based on bl-602 now is disassembled and I don't know what to do with this...
I've worked on BL602 recently and added OTA feature, so it's certainly giving a try. I don't know still about that "newer" BL602 devices. I don't have any of them. I would need to get one piece of new BL602 for research.
Try flashing that magic led strip with OpenBL602 and we will see.
This also works for ab02w6 v4, brought from the same aliexpress provider. Setting default values is troublesome though, but this configuration worked best:
If the event happens too fast or too late it won't work. Or if both ran at the same time, only one will be picked up. That will give about 50% chance both configs will be picked up on boot (await ~25 seconds in before switching it on from within the GUI). The PCB is similar to v2, and does not require soldering, since GND & 3.3V are hollow, and CEN, RT, RX are recessed.
There's one issue: if the device disconnects from mqtt it becomes de-synchronized (the gui still reports the last config, but the device will act on default values).
example: on boot default alarm duration is 10s, set it to 20s, mqtt server down, gui still reports 20s but now will play for 10s, set it to 20s through mqtt (this mqtt command is ignored, perhaps the device sees it as a duplicated value?), the solution is to set duration to any value other than 20s, then set it to 20s.
Hello, I see you have a nice progress on figuring it out.
If you think that device has default values after reboot, then you can consider using channel memory feature.
In Config, go to Startup, and for each channel you want to be remembered after reboot, enter value -1.
Then, on every change, this channel will be saved in flash memory (in our flash vars partition featuring erase-cycle optimization to reduce flash wear).
This will work for simple Relays, so relay devices can remember their state after reboot, but it can also work for custom channel values, anything.
Let me know if that helps, I assumed that you are referring to data loss after reboot, but I am not sure.... maybe you are also missing a "Broadcast self state on MQTT connect" flag?
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.
you do not need to configure any pins. The Bekenchip talks directly with the tuya chip via serial connection (the same serial port you use to flash). This tuya chip does anything else (sound led). All you have to do is creating an autoexec.bat in the filesystem of openbeken and paste the code from rylos87 in post #5 (https://www.elektroda.com/rtvforum/topic3947937.html#). Then restart it and it works.
Just make sure first that you have indeed TuyaMCU vesion. There are often many versions of the same device available, some of them may use TuyaMCU, and some may just use deep sleep directly.
Here is a short how-to flash the NAS-AB02W6-V4 Siren and get it working.
1.) Flash the Beken7231N module. I just connected TXD and RXD (its the second and third hole marked on the picture) to my USB-Serial-Interface, launched the OpenBekenFlasher, started Backup&Flash and then connected USB Power to the Siren. I think it is a good idea to use the computer as USB-power source to have the same ground level.
2.) Start the device. Connect to the "Openbeken*****" wifi. Open http://192.168.4.1 in your browser. Configure wifi.
3.) Discover the IP address of the device and connect to it.
4.) Launch Web Application
5.) On the Top-menu click on "file system". then choose "create file". say "OK" to autoexec.bat 6.) In the middle click on the new file paste the autoexec.bat contents from post #5 there. Click "Safe" If you have the device without temperature and humidity, you can delete the according lines (8,9,19,20).
The discussion revolves around programming the NAS-AB02W6 Ver 2.0 Tuya Siren with temperature and humidity sensor capabilities using OpenBK firmware. Users share their experiences with configuring the device, particularly focusing on controlling LED behavior during alarm states and setting chime sounds. Key issues include retaining settings after reboot, managing MQTT connections, and ensuring proper command execution through autoexec.bat scripts. Solutions involve using specific dpIds for configuration, implementing event handlers, and utilizing the TuyaMCU protocol for communication. Users also discuss the importance of capturing packets and backing up firmware before flashing the device. Summary generated by the language model.