Creating a prompt for a pin

Hi Bill, have a question for you, in HE you can password protect the Mode setting I would like to do the same HR. I tried your demo and applied it to the mode in HR, the prompt worked but when I called the details page nothing displays. Now when it’s called normally it is called by a Method (tab, details page). Can this be done via a script?

One more separate question, I have a text label that is filled by a binding that is sending data in lower case, can the text be turned to upper case Eg: The Fan is now: on I want it to say (The Fan is now: On or ON) note I’m, using a multi binding The Fan is no on: {0}. Hope this is not to confusing.

Dan

The Home Remote will not prompt for a pin when changing the Hubitat mode.

There isn’t any way to change the character casing.

Thank you for getting back to me

Are these query parameters on the URL? What error do you see when you try to change the mode without a PIN?

Hey Bill, the mode change works fine from the templates that are supplied when I installed hubitat in Home Remote Designer, I copied and modified the locationTile.xaml where in the JavaScript item I added the prompt for pin and then I called locationDetails.xaml by replacing the secure content page with locationDetails.xaml and removed the MethodAction item so there was just the ScriptAction left. No error on the screen when the content page opens. The details page has a Gidview with itemsSource and selectValue filed in, nothing in items… I added a label on the Content page with some text in it and it shows but not the GridView. I guess the grid comes up when the itemssource and itemsvalue are called?

Dan

If I were to guess, it’s that you aren’t opening the details page properly. In your script you should do exactly what LocationTile.xaml is doing.

Tile.OpenDetails();

Since you haven’t shared your script, I can’t tell you exactly what’s wrong with it.

For devices, don’t use the page functions that require the filename as a parameter. It’s better to use the Tile method or App.OpenDeviceDetails method. That way the @Device context is set properly.

Hi Bill, I’m really sorry not sharing my script, I would be glad to… I’m new to this community stuff, if it was my daughter she would probably know how. Do I just past it into the reply or is there something else, you will have to for give this 70 year old…

Dan

No worries. Normal copy-paste is fine. It’s usually a little easier to read when you use the 3 ticks at the beginning & at the end.

Well here we go var promptResult = prompt("Please enter your pin number"); if(promptResult == "1234") { App.OpenPage("LocationDetails_db.xaml"); } else { alert(“Pin Error"); }

_db is my modified templates Bill.

Dan

So doesn’t my previous response solve your issue?

The only way your code is going to work is if you removed all @Device references from LocationDetails_db.xaml since you aren’t passing the @Device context properly. My recommendation as stated earlier is to call

Tile.OpenDetails();

or

App.OpenDeviceDetails("yourdevicename");

You can only call Tile.OpenDetails from an actual Tile named “Tile” so you may have to call OpenDeviceDetails depending on where it is being called from.

Thanks Bill for all your help, I’ll work on this tomorrow, and give it a go. Again thank you

Dan

Good morning Bill made the correct changes to the script that you pointed out to me and it works great, just like I wanted it to. Very happy and I learned something new. Take care and have a great day.

Dan

1 Like