Tuya 3 in 1 Siren/Alarm, Temp, Humidity using Tasmota Firmware

I couldn’t find a good set of instructions for the Tuya 3-in-1 Siren, Temperature, Humidity. The come as Wifi under lots of different brand names, you can replace the firmware with Tasmota and use them for alarms, siren, notifications (door opened), Temp and Humidity etc. You can pick them up for about £20 or $20. They power on both USB and/or battery.

They look similar to the following (the ZIGBEE version has an orange led on it and ISNT supported with Tasmota)

tible2

The following will guide you through installing Tasmota onto the siren:

https://templates.blakadder.com/neo_coolcam_NAS-AB02W.html

Or use Tuya Convert (no need to open the device, its an Over the Air install)

Once youve gotten as far as flashing the tasmota on it, connect to the device on its IP address, go to:

  1. Configuration > Configure Module > Module Type > TuyaMCU (54)

  2. Configuration > Configure Module > Configure MQTT > Configure this with your MQTT settings and in the topic, I have named mine “tuya” without the quotes.

  3. Configuration > Configure Module > Configure Other > In here, Ive also changed my Device Name and Friendly Name to “tuya” without the quotes.

  4. Once the above is done, go back to the main menu and go to Console. In there you will paste in these 4x commands (the first two are just belt and braces approach to ensure the Module Type settings are correct:

Backlog TuyaMCU 11,104; TuyaMCU 71,105; TuyaMCU 73,106; TuyaMCU 81,103; TuyaMCU 61,102; TuyaMCU 62,116
Backlog TuyaEnumList 1,17; TuyaEnumList 2,2; Rule0 1; SetOption65 1; TempRes 1; HumRes 0
rule2 on event#doorbell do tuyasend4 102,0 endon on event#fur elise do tuyasend4 102,1 endon on event#big ben do tuyasend4 102,2 endon on event#ring ring do tuyasend4 102,3 endon on event#lone ranger do tuyasend4 102,4 endon on event#turkish march do tuyasend4 102,5 endon on event#high pitched do tuyasend4 102,6 endon on event#red alert do tuyasend4 102,7 endon on event#crickets do tuyasend4 102,8 endon on event#beep do tuyasend4 102,9 endon on event#dog bark do tuyasend4 102,10 endon on event#police siren do tuyasend4 102,11 endon on event#grandfather clock do tuyasend4 102,12 endon on event#phone ring do tuyasend4 102,13 endon on event#fire truck do tuyasend4 102,14 endon on event#clock chime do tuyasend4 102,15 endon on event#alarm clock do tuyasend4 102,16 endon on event#school bell do tuyasend4 102,17 endon on event#high do tuyasend4 116,0 endon on event#medium do tuyasend4 116,1 endon on event#low do tuyasend4 116,2 endon
rule3 on tuyareceived#dptype2id103 do publish %topic%/alarmduration %value% endon on var1#state do tuyasend2 103,%value% endon on tuyareceived#dptype4id101 do publish %topic%/battery %value% endon on tuyareceived#dptype4id102 do publish %topic%/chime %value% endon on tuyareceived#dptype4id116 do publish %topic%/alarmvolume %value% endon on var6#state do tuyasend4 116,%value% endon

Activate the rules by typing:

rule2 1

then

rule3 1

in the console

  1. You are now done with the tasmota web interface and your Tuya Siren is ready for you to add code/configuration into Openhab. For simplicity, Im going to provide the text settings you would use, but you should be able to figure out how to add these into the interface if you use that.

MQTT File/Settings (this is what to add to an EXISTING MQTT file, or into the Web interface) (if you DONT have an existing MQTT file, you will need to build one, OR manually add an MQTT device in your web interface, with the below settings).

Thing topic tuya "SYSTEM DEVICE - Tuya Siren" {
  Channels:
	Type switch : POWER	 		[stateTopic="stat/tuya/POWER", commandTopic="cmnd/tuya/power", on="on", off="off"]
	Type string : LWT 			[stateTopic="tele/tuya/LWT"]
	Type string : VERSION 		[stateTopic="stat/tuya/STATUS2", transformationPattern="JSONPATH:$.StatusFWR.Version"]
	Type string : SENSORTEMP	[stateTopic="tele/tuya/SENSOR", transformationPattern ="REGEX:(.*\"Temperature\".*)∩JSONPATH:$.TuyaSNS.Temperature" ]
	Type string : SENSORHUMID	[stateTopic="tele/tuya/SENSOR", transformationPattern ="REGEX:(.*\"Humidity\".*)∩JSONPATH:$.TuyaSNS.Humidity" ]
	Type string : DURATION		[stateTopic="tuya/alarmduration", commandTopic="cmnd/tuya/var1"]
	Type string : ALARMVOLUME	[stateTopic="tuya/alarmvolume", commandTopic="cmnd/tuya/event"]
	Type string : BATTERY		[stateTopic="tuya/battery"]
	Type string : CHIME			[stateTopic="tuya/chime", commandTopic="cmnd/tuya/event"]
 }

ITEMS File/Settings

Switch Tuyaonoff			"Tuya Siren"								<alerticon>	{channel="mqtt:topic:openhabbroker:tuya:POWER"}
String Tuyainfo				"Tuya alarm"								<alerticon>	{channel="mqtt:topic:openhabbroker:tuya:LWT"} 
String Tuyatemp				"Tuya Temp"									<alerticon>	{channel="mqtt:topic:openhabbroker:tuya:SENSORTEMP"} 
String Tuyahumid			"Tuya Humid"								<alerticon>	{channel="mqtt:topic:openhabbroker:tuya:SENSORHUMID"} 
String Tuyavol				"Tuya Volume[MAP(tuyavol.map):%s]"			<alerticon>	{channel="mqtt:topic:openhabbroker:tuya:ALARMVOLUME"} 
String Tuyabattery			"Tuya Power[MAP(tuyapower.map):%s]"			<alerticon>	{channel="mqtt:topic:openhabbroker:tuya:BATTERY"} 
String Tuyachimeselect		"Tuya Chime select"							<alerticon>	{channel="mqtt:topic:openhabbroker:tuya:CHIME"} 
String Tuyachimecurrent		"Tuya Chime Current[MAP(tuyasiren.map):%s]" <alerticon>	{channel="mqtt:topic:openhabbroker:tuya:CHIME"} 
String Tuyaduration			"Tuya Duration"								<alerticon>	{channel="mqtt:topic:openhabbroker:tuya:DURATION"} 
String Tuyaversion 			"Tuya Version: [%s]" 						<alerticon>	{channel="mqtt:topic:openhabbroker:tuya:VERSION"}

Sitemap

Frame label="Tuya Stuff" {
Switch item=Tuyaonoff
Text item=Tuyatemp
Text item=Tuyahumid
Selection item=Tuyavol			mappings=["low" = "Low", "medium" = "Medium", "high" = "High"]
Text item=Tuyabattery
Selection item=Tuyachimeselect	mappings=["doorbell"="Doorbell", "fur elise"="Fur Elsie", "big ben"="Big Ben", "ring ring" = "Ring Ring","lone ranger" = "Lone Ranger","Turkish March" = "Turkish March","High Pitched" = "High Pitched","Red Alert" = "Red Alert","Crickets" = "Crickets","Beep" = "Beep","Dog Bark" = "Dog Bark","Police Siren" = "Police Siren","Grandfather Clock" = "Grandfather Clock","Phone Ring" = "Phone Ring","Fire Truck" = "Fire Truck","Clock Chime" = "Clock Chime","Alarm Clock" = "Alarm Clock","School Bell" = "School Bell"]
Text item=Tuyachimecurrent
Setpoint item=Tuyaduration		minValue=5 maxValue=600 step=5
Text item=Tuyaversion
}

tuyasiren.map

0 = Doorbell
1 = Fur Elsie
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

tuyapower.map

1 = Battery (Low)
2 = Battery (Medium)
3 = Battery (High)
4 = USB Power

tuyavol.map

0 = High
1 = Medium
2 = Low
high = High
medium = Medium
low = Low

To get the firmware version sent out, you need to issue a cmnd/tuya/status 2 to the device and I would suggest looking on this site for the tasmota firmware update code thats on here somewhere, as that has a specific set of code for querying and updating your tasmota devices.

Battery/Power status is sent out when the power changes between USB/Battery or when the device boots up.

The duration on the siren/alarm is in seconds, so can be as little as 1 second (enough to make a beep) or… well… the longest Ive tried it at is 600 seconds, but Im guessing you can go longer.

I admit my code is a bit rough and ready, though from here, you can tweak it and build your rules, sitemap etc as you wish. You should end up with something a bit like this though.

A note on sending too many commands to the siren at 1 time and a workaround
Ive found that if you wanted to use MQTT to send multiple instructions at once, such as, wanting a doorbell on low volume, that lasts for 2 seconds OR a high pitched siren that lasts 10 minutes on high volume, sending all these commands at one time, doesnt work great (it sometimes skips one of the multiple instructions). So the solution is to amend a rule, so that you can send 1x MQTT message that completes all tasks at once e.g.

rule3 on tuyareceived#dptype2id103 do publish %topic%/alarmduration %value% endon on var1#state do tuyasend2 103,%value% endon on tuyareceived#dptype4id101 do publish %topic%/battery %value% endon on tuyareceived#dptype4id102 do publish %topic%/chime %value% endon on tuyareceived#dptype4id116 do publish %topic%/alarmvolume %value% endon on var6#state do tuyasend4 116,%value% endon on **event#dooralert do backlog tuyasend2 103,2; tuyasend4, 102,0; tuyasend4 116,2; Power1 on endon on event#alarm do backlog tuyasend2 103,600; tuyasend4 102,6; tuyasend4 116,0; Power1 on endon**

This is the 3rd rule edited with 2x additions to it, at the end of the standard rule:

on event#dooralert do backlog tuyasend2 103,2; tuyasend4, 102,0; tuyasend4 116,2; Power1 on endon
on event#alarm do backlog tuyasend2 103,600; tuyasend4 102,6; tuyasend4 116,0; Power1 on endon

So now I can send an MQTT command cmnd/tuya/event with either dooralert or alarm and the correct settings are set for chime type, volume and duration, as well as activating the power on command (turns on the siren). Turning the power off, silences/stops the command running, though it automatically shuts off after the duration is reached.

Thanks

1 Like

Presumably this is only true of the WiFi version, right? I’ve got a Zigbee one in transit, but didn’t think I could flash Tasmota on to it?

I retract my earlier statement… you are right. Zigbee isnt supported with Tasmota. Ill edit the 1st post.

Sorry and thanks

1 Like

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.