HASwitchPlate / openHASP-custom-component

Home Assistant custom component for openHASP
https://www.openhasp.com
MIT License
51 stars 12 forks source link

Feature request: pages max and page loop #38

Closed nagyrobi closed 3 years ago

nagyrobi commented 3 years ago

A way to specify how many pages are configured on the plate. Looks like hasp-lvgl only sends data about how many pages are maximum possible on the plate, not the number of pages containing objects. This currently results in the possibility to also switch to empty pages with next and previous.

Having a page interval configured would allow us not to go beyond that with previous and next, so the end-user doesn't get surprised by empty pages. Having an optional loop setting would allow for navigation to the first page after the last one when pressing next, and reversely to the last page after the first one when pressing prev.

Service to change page by the number directly would allow to jump to pages outside the interval, this would be helpful to show pages the user normally can't navigate to, for exceptional cases when warning messages have to be sent out like when on fire alarm, or handle special cases when a notification has to be dismissed first etc. Navigating away from this with prev/next would jump to the next page from the interval according to the loop above. This would also make a big difference between page next/prev and change page services, and would add a plus justification why we need both types of services.

fvanroie commented 3 years ago

With the feature pagenav, an option has been built-in to set a different page-number for next, prev and back/home commands. With this option you can arbitrarily assign any other page number for the page next, page prev and page back command.

This is not yet exposed as a parameter, but can/will be in a future update. Using these parameters, you can set as many/few pages you want to expose to the user using next/prev/home buttons. It is not tied to counting objects on a page. Some users might actually want an empty page...

This way, the user is in charge of the order of all pages. You can have "groups" of pages 1->2->3->1 and 4->5->6->4 etc... At the moment this order is initialized as a single group using all 12 pages by default, but can be configurable.

nagyrobi commented 3 years ago

Sounds nice. Looking forward to reading documentation about this.

dgomes commented 3 years ago

So should this be transferred to the firmware repo ?

fvanroie commented 3 years ago

These CC configurations can be handled by local page action on the plate:

    pages:
      prev_obj: "p0b1"
      home_obj: "p0b2"
      next_obj: "p0b3"

Pages max and page loop can now be configured in jsonl HASwitchPlate/openHASP#114.

nagyrobi commented 3 years ago

@dgomes please remove, and also from config

dgomes commented 3 years ago

Done in e39213ba65a74fc91e79ce5c8ac2d5351292a537