I’ve got 1 computerscreen in my office, and one tablet on the wall in our house, doing most of the time nothing.
And I would like to show some different things on there. Call it a kind of dashboard.
To give an example:
Screen 1: Global view of groups/scenario’s (how many lights are on, is the alarm activated…)
Screen 2: 4 IP-camera views
Screen 3: A few graphs (fe electricity consumption, temperature…)
…
And let rotate/loop these screen every 5 seconds.
And in case of triggering a sensor, a popup…
In the past, I created some static webpages, that refresh each x-time. But would of course like to use OH for this. 1 application for all…
rule "roll screenpage"
when
System started or
Time cron "0/15 * * * * ? *" // every 15 secs
then
if (ScreenPage.state == NULL) {
ScreenPage.postUpdate(1) // initialize
} else {
var page = (ScreenPage.state as Number) + 1 // increment
if (page > 3) page = 1 //max
ScreenPage.postUpdate(page)
}
end
Sitemap fragment
Frame label="Page One" visibility=[ScreenPage==1] {
Text item=Blah
Text item=Bleh valuecolor=[>2="red"]
}
Frame label="Page Two" visibility=[ScreenPage==2] {
Text item=motionX valuecolor=[OPEN="red"]
Text item=motionY
}
Frame label="Page Three" visibility=[ScreenPage==3] {
Switch item=test_motion mappings=[ON="Detect"] visibility=[motion_U1gate!=ON]
Switch item=test_motion mappings=[ON="Motion!"] visibility=[motion_U1gate==ON]
Text item=prowler
Text item=aggregate
Text item=Offsite valuecolor=[>2="red"]
}
Seems to work well in Win/Chrome browser, ClassicUI. Even with different number of lines in “pages”.
Untested with varying image insert sizes.
Nice, your code seems to work perfect.
Now I can starting to building some interesting screens/frames.
ps you don’t know if this could work for the HABPanel? I never worked with that (time issue). But I’ve seen some nice build-ups. You can put more things next to each-other (fe videosurveillance). Would be nicer to put more data on 1 screen…
HabPanel has a setting where you specify an item. When the item changes, the dashboard will change.
from the docs:
When this item changes to a dashboard’s name, switch to it This allows controlling the currently displayed dashboard by an openHAB item (useful with rules and as a side-effect to commands)
Possible to an extent I think for sitemap based display. Maybe create another Switch Item to indicate “pageroll blocked”. Use expire binding for the timeout, update to OFF on expiry.
Put all controls on your sitemap - switches, sliders etc. - in some master Group.
Have a rule trigger on any command to a Group member. That’s the active user detection. This rule sends ON to the blocker Item.
The page-roller rule would be modified to do nothing if blocker is ON.
I do not think there is a way of feeding back to OH that a user is opening/closing subpages though, so that’s undetectable activity.
In practice though, if they’re looking at a subpage they are not looking at the page with the rolling frame, so dpepending on your layout it might all work out okay.