Help with Tasmota and MQTT

Hi

i am new with Tasmota and MQTT. I have a temperature/humidity Tuya sirene. I flash it with Tasmota successfully and I conect the device with HA through MQTT. I can turn on and off the sirene without any problem.

I enabled tuyaMCU, setup weblog 4 and found two Ids being transmitted - 105 and 106, first for temp and second for humidity.

Then i run in Tasmota console
TuyaSend4 105,1
TuyaSend4 106,1

From that time i see the result in the console log:
13:59:40.936 {"TuyaReceived":{"Data":"55AA030700086902000400000130B1","Cmnd":7,"CmndData":"6902000400000130","DpType2Id105":304,"105":{"DpId":105,"DpIdType":2,"DpIdData":"00000130"}}}
So temperature is 304/10

13:58:08.274 {"TuyaReceived":{"Data":"55AA030700086A02000400000023A4","Cmnd":7,"CmndData":"6A02000400000023","DpType2Id106":35,"106":{"DpId":106,"DpIdType":2,"DpIdData":"00000023"}}}
So humidity is 35

How can i get these two values in HA? I was expecting to get the values in Tasmota as
MQT: tele/temp_sirene/RESULT =

Please advice…

Thanks in advance

if you check with mqtt explorer, that is what is transmitted ?

{% set my_test_json = {"TuyaReceived": {"Data":"55AA030700086902000400000130B1","Cmnd":7,"CmndData":"6902000400000130","DpType2Id105":304,"105":{"DpId":105,"DpIdType":2,"DpIdData":"00000130"}}} %}
The temperature is {{ my_test_json.TuyaReceived.DpType2Id105 | float / 10 }}

This is what i get in Tasmota device console and i want to get he value “DpType2Id105”:304,“105” in HA

But i think something is wrong with this because i was expecting to see (if i am not wrong) MQT: tele/temp_sirene/RESULT =

Note that temp_sirene is my MQTT topic

Where to put this code? in Tasmota Console?

Not always, I don’t have any that send TuyaReceived, but I got these :

image

try something like this :

  - platform: mqtt
    name: "Siren temperature"
    state_topic: "tele/temp_sirene/RESULT"
    value_template: >- 
      {{ (value_json.TuyaReceived.DpType2Id105 | float / 10 }} }}
    unit_of_measurement: "°C"
    device_class: temperature
    state_class: measurement      

Goes under sensor: in configuration.yaml

yes i tried that before posting the topic. HA does not recognize the value

Can you post what you receive in MQTT Explorer ?

15:35:24.440 TYA: Heartbeat 15:35:25.599 WIF: Checking connection... 15:35:31.587 {"TuyaReceived":{"Data":"55AA030700086902000400000128A9","Cmnd":7,"CmndData":"6902000400000128","DpType2Id105":296,"105":{"DpId":105,"DpIdType":2,"DpIdData":"00000128"}}} 15:35:31.590 TYA: fnId=0 is set for dpId=105 15:35:31.592 TYA: RX value 296 from dpId 105 15:35:32.458 TYA: Send "55aa001c0008011509130f232007ae" 15:35:35.220 {"TuyaReceived":{"Data":"55AA030700086902000400000129AA","Cmnd":7,"CmndData":"6902000400000129","DpType2Id105":297,"105":{"DpId":105,"DpIdType":2,"DpIdData":"00000129"}}} 15:35:35.224 TYA: fnId=0 is set for dpId=105 15:35:35.226 TYA: RX value 297 from dpId 105 15:35:35.433 TYA: Send "55aa00000000ff" 15:35:35.442 {"TuyaReceived":{"Data":"55AA030000010104","Cmnd":0,"CmndData":"01"}} 15:35:35.445 TYA: Heartbeat 15:35:36.431 {"TuyaReceived":{"Data":"55AA030700086902000400000128A9","Cmnd":7,"CmndData":"6902000400000128","DpType2Id105":296,"105":{"DpId":105,"DpIdType":2,"DpIdData":"00000128"}}} 15:35:36.434 TYA: fnId=0 is set for dpId=105 15:35:36.436 TYA: RX value 296 from dpId 105 15:35:37.642 {"TuyaReceived":{"Data":"55AA030700086902000400000129AA","Cmnd":7,"CmndData":"6902000400000129","DpType2Id105":297,"105":{"DpId":105,"DpIdType":2,"DpIdData":"00000129"}}} 15:35:37.646 TYA: fnId=0 is set for dpId=105 15:35:37.648 TYA: RX value 297 from dpId 105 15:35:38.852 {"TuyaReceived":{"Data":"55AA030700086902000400000128A9","Cmnd":7,"CmndData":"6902000400000128","DpType2Id105":296,"105":{"DpId":105,"DpIdType":2,"DpIdData":"00000128"}}} 15:35:38.855 TYA: fnId=0 is set for dpId=105 15:35:38.857 TYA: RX value 296 from dpId 105 15:35:44.909 {"TuyaReceived":{"Data":"55AA030700086902000400000129AA","Cmnd":7,"CmndData":"6902000400000129","DpType2Id105":297,"105":{"DpId":105,"DpIdType":2,"DpIdData":"00000129"}}} 15:35:44.912 TYA: fnId=0 is set for dpId=105 15:35:44.914 TYA: RX value 297 from dpId 105 15:35:45.608 WIF: Checking connection... 15:35:46.118 {"TuyaReceived":{"Data":"55AA030700086902000400000128A9","Cmnd":7,"CmndData":"6902000400000128","DpType2Id105":296,"105":{"DpId":105,"DpIdType":2,"DpIdData":"00000128"}}} 15:35:46.121 TYA: fnId=0 is set for dpId=105 15:35:46.123 TYA: RX value 296 from dpId 105 15:35:46.433 TYA: Send "55aa00000000ff" 15:35:46.443 {"TuyaReceived":{"Data":"55AA030000010104","Cmnd":0,"CmndData":"01"}} 15:35:46.445 TYA: Heartbeat 15:35:57.457 TYA: Send "55aa00000000ff" 15:35:57.467 {"TuyaReceived":{"Data":"55AA030000010104","Cmnd":0,"CmndData":"01"}}

That is the tasmota console, not MQTT Explorer. Did you enable setoption66 ?

https://tasmota.github.io/docs/TuyaMCU/#tuyareceived

TuyaReceived~

Every status message from the MCU gets a JSON response named TuyaReceived which contains the MCU protocol status message inside key/value pairs which are hidden from the user by default.

To publish them to an MQTT Topic of tele/%topic%/RESULT you need to enable SetOption66 1.

nop. let me try

Masteroom Sirene Temperature

1 second ago

29.5 °C

It worked!!!

Thanks for a second time. You saved my day :slight_smile: