Switch type Item - no documented TOGGLE command.
From REST API, you can send ON , OFF and get the expected result.
You can send nonsense like RHUBARB, response 400 and is ignored.
But you can also command TOGGLE and get response 200, accepted. And the switch state will toggle OFF->ON, ON->OFF,
However, some hidden actor is doing that … what actually arrives on OH events bus is an ON or OFF, never a TOGGLE.
I know little of REST endpoints but there looks to be a “special” one for TOGGLE.
openHAB Item itself does not support TOGGLE.
Okay, doing a similar exercise for a Dimmer type, similar results. Except that the mystery actor converts TOGGLE to UP / DOWN commands which are ignored by Dimmer Item type.
Conclusion, the REST endpoint isn’t dealing properly with TOGGLE for Dimmer type. It’s open to debate what exactly is a “toggle” of a dimmer at e.g. 75%, but presumably similar actions to autoupdate dealing with ON/OFF might be acceptable. Or perhaps the endpoint is not intended for dimmers at all, and should bounce the command with a 400 response.
Reading that linked issue report and the PR discussion linked from there, I guess the best idea is us implementing this completely client side and not using the TOGGLE command at all. After doing so it looks like the maintainers are happy to nuke TOGGLE command support from the code base.
I read the issue too and agree that it does look like TOGGLE is going to be removed at some point.
What logic would you use to implement TOGGLE for a dimmer? Read the current state of the dimmer and it it’s >0 set to OFF else set to ON?
I don’t know if all dimmers work the way mine do. My dimmers remember the last setting they were set to when they were on. I.e., if you dim them to, for example, 33% then turn them off and then turn them on they return to 33%. This means that issuing a sequence of OFF and ON commands toggles them between off and the previous brightness setting.
If your UI issues ON and OFF commands, this should all “come out in the wash” when the ON/OFF arrives at the binding. It is the binding that understands the hardware and should make the decision to actually send an ON or 100% etc. to the device.