Don't know how to implement "disabled" entities

I have an app in which I would like to protect some settings against change with kind of a PIN code. This does not have to be super-robust in terms of “hacking”.

What I currently have is a field with a PIN code. Once I have the code entered, it stays there for a given amount of time until it is automatically cleared by a call-back. During this time, the UI should become unlocked and some other UI elements should become changeable.

So what I am looking for is a way to ‘disable’ UI elements. In a typical application, they would be ‘greyed out’ so that their values are readable but not changeable. But I do not know how this can be achieved.

As alternative approach, what I tried is to revert the UI elements to their previous change (in listener callbacks) when the PIN does not match. But this is not trivial because it requires maintaining a set of “shadow variables” that contain the last valid state. This quickly becomes rather complicated.

Any idea how disabling input entities could be achieved (or approximated)?

I only looked for 30 seconds, but found this:

Otherwise, you could try to get creative with something along the lines of a conditional and this:

Thanks, the love-lock-card did the job.

I did search but was looking for a solution from AppDaemon side, hence the question in this particular forum.

Will need to look into card-mod and how it may interact with AppDaemon.