How to make button active only if the controlled item has specific value

I think the easiest option would be to edit / create your own widget that does exactly as you require.

I built a thermostat widget from someone else’s work, who in turn took inspiration from someone else’s widget.

You might even find a widget in the gallery that does what you need.

For example