im remaking the folder structure so it’s easier. give me 5 minutes
Get new zip. Unzip to conf / html… so that the habpanelex folder is preserved. OR unzip to a temporary folder, copy habpanelex folder to conf / html. Should work
This one is golden! Now I just need to figure out how to assign screen savers to devices.
Thank you so much!
Best, Jay
Awesome. Let me know how it works. And thanks for the suggestion. It is indeed a helpful feature to have different configuration per device/browser.
The item string name is saved to the browser’s local storage. So if you clear your browser’s local storage, you lose that. BUT the config is still actually in OH since it’s a string Item. I may need to add a way to load a pre-existing config id.
I’m seeing what your talking about with ID’s. I wasn’t planning to go to each device and set this up; ideally I would like to put the string ITEM as a object on the Habpanel itself so habpanelEx knows which habpanelEx config it should use/rotate through.
Here’s the ITEMs I created; tell me if this makes sense?
Switch Theater_Mode_Switch "Basement Theater Mode [MAP(On_Off.map):%s]" (HomeState) [ "Switchable" ]
String habpanelExConfig_V "[%s]" (HomeState)
Switch Bedtime_Mode_Switch "Up Stairs Bedtime Mode [MAP(On_Off.map):%s]" (HomeState) [ "Switchable" ]
String habpanelExConfig_H "[%s]" (HomeState)
I created 2 string items ( _H & _V ) which then I would create the config in your habpanelex interface for it to store and persist that info in those string items within OH.
_H meaning my horizontal panels would get this string widget
_V meaning my vertical panels would get this string widget
Is my thinking valid how to scale this?
Best, Jay
Yes you are correct. Your logic seems fine to me and HPEx will work that way. I would just make it “more generic” as far as item names…
V Device:
habpanelExConfig_V - contains the config
Theater_Mode_Switch_V - Switch to turn theater mode on/off
H Device
habpanelExConfig_H - contains the config
Theater_Mode_Switch_H - Switch to turn theater mode on/off
Hey Lucky,
What is the best way to insert the habpanelEx config into a panel?
I was thinking template widget and using code like this but it didn’t work as expected.
itemValue(‘habpanelEx_V’)
Would need it to pull the value of the item and be invisible on the screen.
Any advise . . .
Best, Jay
You mean have it displayed?
Just wanted to post a quick follow up.
I have tested with Opera on a Kindle Fire and all is good. Same with Firefox on Ubuntu.
I tried it on the HABPanelviewer on Android and it does not time out and return to home screen.
I’m not sure how habpanelviewer work. If it’s just a webview container, I don’t see why it shouldn’t. Also, the screensaver is part of the web app, it will not trigger Androids system (home screen) as you mentioned
Sorry, I was calling the screen that HPEx returns to “the home screen”, not Android’s home screen.
For example, I have “Home” defined as the panel to return to after 30 seconds in HPEx.
And the HAPPanelViewer never returns to Home.
HABPanelViewer is an app from the F-droid app store, I don’t know how it works either…
Not displayed; but hidden in the page itself so your habpanelex can reference it to know which screen saver config to use based on the page the tablet is sitting on.
I have 3 different habpanel configs save to 3 different virtual items now; just need to add those items to the specific panels so your habpanelex can reference them. Each panel will have 1 config tied to it.
Here’s the event log entries when I created them below:
2019-01-31 06:25:18.239 [ome.event.ItemCommandEvent] - Item 'habpanelEx_Bedroom_V' received command {"config_item":"habpanelExConfig","initComplete":true,"isShowInDrawer":true,"screensaver":{"isEnabled":true,"timeoutSeconds":300,"dashboardList":"Weather-Vertical,MainFloor-Vertical,KidsRooms-Vertical,Garage-Vertical","durationSeconds":120,"isFullScreen":true},"theaterMode":{"isEnabled":true,"isOn":false,"color":"rgba(0,0,0,0.90)","triggeringItem":"Bedroom_Mode_Switch"},"panelConfigItem":"habpanelEx_Bedroom_V"}
2019-01-31 06:29:05.530 [ome.event.ItemCommandEvent] - Item 'habpanelEx_Basement_V' received command {"config_item":"habpanelExConfig","initComplete":true,"isShowInDrawer":true,"screensaver":{"isEnabled":true,"timeoutSeconds":300,"dashboardList":"Basement-Vertical,Cameras-Vertical","durationSeconds":120,"isFullScreen":true},"theaterMode":{"isEnabled":true,"isOn":false,"color":"rgba(0,0,0,0.90)","triggeringItem":"Theater_Mode_Switch"},"panelConfigItem":"habpanelEx_Basement_V"}
2019-01-31 06:30:29.740 [ome.event.ItemCommandEvent] - Item 'habpanelEx_Livingroom_H' received command {"config_item":"habpanelExConfig","initComplete":true,"isShowInDrawer":true,"screensaver":{"isEnabled":true,"timeoutSeconds":300,"dashboardList":"Our House,Cameras,Up Stairs,Kids Room,Basement","durationSeconds":120,"isFullScreen":true},"theaterMode":{"isEnabled":true,"isOn":false,"color":"rgba(0,0,0,0.90)","triggeringItem":"LivingRoom_Mode_Switch"},"panelConfigItem":"habpanelEx_Livingroom_H"}
Make sense?
Best, Jay
Ahh I see. You mean load a specific config item that’s already created. I will add that…
Lucky!
You are the MAN! I believe this functionality / feature set should be part of the OH HabPanel standard build.
This allows you to control 3 different tablets using HabPanel with 3 different screen saver / theater mode settings all with rules now.
Great job!
Best, Jay
Here’s my working config:
items
// Vertical Tablets
Switch Bedroom_Mode_Switch "Upstairs Bedroom Mode [MAP(On_Off.map):%s]" (HomeState) [ "Switchable" ]
String habpanelEx_Bedroom_V "[%s]" (HomeState)
Switch Theater_Mode_Switch "Basement Theater Mode [MAP(On_Off.map):%s]" (HomeState) [ "Switchable" ]
String habpanelEx_Basement_V "[%s]" (HomeState)
// Horizontal Tablet
Switch LivingRoom_Mode_Switch "Livingroom Mode [MAP(On_Off.map):%s]" (HomeState) [ "Switchable" ]
String habpanelEx_Livingroom_H "[%s]" (HomeState)
sitemap:
Frame label="Tablet Displays" {
Switch item=Theater_Mode_Switch icon="cinemascreen" label="Basement Theater Mode"
Switch item=Bedroom_Mode_Switch icon="bedroom" label="Up Stairs Bedtime Mode"
Switch item=LivingRoom_Mode_Switch icon="office" label="Living Room Mode"
}
rules:
rule "Tablet in Bedroom Set Screen Saver Mode ON at 8 PM"
when
Time cron "0 00 20 ? * * *" // 8 PM Daily
then
Bedroom_Mode_Switch.postUpdate(ON) // Turn Tablet Screen Saver ON
end
rule "Tablet in Bedroom Set Screen Saver Mode OFF at 8 AM"
when
Time cron "0 00 8 ? * * *" // 8 AM Daily
then
Bedroom_Mode_Switch.postUpdate(OFF) // Turn Tablet Screen Saver OFF
end
rule "Enjoy the show in the Basement"
when
Item Switch_Basement_Light changed to OFF
then
Thread::sleep(5000) // 5 second wait
if (Basement_TV_Power.state != OFF && Basement_Power.state != OFF && Onkyo_Basement_Power.state != OFF) { // ONKYO and SELF Defined & TV
// Turn Tablet Screen Saver Black
Theater_Mode_Switch.postUpdate(ON)
Thread::sleep(1000) // 1 second wait
if (Alexa_Status.state == 'ONLINE') {
logInfo("Echo", "-----------------------------------------------------------------------------")
logInfo("Echo", "** Echo Speaking on Basement")
logInfo("Echo", "-----------------------------------------------------------------------------")
if (Echo_Basement_textToSpeechVolume.state != '70' ) { Echo_Basement_textToSpeechVolume.sendCommand('70') }
Thread::sleep(2000) // 2 second wait
Echo_Basement_TTS.sendCommand(" Excuse me, Please enjoy the show and don't forget your buttered popcorn.")
Thread::sleep(2000) // 2 second wait
logInfo("Echo", "Echo speaks - Excuse me, Please enjoy the show and don't forget your buttered popcorn.")
}
if (currMonth !== null) {currMonth = now.getMonthOfYear} // update the current month
if (currMonth != 12){
var DecimalType hue = new DecimalType(39) // 0-360; 0=red, 120=green, 240=blue, 360=red // Dark Tangerine
var PercentType sat = new PercentType(87) // 0-100
var PercentType bright = new PercentType(100) // 0-100
var HSBType light = new HSBType(hue,sat,bright)
BarLedge_Dimmer.sendCommand(new PercentType(100))
BarLedge_Color.sendCommand(light)
Thread::sleep(2000) // 2 second wait
BarLedge_Color.sendCommand(light)
Thread::sleep(2000) // 2 second wait
} else if (currMonth == 12){
var DecimalType hue = new DecimalType(7) // 0-360; 0=red, 120=green, 240=blue, 360=red // Scarlet Red
var PercentType sat = new PercentType(100) // 0-100
var PercentType bright = new PercentType(98) // 0-100
var HSBType light = new HSBType(hue,sat,bright)
BarLedge_Dimmer.sendCommand(new PercentType(100))
BarLedge_Color.sendCommand(light)
Thread::sleep(2000) // 2 second wait
BarLedge_Color.sendCommand(light)
Thread::sleep(2000) // 2 second wait
}
Wallplug_Basement_Dehumidifier.sendCommand(OFF)
Thread::sleep(2000) // 2 second wait
logInfo("WeMo", "Dehumidifier turned OFF in Basement because movie is starting")
logInfo("Echo", "Basement_Power - Basement Annoucement about Enjoying the Show and Onkyo state is " + Basement_Power.state)
logInfo("Echo", "Onkyo_Basement_Power - Basement Annoucement about Enjoying the Show and Onkyo state is " + Onkyo_Basement_Power.state)
if (BasementHumidifierDelay_tAlive === null) {
BasementHumidifierDelay_tAlive = createTimer(now.plusHours(3), [ |
BasementHumidifierDelay_tAlive.cancel()
Thread::sleep(2000) // 2 second wait
BasementHumidifierDelay_tAlive = null
// Turn Tablet Screen Saver OFF
Theater_Mode_Switch.postUpdate(OFF)
Thread::sleep(1000) // 1 second wait
logInfo("WeMo", "Dehumidifier turned back ON in Basement because movie is over")
Wallplug_Basement_Dehumidifier.sendCommand(ON)
Thread::sleep(3000) // 3 second wait
])
} else if (BasementHumidifierDelay_tAlive !== null){
BasementHumidifierDelay_tAlive.cancel()
Thread::sleep(2000) // 2 second wait
BasementHumidifierDelay_tAlive = null
}
}
end
What the items look like when you use HabPanelEX to configure them:
2019-01-31 06:25:18.239 [ome.event.ItemCommandEvent] - Item 'habpanelEx_Bedroom_V' received command {"config_item":"habpanelExConfig","initComplete":true,"isShowInDrawer":true,"screensaver":{"isEnabled":true,"timeoutSeconds":300,"dashboardList":"Weather-Vertical,MainFloor-Vertical,KidsRooms-Vertical,Garage-Vertical","durationSeconds":120,"isFullScreen":true},"theaterMode":{"isEnabled":true,"isOn":false,"color":"rgba(0,0,0,0.90)","triggeringItem":"Bedroom_Mode_Switch"},"panelConfigItem":"habpanelEx_Bedroom_V"}
2019-01-31 06:29:05.530 [ome.event.ItemCommandEvent] - Item 'habpanelEx_Basement_V' received command {"config_item":"habpanelExConfig","initComplete":true,"isShowInDrawer":true,"screensaver":{"isEnabled":true,"timeoutSeconds":300,"dashboardList":"Basement-Vertical,Cameras-Vertical","durationSeconds":120,"isFullScreen":true},"theaterMode":{"isEnabled":true,"isOn":false,"color":"rgba(0,0,0,0.90)","triggeringItem":"Theater_Mode_Switch"},"panelConfigItem":"habpanelEx_Basement_V"}
2019-01-31 06:30:29.740 [ome.event.ItemCommandEvent] - Item 'habpanelEx_Livingroom_H' received command {"config_item":"habpanelExConfig","initComplete":true,"isShowInDrawer":true,"screensaver":{"isEnabled":true,"timeoutSeconds":300,"dashboardList":"Our House,Cameras,Up Stairs,Kids Room,Basement","durationSeconds":120,"isFullScreen":true},"theaterMode":{"isEnabled":true,"isOn":false,"color":"rgba(0,0,0,0.90)","triggeringItem":"LivingRoom_Mode_Switch"},"panelConfigItem":"habpanelEx_Livingroom_H"}
Best, Jay
One happy customer
I discovered an issue with the item re-loading after clearing the cache/tmp directories on OH 2.3.
I have persistence set on the virtual items to store the screen saver settings but after clearing the cache/tmp directories; the item values I had set dis-appeared.
Any recommendations?
Best, Jay
As I mentioned before, the browser remembers the item string through localStorage. So if you clear your browser, you would need to select it again.
Here’s how I resolved it . . . I set the item values in the startup rule.
// Setting Screen Saver Item Values
habpanelEx_Bedroom_V.postUpdate('{"config_item":"habpanelExConfig","initComplete":true,"isShowInDrawer":true,"screensaver":{"isEnabled":true,"timeoutSeconds":300,"dashboardList":"Weather-Vertical,MainFloor-Vertical,KidsRooms-Vertical,Garage-Vertical","durationSeconds":120,"isFullScreen":true},"theaterMode":{"isEnabled":true,"isOn":false,"color":"rgba(0,0,0,0.90)","triggeringItem":"Bedroom_Mode_Switch"},"panelConfigItem":"habpanelEx_Bedroom_V"}')
habpanelEx_Basement_V.postUpdate('{"config_item":"habpanelExConfig","initComplete":true,"isShowInDrawer":true,"screensaver":{"isEnabled":true,"timeoutSeconds":300,"dashboardList":"Basement-Vertical,Cameras-Vertical","durationSeconds":120,"isFullScreen":true},"theaterMode":{"isEnabled":true,"isOn":false,"color":"rgba(0,0,0,0.90)","triggeringItem":"Theater_Mode_Switch"},"panelConfigItem":"habpanelEx_Basement_V"}')
habpanelEx_Livingroom_H.postUpdate('{"config_item":"habpanelExConfig","initComplete":true,"isShowInDrawer":true,"screensaver":{"isEnabled":true,"timeoutSeconds":300,"dashboardList":"Our House,Cameras,Up Stairs,Kids Room,Basement","durationSeconds":120,"isFullScreen":true},"theaterMode":{"isEnabled":true,"isOn":false,"color":"rgba(0,0,0,0.90)","triggeringItem":"LivingRoom_Mode_Switch"},"panelConfigItem":"habpanelEx_Livingroom_H"}')
logInfo("Startup Script", "Startup Script Done with - Setting Screen Saver Item Values")
logInfo("Startup Script", "-----------------------------------------------------------------------------")
This issue doesn’t have anything to do with the browsers at the tablet level; it has to do with clearing items that are virtual on a cache/tmp directory cleanup on the OH server.
Looks like the virtual items are NOT persistent even though I have asked them to be.
We’re all good now . . .
Best, Jay