Blackymas / NSPanel_HA_Blueprint

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

`Enhancement` Show alarm panel when triggered for quick deactivation #1955

Open NiC1305 opened 6 months ago

NiC1305 commented 6 months ago

Enhancement Summary

Show alarm panel when triggered

Detailed Description

Hello, thank you for the project. Would it be possible to bring the alarm control screen to the foreground for deactivation, as long as the alarm is activated and a trigger is activated. In the same way that a trigger wakes up the screen Thanks

Additional Context

No response

M0uC0 commented 6 months ago

Quoting @edwardtfn in https://community.home-assistant.io/t/sonoff-nspanel-blueprint-configure-your-own-custom-nspanel-easy-via-a-blueprint/500577/800


You can use the open_entity_settings_page to call the alarm page with the alarm entity you wanna show: How to - Call a Page Directly - Entity-Specific Pages 1.

You can then check for the sensor “Current page” to wait for page “alarm” to be visible. Once that page is visible, you can use the service send_command_printf to run command click bt_disarm,0 which will simulate the release of a click on button disarm:

service: esphome.xxxxx_send_command_printf data: cmd: click bt_disarm,0

NiC1305 commented 5 months ago

In order to make a small improvement, would it be possible for the numeric keypad to take up the entire screen, in fact the number keys are quite small and I think this would be more comfortable to use

edwardtfn commented 5 months ago

Which model are you using? EU, US or US Landscape?

NiC1305 commented 5 months ago

I use EU

PoopingNow commented 4 months ago

I was able to open the alarm page when i unlock my door, by calling the esphome entity page, as i am using alarmo. However, once the alarm page is opened the "click bt_disarm,0" is not working, i am not able to open the pin pad / disarm page. Ii tried to increase the wait time and other options online, but none seems to work.

M0uC0 commented 4 months ago

Hello.. API has changed since the post.

now u have to use the

ESPHome: "your_nsp_panel"_entity_details_show service..

entity: your_alarm_entity back_page: home

ESPHome: "your_nsp_panel"_command service..

cmd: click bt_disarm,0

and maybe checking the "current page" on automation if it is at alarm.. before the click.

PoopingNow commented 4 months ago

Thank you for the prompt reply. Yes i am using the latest API and exactly per the above.

ESPHome: mainpanel_entity_details_show

entity: alarm_control_panel.alarmo back_page: home

At this stage, the alarm panel will load with the option to arm / disarm etc... As per the normal behaviour.

ESPHome: mainpanel_command cmd: click bt_disarm,0

At this stage, the disarm window does not load. I expect it to load the disarm window, where there pin pad is visible for easy capture of the disarm code.

Can point me in the right direction? I could not locate the get current page function in the API list.

edwardtfn commented 4 months ago

What if you call click bt_disarm,1 instead?

PoopingNow commented 4 months ago

Tried that as well. I even added a delay of 100ms before i call click bt_disarm,1. then another delay of 50ms to simulate and actual button press. Then release the button by calling click bt_disarm,0.

I also tried to increase the delay or without the delays as well. Anyway I will leave it as is for now.

denes44 commented 4 months ago

An option to prevent any navigation from the disarm screen when the alarm is triggered would be nice (#1361).

PoopingNow commented 4 months ago

I was finally able to get it working. I guess when using Alarmo you have to call the keyboard page as well, as it will not load automatically. I have not refined the code yet and to test multiple scenarios, but for now the below is working. I am calling this function when I unlock the main door, using an Aqara U100 lock.

ESPHome: mainpanel_entity_details_show entity: alarm_control_panel.alarmo back_page: home

Wait 250ms

ESPHome: mainpanel_command cmd: click bt_disarm,1

Wait 250ms

ESPHome: mainpanel_command cmd: click bt_disarm,0

ESPHome: mainpanel_command cmd: page keyb_num