Sonoff Bridge -Tasmota - Jason Commands

49 views
Skip to first unread message

Garth Juul

unread,
May 3, 2025, 11:33:33 AMMay 3
to TasmotaUsers
I have a Sonoff Bridge (not pro) running with Tasmota 14.6.0 connecting to a Sonoff Zigbee Smart plug. The plug pairs to the bridge no problem and sends updates to it on a regular basis. My problem is that I can send basic commands to the plug using Mosquitto_pub and it responds favourably to those commands - Zbinfo, name change etc. however whenever I send any command containing a Jason string I receive a Jason Error response on the Sonoff Zb Bridge web page. I am using examples from the Tasmota documentation and anywhere else I can find published working command strings on various boards etc. Unfortunately nothing has worked.
Any ideas as to the correct Jason format or if I am missing something and am completly out to lunch ?
Thanks in advance for any assistance !

Justin Adie

unread,
May 3, 2025, 11:50:39 AMMay 3
to Garth Juul, TasmotaUsers
Perhaps share an example string that you are trying and we can help find out where things are going wrong.
.

--
You received this message because you are subscribed to the Google Groups "TasmotaUsers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonoffusers...@googlegroups.com.
To view this discussion, visit https://groups.google.com/d/msgid/sonoffusers/29995cbe-5591-4855-afc2-ac88fd0af682n%40googlegroups.com.

Garth Juul

unread,
May 3, 2025, 12:59:15 PMMay 3
to TasmotaUsers
Thanks for getting back to me. Here are a couple of the examples.

Works

mosquitto_pub -d -h 192.168.1.30 -p 1883 -t tasmota_2mqtt/cmnd/Zbping -m 0x219F
mosquitto_pub -d -h 192.168.1.30 -p 1883 -t tele/tasmota_975B04/SENSOR/cmnd/Zbping -m 0x219F

Giving Jason Error

mosquitto_pub -d -h 192.168.1.30 -p 1883 -t tasmota_2mqtt/cmnd/ZbSend -m {"Device":"0x219F","Send":"Power":0}
mosquitto_pub -d -h 192.168.1.30 -p 1883 -t cmnd/tasmota_975B04/ZbSend {"Device":"0x3122","Send":"Power":"Off} }

Regards

Justin Adie

unread,
May 3, 2025, 1:37:07 PMMay 3
to Garth Juul, TasmotaUsers
The JSON format of the zbsend command is not quite correct. The send command has nested json below.  Try this as the payload

yorkc...@gmail.com

unread,
May 3, 2025, 4:02:30 PMMay 3
to Justin Adie, TasmotaUsers

As you indicated I published the following:

C:\temp\mos2>mosquitto_pub -d -h 192.168.1.30 -p 1883 -t tasmota_2mqtt/cmnd/ZbSend -m {"Device":"0x219F","Send":{"Power":0}}

 

Received the following  messages from the Subscriber that message was sent and received.

Reflected on the Sonoff Bridge web page and returned to the subscriber “Invalid Jason”.

I have tried so many different computations that I am sure I have tried the one you have suggested.

 

Regards


Virus-free.www.avg.com
image001.png
image002.png

Philip Knowles

unread,
May 3, 2025, 4:59:33 PMMay 3
to yorkc...@gmail.com, Justin Adie, TasmotaUsers
According to Steve's Internet Guide
When it comes to publishing with the mosquitto_pub client you need to escape the quotes so that they are included.

mosquitto_pub -d -h 192.168.1.30 -p 1883 -t tasmota_2mqtt/cmnd/ZbSend -m {\"Device\":\"0x219F\",\"Send\":{\"Power\":0}}

It would be worthwhile using MQTT Explorer...

From: sonof...@googlegroups.com on behalf of yorkc...@gmail.com
Sent: Saturday, May 03, 2025 21:02
To: 'Justin Adie'
Cc: 'TasmotaUsers'
Subject: RE: Sonoff Bridge -Tasmota - Jason Commands

yorkc...@gmail.com

unread,
May 3, 2025, 5:06:44 PMMay 3
to Philip Knowles, Justin Adie, TasmotaUsers

Thanks for the response.

 

Getting closer – Now returns the message “Missing endpoint”

 

Regards

image002.png
image003.png

Philip Knowles

unread,
May 3, 2025, 5:17:50 PMMay 3
to yorkc...@gmail.com, Justin Adie, TasmotaUsers
Try

mosquitto_pub -d -h 192.168.1.30 -p 1883 -t cmnd/tasmota_2mqtt/ZbSend -m {\"Device\":\"0x219F\",\"Send\":{\"Power\":0}}


From: yorkc...@gmail.com <yorkc...@gmail.com>
Sent: 03 May 2025 22:06
To: 'Philip Knowles' <knowles...@gmail.com>; 'Justin Adie' <justi...@adieandco.com>
Cc: 'TasmotaUsers' <sonof...@googlegroups.com>
Subject: RE: Sonoff Bridge -Tasmota - Jason Commands
 
Message has been deleted

yorkc...@gmail.com

unread,
May 3, 2025, 5:38:48 PMMay 3
to Philip Knowles, Justin Adie, TasmotaUsers

Looks like my last response to the group was not sent.

 

Adding an Endpoint has it now working !!

Happy day !

 

C:\temp\mos2>mosquitto_pub -d -h 192.168.1.30 -p 1883 -t tasmota_2mqtt/cmnd/ZbSend -m {\"Device\":\"0x219F\",\"Endpoint\":1,\"Send\":{\"Power\":0}}

 

Thank you for pointing me in the right direction.

 

Cheers

Garth

image001.png
image002.png

Garth Juul

unread,
May 6, 2025, 10:57:32 AMMay 6
to TasmotaUsers
Thanks everyone !! It now works with the following string:

C:\temp\mos2>mosquitto_pub -d -h 192.168.1.30 -p 1883 -t tasmota_2mqtt/cmnd/ZbSend -m {\"Device\":\"0x219F\",\"Endpoint\":1,\"Send\":{\"Power\":0}}

Made my day !!

RRegards



Philip Knowles

unread,
May 6, 2025, 12:22:05 PMMay 6
to Garth Juul, TasmotaUsers
It's worth downloading MQTT Explorer. It understands the 'escape' characters so you can just put the JSON in the dialogue and is much easier to use than command line. It's also easier to troubleshoot.
It's also worthwhile following the 'standard' for the topic format. Most tasmota devices will follow the following sequence
type/device/command (or parameter)
So commands would follow
cmnd/tasmota_2mqtt/ZbSend

Data will normally come back as
tele/tasmota_2mqtt/SENSOR
 or
tele/tasmota_2mqtt/219F/SENSOR
 or
stat/tasmota_2mqtt/...

From: sonof...@googlegroups.com on behalf of Garth Juul
Sent: Saturday, May 03, 2025 22:30
To: TasmotaUsers
Reply all
Reply to author
Forward
0 new messages