Create a function to invert the state of a device

Hello
I created a scene to turn on a room with 2 doors that originally had only a switch for one door.
For this, I installed a SONOFF - Connected Switch Module on the existing switch and a SONOFF - Wireless « Button » Switch at the other door.

To do this, I wanted to define a scene so that when you press the push button, it toggles the state of the SONOFF - Connected Switch Module.

If the light is ON, it turns OFF
If the light is OFF, it turns ON

However, I did not find this function in the scenes.
I had to create 2 separate scenes.

Scene 1 Turn on the room
Trigger: Sonoff Button (Button Click) greater than or equal to 1
New Action
Retrieve the last state: SONOFF - Connected Switch Module
New Action
Continue only if: SONOFF - Connected Switch Module equals 0
New Action
Turn on the outlets: SONOFF - Connected Switch Module

Scene 2 Turn off the room
Trigger: Sonoff Button (Button Click) greater than or equal to 1
New Action
Retrieve the last state: SONOFF - Connected Switch Module
New Action
Continue only if: SONOFF - Connected Switch Module equals 1
New Action
Turn off the outlets: SONOFF - Connected Switch Module

With a state inversion function, only one scene would have been necessary.

Yes a « toggle » function, that’s not natively possible

Edit: is this a feature request in your post? If so, you haven’t posted in the right category.

Yes, it’s a feature request.
I’ve changed the category.
Thank you.

The feature has been available in Gladys since v4.23.1