Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Template
{"NAME":"Tuya Siren","GPIO":[255,107,255,108,255,255,0,0,255,255,255,255,255],"FLAG":0,"BASE":54}
You must activate the template before using any of the tuya commands below.
Recommended rules for tasmota:
rule1 on system#boot backlog tuyasend4 102,0; tuyasend2 103,300; TuyaSend1 117,0 endon
rule1 1
tuyamcu 11,104
This will set the default alarm length (5min), music (0), volume (0 high), and assign relay1 (power1) to the alarm activation.
The alarm length and music doesn't appear to be retained during power cycles.
0x65 Power State 101
55 aa 03 07 00 05 65 04 00 01 04 7c (on usb power)
55 aa 03 07 00 05 65 04 00 01 00 78 (on battery power, 0=full battery maybe (1/2/3 battery level?)
x66 Change Alarm sound
TuyaSend4 102,0 (0 to 11 on mine, other upto 17)
x67 Change Alarm seconds
TuyaSend2 103,10 (1 to 60 on mine, 1800 on another)
x68 Alarm sounding
TuyaSend4 104,0 (off)
TuyaSend4 104,1 (on)
55 aa 03 07 00 05 68 01 00 01 01 79
55 aa 03 07 00 05 71 01 00 01 00 81
x69 tempature reporting (105)
55 aa 03 07 00 08 69 02 00 04 00 00 00 c3 43 (tempature in C*10)
x6a humidity reporting (106)
55 aa 03 07 00 08 6a 02 00 04 00 00 00 3b bc (59%)
x6b temp alarm low in C
TuyaSend4 107,17
55 aa 00 06 00 08 6b 02 00 04 00 00 00 11 8f
x6c temp alarm high in C
TuyaSend4 108,38
55 aa 00 06 00 08 6c 02 00 04 00 00 00 26 a5
x6d set humidity alarm low
TuyaSend4 109,40
55 aa 00 06 00 08 6d 02 00 04 00 00 00 46 c6 low in percent
x6e set humidity alarm high
TuyaSend4 110,80
55 aa 00 06 00 08 6e 02 00 04 00 00 00 50 d1 high in percent
x6f
x70 Change to C and F units
TuyaSend1 112,1 (on)
55 aa 00 06 00 05 70 01 00 01 01 7d (C)
55 aa 00 06 00 05 70 01 00 01 00 7c (F)
x71 alarm temp on and off
TuyaSend1 113,1 (on)
55 aa 00 06 00 05 71 01 00 01 01 7e (on)
55 aa 00 06 00 05 71 01 00 01 00 7d (off)
x72 humidity alarm on/off
TuyaSend1 114,1 (on)
55 aa 00 06 00 05 72 01 00 01 01 7f (on)
55 aa 00 06 00 05 72 01 00 01 00 7e (off)
x73 alarm temp/humidity triggered
0=high tempature
1=high humidity
2=low tempature
3=low humidity
4=?
5=all normal
55 aa 03 07 00 05 73 04 00 01 02 88 (2 tempature alarm)
55 aa 03 07 00 05 73 04 00 01 03 89 (3 humidity alarm)
55 aa 03 07 00 05 73 04 00 01 05 8b (5 all clear)
x74 Alarm db setting (loudness)
TuyaSend1 117,0 (high)
55 aa 00 06 00 05 74 04 00 01 02 85 Low
55 aa 00 06 00 05 74 04 00 01 01 84 secondary
55 aa 00 06 00 05 74 04 00 01 00 83 High
@magiva

This comment has been minimized.

Copy link

@magiva magiva commented Apr 28, 2020

great work, many thanks, my device is now working. is it possible to change the alarm sounds etc via mqtt sends ?

@magiva

This comment has been minimized.

Copy link

@magiva magiva commented Apr 28, 2020

hmmm spoke too soon, after cycling the power, no sound comes out of it, no matter what commands i send to it, even if i start from the rule1 setting and repeat what i did first time, changing power from off to on does nothing

@erew123

This comment has been minimized.

Copy link

@erew123 erew123 commented May 20, 2020

Thanks for this.. though Id love to ask a question. Ive bought the siren with temp+humidity sensing (supposedly). It says S3454 on the box and the manual says its a 3 in 1 device, and that seems to check out its the right product.

Im getting lost in wiki's and forums... I thought id ask you as youve written the template, so maybe you have straight answer. I want to query the temp or humidity and get it on MQTT.

Is there either a specific console command for querying the temp/humidity... or an MQTT command....or should it just be flashing up on the console from time to time?

Ive tried the console weblog 4 setting... but the things that look close, dont seem to have a match for the data I think I need.

{"Data":"55AA030700086A0200040000001D9E","Cmnd":7,"CmndData":"6A0200040000001D","DpType2Id106":29,"106":{"DpId":106,"DpIdType":2,"DpIdData":"0000001D"}}}
16:31:58 TYA: fnId=0 is set for dpId=106
16:31:59 MQT: tele/tuya/RESULT = {"TuyaReceived":{"Data":"55AA030700086902000400000136B7","Cmnd":7,"CmndData":"6902000400000136","DpType2Id105":310,"105":{"DpId":105,"DpIdType":2,"DpIdData":"00000136"}}}
16:31:59 TYA: fnId=0 is set for dpId=105

If youve any thoughts, advice or pointers.. it would be appreciated.

@patrickdk77

This comment has been minimized.

Copy link
Owner Author

@patrickdk77 patrickdk77 commented May 20, 2020

