Toggle Button with Pin/Password

Hi all,

i am looking for a real simple possitlity,
to create a toggle button / switch, as stand alone or a list item with a pin / password protection.
Just a small secruity to ensure that the button can not be activated before a confirmation.

The pin code must not be encrypted.

Is there an existing solution?

This might work for you?

Thanks, for the very fast response,
i look already in the keypad widget, but it not realy fit to my requirements,
it is a bit to much - i just looking for a real simple button with an optional pin request for the main ui.
/nick

No, there is no “real simple button” option to achieve this.

Hey rlkoshak,
thanks too, so therefore I am looking for an alternative version ;).
have a good day ;).

Good luck, I’m unaware of any home automation system that provide this in a simple way.

How a “simple button” with a optional pin-request would look like?
I can’t quite imagine how this should look apart from a button which opens a keypad overlay (which is exactly what is possible with the keypad widget and what Rich suggested)

If you can describe your need a bit better (or just draw it in Paint) it would be easier to give you an advice here.

How it could like

→ Switch Button to “on” before the command will be sent, a prompt with a “pin window” will be shown, after entering the pin code correct → the command will be sent to the item.

as an easy idea

If it were that easy, it would already be implemented. It is not that easy.

you can maybe do this with a widget and widget propertes / variables.

I just want to be clear. I’m not saying that the request is impossible. It is very much possible. But it’s not going to be a simple toggle button to enable it. That doesn’t exist in openHAB nor does it exist in any other home automation system that I’m aware of (though I could of course have missed that it is supported somewhere).

1 Like

i’m sure almost anything is possible. I’m just trying to point OP into the right direction. without putting some work in it by himself, he won’t get far though :slight_smile:

my idea was to set a simple password as a property of a widget. in the widget also have an inputfield that gets sent to a text item state.in the widget there is a command button that is disabled, but gets enabled through a condition when item state == property code word.

maybe add a timer that resets the text item state after some time.

this is quite simple on the ui, but needs some “one time” work before.

that solution sounds good,
i think that could be a very useful widget for a lot of people who are using openhab.

@rlkoshak absolutly agree, there is no “simple” solution but i guess i wanna talk with all of you how we can arrange such a request or push it into the right direction that anyone may get such a widget ;).

thanks for all
Nick

You can file an issue on the openhab-webui but I wouldn’t hold my breath. The typical model implemented in OH 3 is to use authentication and role based visibility, not to make users enter a pin. For example, why have a pin to enter to flip a switch when you can just only show that switch to administration users who are the only ones who should be controlling it anyway? Why ask for a pin before an action if the user as already authenticated?

Furthermore, adding something like this is likely to be a huge effort requiring coordinated changes to multiple repos. So just asking for it isn’t going to go anywhere. A developer needs to volunteer to implement something like this and do most if not all of the work.

Remember, openHAB has been around for a decade and there are a lot of very smart people developing it and using it. It’s unlikely that hasn’t been implemented because no one thought of it. It’s not been implemented because:

  • no developer has wanted the feature themselves
  • the effort required to implement it is too great for the benefit
  • it’s impossible with the current architecture and framework
  • it’s impossible to come up with a solution that is comprehensive

Finally, and new users really don’t like to hear this, but openHAB and home automation in general is a software development effort. You as the administrator of openHAB or Home Assistant or what ever you are using are doing software development. It is going to be a lot of work. It’s going to require a lot of learning. It’s going to require the ability to learn, understand, and apply abstract concepts. There is no way around that. Given this, making something like this possible with a little bit of work but also giving you the developer full control over how it looks, what it does, etc. is often far better than a hard coded toggle that does something close to what you want but not quite and you have no recourse because configurability and customization was thrown out in favor of having a simple button.

There are some commercial systems that choose simple over capability like SmartThings and Google Assistant and Alexa. But generally, those systems are so limited as to make it impossible to realize what you want.

1 Like

If you look to the green “Home” button on the overview page at demo.openhab.org it still looks awfully like what you want. The code is not hard-coded in the widget, rather sent as a command (“1234”) to a PIN code virtual item whose change of state triggers a rule which itself sends the command if the PIN is correct.

You can probably simplify the design of the pin code entry to make it smaller so it fits in a “popover” or “sheet” modal, define props for the predefined PIN, item and command directly in the widget to avoid the rule and enable a “Confirm/Send” button only if the pin matches the configured one.
Then on a regular button (or anywhere accepting an action) you choose either “open popover” or “open sheet”, choose the above personal widget, and configure its props to your needs.

1 Like