Blackymas / NSPanel_HA_Blueprint

This allows you to configure your complete NSPanel via Blueprint with UI and without changing anything in the code
1.46k stars 261 forks source link

Feature Request: Alarm lock #1361

Open denes44 opened 11 months ago

denes44 commented 11 months ago

Hi,

I have a (I think) good feature in my own nspanel, and I think it's worth consider implementing in this project as well.

What is does, if the alarm's state becomes pending or triggered, it automatically wakes up the display and displays the disarm page with the numpad to disarm the alarm, and it does not let the user exit this page, and navigate anywhere on the panel. It also disables the hardware buttons in the triggered state, so the burglar does not have any control over the house (when the alarm is triggered, I close the blinds on the windows, turn off all the lights, and disable all the switches around the house, to make their "job" more difficult).

It is good, if the panel is next to the entry door, and it's used for the main alarm control panel, because you don't want the burglar to control your smart home.

NoFace3D commented 11 months ago

This would be definitely useful and not only for safety reasons, but also for some kind of "kids" mode, where in activated state, should be possible to lock particular functions and unlock them with code. Can you share your code until then?

denes44 commented 11 months ago

What I did for my own panel (before 4.0 and the alarm support), is that when the alarm's state changed to pending or triggered, I jumped to the disarm page, where you could enter the disarm code. And that page simply did not have a close/back button. And when the alarm's state changed to disarmed, I change the page to the home page.

This is not so easy in the 4.x version, because jumping to the keyb_num page to disarm the alarm is not trivial, this code is not working for example, because I need to specify the alarm entity somewhere else:

- lambda: |-
    disp1->goto_page("keyb_num");
    disp1->set_component_value("keyb_num.page_id", 23); //Calling from Alarm page
    disp1->set_component_text_printf("keyb_num.domain", "%s", "alarm");
    disp1->set_component_text_printf("keyb_num.key", "%s", "disarm");
    disp1->set_component_text_printf("keyb_num.value", "%s", "click");

What I would do in the current code:

A child lock feature is a different thing I thing, and needs further considerations.

denes44 commented 11 months ago

Also, is there a reason why the disarm page is that, khm... ugly?

And the buttons are rather small, they could fill the screen better.

This is how I modified for myself: image

edwardtfn commented 11 months ago

Also, is there a reason why the disarm page is that, khm... ugly?

My lack of UI skills... 😂

denes44 commented 11 months ago

My lack of UI skills... 😂

I thought it was an auto generated keypad, and it was on purpose for it to be a popup page not a full screen page.

edwardtfn commented 11 months ago

I've started with that auo generated page from Nextion, but in the end I've created it myself copying their design. And the pop up style was intentional. 😉 I like the idea of making that bigger and changing the colors to fit better the rest of this project. I don't use that keyboard on my panels, so that never bothered me, but I get your point and I fully agree it is quite ugly. It's my intention to have new detailed pages for other domains, which will include date/time and number, where we certainly will need this numeric keyboard to be working properly, so we will have to look at it anyways. Any help is very welcome. 😉

denes44 commented 11 months ago

Well the looks is a subjective thing, my main concern was the size of the buttons, it's usable, but the buttons can be much bigger.

edwardtfn commented 11 months ago

Indeed

edwardtfn commented 11 months ago

I will find some time to look at this.