Have a property that could be set or unset by automation or any other mean to enable/disable a switch or any element of interface This in order to avoid a user click when the conditions are not met. I still want it visible (so not hidden) so the user knows it is there.
this custom integration might help you out: GitHub - frenck/spook: A scary 👻 powerful toolbox 🧰 for Home Assistant 🏡
You already have template switches, where you can define your own criterias for availability through availability templates.
If you want a read only version of the switch to display to them without having to create a new entity you can do this in your dashboard card: Read only sensor/helper display without templates
Blockquote
this custom integration might help you out: GitHub - frenck/spook: A scary powerful toolbox for Home Assistant
Thanks for the input, but Spook is not a core feature, I’m looking something that would be directly available in HA, hence the WTH
Blockquote
You already have template switches, where you can define your own criterias for availability through availability templates.
I’m afraid this does not address the request. The request is to have a switch interface greyed out under certain conditions to prevent any action on it.
Blockquote
If you want a read only version of the switch to display to them without having to create a new entity you can do this in your dashboard card: Read only sensor/helper display without templates
This is interesting but what I am looking for is a way to act dynamically on it with some automation. I don’t think it is possible.
The only other solution I know of is the restriction card. But you said you are not interested in 3rd party solutions.
not that I’m not interested in, I use quite a bunch of those already, but I just think it would be a nice addition to the core
given that Spook is managed by frenck (one of the main contributer of HA) and it was written on the Spook, these functionalities will not be moved into HA, I would assume this might not happen in the future.
As I said, if, in your template, you define that availability
is False in some conditions of your choice, the UI will show the switch greyed out, not interactive, exactly as you describe.
Oh, I did not realise an availability template had been added to the template switch. This is indeed the best solution.