zaptec icon indicating copy to clipboard operation
zaptec copied to clipboard

Disable "Authorize charging" and "Deauthorize charging" buttons if authorization is not required?

Open sveinse opened this issue 4 months ago • 6 comments

If the user have not enabled authorization required, should we disable the "Authorize charging" and "Deauthorize charging" buttons?

The former is a command that only work when native authentication is selected. The latter is actually an official command which the API docs doesn't really say anything about not issuing in any mode.

sveinse avatar Aug 17 '25 14:08 sveinse

Why not, Do not show the "Authorize charging" and "Deauthorize charging" buttons if authorization is not required, instead of disable them? Less confusing IMO.

c0mplex1 avatar Aug 17 '25 19:08 c0mplex1

Do you mean disabled as in disabled using entity_registry_enabled_default=False or by setting them as unavailable like we did with Stop/Resume charging? Afaik, we are only able to control entities with entity_registry_enabled_default or entity_registry_visible_default the first time they are added, so could get confusing if users update their authentication-type-setting.

Yet another option would be to have a button press trigger an error message along the lines of "If you want to use authorization, you need to enable native authentication in zaptec portal. If you do not intend to use this functionality, you can safely disable this button."

steinmn avatar Aug 17 '25 20:08 steinmn

Since we are making some buttons unavailable on certain conditions, it could seem to indicate that the rest are always available. But they are not, and I wondered if we should conditionally disable/unavailable them as well.

As we discussed earlier, there is no such thing as "read-only" on buttons (I hope not for long), which leaves us with using unavailable only.

sveinse avatar Aug 17 '25 21:08 sveinse

I wondered if we should conditionally disable/unavailable them as well.

Maybe, perhaps we should see how much confusion the unavailable buttons create first. So far it's been quite a mixed bag... In the case where authentication-type is disabled or non-native, the buttons will never have a function, which is why it would be nice to have them fully disabled and not just unavailable. But as mentioned, I think the users have to do that themselves unless we do it in the initial setup.

there is no such thing as "read-only" on buttons (I hope not for long)

Does the "hope not for long" part mean you've seen indications/issues/PRs pointing to this getting implemented? 🤞🤞

steinmn avatar Aug 17 '25 21:08 steinmn

there is no such thing as "read-only" on buttons (I hope not for long)

Does the "hope not for long" part mean you've seen indications/issues/PRs pointing to this getting implemented? 🤞🤞

There is this feature request: https://github.com/orgs/home-assistant/discussions/13

sveinse avatar Aug 17 '25 22:08 sveinse

There is this feature request: https://github.com/orgs/home-assistant/discussions/13

Upvoted👍

steinmn avatar Aug 18 '25 05:08 steinmn