On mine it would send x69 and x6a randomly as the values changed. So you just need to parse them and send them via mqtt. I am not sure how easy that is in tasmota itself, if there is enough math functions to do that or not.

I didn't go into that area yet, or see if there is a tuyamcu matching object that would decode that, as the units I where using, I killed them both during the decoding of the battery operations as they did not like the cells I where using (recharable 4.2v) vs the 3.0 volt ones it wanted.

I plan to publish this information over on the templates page once I can actually verify my findings, vs just suggesting things based on my discovery without personally testing them.

In the cases above, the dpid 105 == temp, so take the dpiddata and /10 and you have the C value to report via mqtt
on the dpid 106 == humidiy and that you can just publish the dpiddata directly as the humidity %

if we can access the dptype2id directly in a rule that would be very simple, not sure if that is possible.
something like, on dptype2id105 publish tele/%topic%/tempature (%dptype2id105%/10) endon
and on dptype2id106 publish tele/%topic%/humidity %dptype2id106%

@erew123

This comment has been minimized.

Copy link

@erew123 erew123 commented May 20, 2020

Thanks for the reply... that's really appreciated... it gives me something to go on!! If I get any useful results with the things Im doing here, ill feed back!! :)

(oh.. and thanks for the battery warning... I was probably going to go down that route too!!)

@AgungLiem

This comment has been minimized.

Copy link

@AgungLiem AgungLiem commented Jun 8, 2020

Is there anyone that can get temperature and humidity from tuya siren?

@erew123

This comment has been minimized.

Copy link

@erew123 erew123 commented Jun 8, 2020

I did quite a bit of research on pulling this data via MQTT and ended up having a small chat with someone on the Tasmota discord server..... whom I think was partly linked into the developers of Tasmota (though not 100% sure they were).

Either way, the closest I found to an answer was a mix of what patrickdk77 said on the above post, that you can get the data to be displayed/shown within the console of Tasmota... The problem is that currently, as of version 8.3.1 of Tasmota there was no way to just send Temp/Humidity out via MQTT..... read on though.....

There is however a command within tasmota that you can send pretty much ALL data that appears in the console out via MQTT (I cannot for the life of me remember which one). So this would fire out that data to whatever you are using to receive MQTT, at which point you could do the mathematics that patrickdk77 mentions above to convert the numbers to their relevant measurement. As I say though ALL data... meaning there is a lot of additional noise/non-relevant data being sent out too.

There is a downside to doing this though.... If you are using a home automation platform that may end up processing a lot of rules for certain types of MQTT data, then your home automation may end up quite busy, because sending ALL information to MQTT from the Tuya 3-in-1 resulted in 4-8 MQTT messages every 2-5 seconds..... Its not the traffic thats the issue, as MQTT traffic very very small on your home network, but if you have a limited amount of CPU threads to process rules within your home automation setup, this could result in slower/missed processing of some rules and of course, overall higher CPU use. e.g. every message sent by the Tuya may have to have that calculation performed to convert the temp to Deg C... along with other rules that may be triggered by the Tuya MQTT traffic.

(The person who talked with me on the Tasmota forum, didnt quite seem to get the implication of thread processing at the back end and the impact of it.... though as I say, Im not 100% sure they were a developer... or if they were, which aspect of development they were involved in).

You could increase your thread count on your home automation software (if it allows it). It could in fact actually just be fine as it is. At the time of me looking into this, I was running my home automation on a lower powered device, which was already quite busy, so I didnt go much further with my testing and thought id stay away from it for now.

The long and short is that, yes, it is possible to pull the data out, but with some caveats/impact on your backend system thats processing the MQTT messages. The ultimate solution will be for someone to write in some custom code that pulls just the Temp/Humidity and sends that to MQTT.... and I did find the name of the developer who worked on the Tuya portion of Tasmota, though never contacted them.... But thats probably what someone needs to do, and hopefully they would be willing to look at it, if they have time.

@erew123

This comment has been minimized.

Copy link

@erew123 erew123 commented Jun 8, 2020

Just for the record, to summarize what patrickdk77 said above.... out of the data that you can see in the Tasmota console and if you set the command on Tasmota, send via MQTT, you will get 2 of the following JSON style messages out.

As you can see in them, you have one that is has 6A in its data, to signify its the Humidity data... and one that has 69, signifying this set of data is Temperature.

HUMIDITY - ID is 6A
{"Data":"55AA030700086A0200040000001D9E","Cmnd":7,"CmndData":"6A0200040000001D","DpType2Id106":29,"106":{"DpId":106,"DpIdType":2,"DpIdData":"0000001D"}}}

TEMP - ID is 69
{"Data":"55AA030700086902000400000136B7","Cmnd":7,"CmndData":"6902000400000136","DpType2Id105":310,"105":{"DpId":105,"DpIdType":2,"DpIdData":"00000136"}}}

The DpidData is the Temp or humidity value, that you need to pull... So as of Tasmota 8.3.1 (later versions may just work without this). You would:

  • Turn on all Tasmota messages to be sent out via MQTT (on your Tuya 3-in-1)
  • In your home automation software, look for MQTT messages with the first 14 digits of JSON Data, having its last 2 digits be 6A or 69.... or the first 2 digits of CmndData being 6A or 69... so that you can identify these are Temp/Humidity messages. (so you would need to do a convert/Regex on those fields, then match the numbers up).
  • Extract the DpidData and convert Hex to Decimal.
  • Temp would need its Decimal dividing by 10 e.g. 290/10 = 29 Deg C
  • Humidity doesnt need any further conversion.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.