Bi-stable Button: Maintaining Device & Button State Consistency?

Bi-stable Button: Maintaining Device & Button State Consistency?

@Andreas Gudmundsson

Is there a way to manually set the state of a bi-stable button without updating the value in the device’s bucket?

I used these buttons to send toggle commands to my devices like on/off, but I kept running into the issue where if a command wouldn’t go through, the button’s state would not match the device’s state.

As an example, let’s have a device that can report back to Tago on a timer. Button state 1 will enable reporting and button state 2 will disable it. If I send the command to enable reports and it does not arrive to my device for any reason, I would now need to send a disable command before I could try to enable it again.

My current solution is to split it up to an input form (to send the command) and card (to show the device’s actual state). A single button that reflects the actual state would be much more compact and intuitive.

The ideal solution would be to stay on the current state until an acknowledgement is received, maybe similar to the “Wait for validation to unlock submit button” setting that the input form widget has? Would having the button directly call an analysis instead of sending a value give me any more flexibility? If anyone has any other ideas using analysis, sdk or otherwise I’d be happy to hear them! Thanks!