Blackymas / NSPanel_HA_Blueprint

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

Feature Request: "Adaptative Hardware buttons" #1014

Open fordcrews opened 1 year ago

fordcrews commented 1 year ago

Have the hardware buttons change based on the page you are on, so when on climate page they could change temperature. When on Alarm page (future) they could arm the alarm as home or away. When on button page they could give you 2 extra buttons, etc.

Also might be nice if on the main page, they adapted to the last 2 buttons pressed. So you when you slide to page 3 of buttons, turned on back Poarch light, or whatever, 30 minutes later when you realize you forgot to cut it off you could just hit the hard button, and not have to flip back to whatever page and find it again.

Doughboy68 commented 1 year ago

I like this idea except for the 2nd part last 2 buttons pressed would get confusing, especially if others are using the panel. I use some panels with direct relay control of lights, so this would need to be an option if implemented.

Could have defined entities for the hardware buttons on each of the four button screens, and preset for pages eg. climate page change temperature +/-, fan page increase/decrease fan, cover page open/close/position step, light bright up/down in 10% step etc.

I also notice that nspanel lovelace has multi-tap for hardware buttons.. up to 5x I think. Wonder if that would be possible also - even double tap would probably be ok in addition to hold option (if so I can open a separate request).

edwardtfn commented 1 year ago

if so I can open a separate request

Yes, please! 😂 It makes much easier to have the discussions and keep track of the development.

fordcrews commented 1 year ago

I like this idea except for the 2nd part last 2 buttons pressed would get confusing, especially if others are using the panel. I use some panels with direct relay control of lights, so this would need to be an option if implemented.

I was thinking that if you didn't a hardware button a function at all, it could auto become the last one/ones set from the buttons page. I could even see it being a rolling queue, where you double tapped it swapped among your last-x or favorites eventually. That way you could have multiple of these with the same automation just copied and the new device picked and saved. No editing other modifications done. Go to the buttons tabs find lights in the room that ns panel is in and assign them there to the buttons or maybe someday double tap through favorites list.

Come to think of it, you could double tap to swap between buttons on first page of buttons, triple tap to swap to 2nd page and continue double tapping through buttons till you find the one you want. The button labels would always tell you what the button currently does.

edwardtfn commented 1 year ago

This is becoming complex... 😂

fordcrews commented 1 year ago

Was just throwing out ideas to see what sticks. ;-) I'm old, I always liked my flip phone that had the 2 hard buttons that changed function depending on what screen you were on.

edwardtfn commented 1 year ago

Keeg going, please... I just want to adjust expectations, so no one gets frustrated, but this kind of brainstorm is always good to enable the criativity mode in all of us.

grigi commented 1 year ago

For the first part: You could make the buttons trigger an automation that then checks what screen is being displayed and then do different things for different screens?

edwardtfn commented 1 year ago

Know the current screen is easy, but know the entity_id shown is not that easy. We could of course have a sensor for that, but that would take a bit more of memory.

edwardtfn commented 1 year ago

Not far from #1189

roderik-maker commented 11 months ago

I just opened an issue for this and then discovered this thread and closed it. Here was my idea for the implementation:

I envisioned there being an option to overwrite the default button actions on a per page basis with an optional setting in the blueprint for each page.

Potential issue: I haven't looked at the code yet so not sure how feasible this would be and what impact it might have on reliability. How reliably does the panel know what page the display is showing? If the display fails to pas a displayed page state change to the backend, this could be problematic for users trying to toggle their light (pressing a few times) and accidentally raising their thermostat to 30 degrees without realising it (because the backend still thinks the climate page is showing)....

^ I was thinking of having the buttons trigger a script in HA that uses the "current page" sensor to determine the action but don't I trust the ESPhome status updates over my wifi enough. I'd much rather process what action is called locally on the device as it removes a potential point of failure and keeps more functionality if the wifi connection drops.

edwardtfn commented 8 months ago

How reliably does the panel know what page the display is showing?

This is a good point. I believe this is very reliable, however, it might take some delay (I'm talking about millisecs) while one page was closed and the new one still being created on Nextion and ESPHome was not yet informed about the change (and the communication time over serial in top of that). We can send the info when a page was closed, so ESPHome will know the page info is obsolete and we can use that to handle the button thing nicely (maybe doing nothing during the transition). All of this must be handled. And the page based action will have to be all loaded to ESP memory, otherwise we have also to add the time to communicate to HA and back, then we could be talking in a couple of seconds for a slow/busy Wi-Fi.

My main concern with this approach, however, is adding a lot of new inputs per page. We have more than 20 pages currently and the existing inputs on the blueprint settings are already too long.

mauritsivs commented 5 months ago

Is this request not being worked on? I would really love this functionality