JSON API equivalent to &T=2 power toggle?

I see in the docs for the json API, that the on state can be set with a true/false boolean. Is there a way to send a power toggle command instead of on/off? The older HTTP request API had this:


to send a power toggle command. I can’t seem to find an equivalent toggle command for the json API. Am I missing it somewhere? Or do I need to do a state lookup first, then a 2nd command to set the on/off state to be opposite of the current value?

I thought I saw @Aircoookie say you can send HTTP commands via json, but I can’t find it now.

Yes, this is explicitly supported via JSON.

The method is explicitly documented in the Changelog, and the code that supports the option is still enabled.

#### Build 2105171
* Always copy MQTT payloads to prevent non-0-terminated strings
* Updated ArduinoJson to 6.18.0
* Added experimental support for `{"on":"t"}` to toggle on/off state via JSON

FYI, I do not believe toggle is supported for individual segments.

Thanks for the tip @henrygab!

1 Like