Autor Thema: Tablet UI: switch pages based on reading  (Gelesen 5744 mal)

Offline roelb

  • New Member
  • *
  • Beiträge: 5
Tablet UI: switch pages based on reading
« am: 09 September 2019, 23:04:58 »
I've been looking all over the documentation, source and the german pages in this forum, but I can't seem to find an easy way to automate a simple task in the tablet UI frontend: switch a page whenever a certain reading changes.

My use case is simple: I use the "pagebutton" widget to seperate functionality onto different pages. It's one page per room, and some generic pages that are available everywhere.

The normal view in a room is the page with all controls for the room that the tablet is in. But for example, whenever the doorbell rings, I want TabletUI to switch to the page that contains the video feed from the door. Or whenever someone enters the house when the alarm is armed, I want to display a special page. I've been thinking about creating a "javascript" widget that would subscribe to a reading and run an arbitrary piece of code whenever the reading changes. But I can't shake the feeling that someone must have thought of this already and I'm just not seeing the obvious way to do this.


Offline kaihs

  • Developer
  • Hero Member
  • ****
  • Beiträge: 1068
Antw:Tablet UI: switch pages based on reading
« Antwort #1 am: 09 September 2019, 23:15:21 »
You are are looking for a solution on the frontend but maybe this suggestion is also helpful:

If you are running Fully as the browser on your tablet this can be remote controlled using the FULLY module.

So one can use a notify/DOIF/... to react on the changed reading and execute a
set fully url [url of the page to show]
to change the displayed page.
Banana Pi, Add-On Board mit 1.8" TFT LCD und IR-Sender, FHEM V5.9, CULFW V1.61, div. Homematic Komponenten, Pollin Funksteckdosen, Selbstbau CUL433 MHz, Jeelink Clone, EC3000
Selbstbau CUL868MHz für Wireless M-Bus, FHEMduino mit Logilink Temp.-sensoren und Auriol Wetterstation

Offline kroman

  • Full Member
  • ***
  • Beiträge: 109
Antw:Tablet UI: switch pages based on reading
« Antwort #2 am: 10 September 2019, 07:22:47 »
<div data-type="pagebutton" data-url="#page1.html" data-load="#page1" data-off-background-color="transparent" data-off-color="#606060" data-on-background-color="blue" data-on-color="#222222" data-active-pattern="(.*index.html||.*#page1.html)" data-icon="fa-home" data-device="d_ftui" data-get="state" data-get-on="1" class="default"></div>
<div data-type="pagebutton" data-url="#page2.html" data-load="#page2" data-off-background-color="transparent" data-off-color="#606060" data-on-background-color="blue" data-on-color="#222222" data-active-pattern=".*#page2.html" data-icon="fa-lightbulb-o" data-device="d_ftui" data-get="state" data-get-on="2" class="prefetch top-space"></div>
...

I'm switching the pages by means of the state reading of the dummy d_ftui.

Offline roelb

  • New Member
  • *
  • Beiträge: 5
Antw:Tablet UI: switch pages based on reading
« Antwort #3 am: 10 September 2019, 10:27:46 »
Cool, thanks! I was indeed missing the obvious here..