I see that you can password protect going to a custom page, but is there a way to password protect a button action? I have several buttons that I would like to have require a pin before the action is taken. Thanks!
You can use prompt
. Here’s an example:
Thanks, Bill. Any chance this will work for a custom button/toggle/switch? I’m not using tiles.
Yes. Any Button can call a ScriptAction. It doesn’t have to be a tile.
Okay. Cool. Thanks. Much appreciated!
Is there any documentation on script writing in Home Remote? Thanks!
The Home Remote uses JavaScript for its syntax. There are plenty of online sources to help you learn the language.
Thanks. Wasn’t sure what language Home Remote was using.
One question. Is there a way to detect if the “cancel” button was pressed? Right now if the user cancels the pin dialog, they still get the alert that the wrong pin was entered. Thanks!
null
should be returned if the user cancels. You can change the else
in that example to an else if (promptResult)
& that should only show the “wrong pin” message when the user clicks OK with entered text.
var promptResult = prompt("Please enter the pin number (1234):");
if (promptResult == "1234") {
App.SetDeviceAttribute("@Device.Switch", "Off");
}
else if (promptResult) {
alert("You've entered the wrong pin");
}
That did the trick. Thank you!