FHEM Forum

FHEM => English Corner => Thema gestartet von: roelb am 09 September 2019, 23:04:58

Titel: Tablet UI: switch pages based on reading
Beitrag von: roelb 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.

Titel: Antw:Tablet UI: switch pages based on reading
Beitrag von: kaihs 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 (https://play.google.com/store/apps/details?id=de.ozerov.fully) as the browser on your tablet this can be remote controlled using the FULLY (https://fhem.de/commandref.html#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.
Titel: Antw:Tablet UI: switch pages based on reading
Beitrag von: kroman 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.
Titel: Antw:Tablet UI: switch pages based on reading
Beitrag von: roelb am 10 September 2019, 10:27:46
Cool, thanks! I was indeed missing the obvious here..