Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
krlaframboise committed Sep 3, 2017
1 parent 0a19d9e commit 850e334
Showing 1 changed file with 3 additions and 49 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
/**
* Other Hub Device Viewer v0.0.3 (BETA)
* Other Hub Device Viewer v0.0.3 (ALPHA)
*
* Author:
* Kevin LaFramboise (krlaframboise)
*
* Changelog:
*
* 0.0.3 (09/03/2017)
* - Beta Relase
* - Alpha Relase
*
* Licensed under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in
Expand Down Expand Up @@ -39,11 +39,9 @@ definition(
page(name:"lastEventPage")
page(name:"refreshLastEventPage")
page(name:"toggleSwitchPage")
// page(name:"devicesPage")
page(name:"displaySettingsPage")
page(name:"thresholdsPage")
page(name:"notificationsPage")
page(name:"pollingPage")
page(name:"otherSettingsPage")
page(name:"dashboardSettingsPage")
page(name:"enableDashboardPage")
Expand Down Expand Up @@ -84,9 +82,6 @@ def mainPage() {
getPageLink("notificationsLink",
"Notification Settings",
"notificationsPage")
getPageLink("pollingLink",
"Polling Settings",
"pollingPage")
getPageLink("otherSettingsLink",
"Other Settings",
"otherSettingsPage")
Expand Down Expand Up @@ -325,32 +320,6 @@ def notificationsPage() {
}
}

// Page for Polling settings
def pollingPage() {
dynamicPage(name:"pollingPage") {
section ("Polling Settings") {
paragraph "If you enable the polling feature, the devices that support the Polling Capability will be polled at a regular interval."
paragraph "Polling your devices too frequently can cause them to stop responding or miss other commands that get sent to it."
input "pollingEnabled", "bool",
title: "Polling Enabled",
defaultValue: false,
required: false
input "pollingInterval", "number",
title: "How often should the devices be polled? (minutes)\n(Must be between 5 and ${6 * 24 * 60})",
defaultValue: (4 * 60),
range: "5..${6 * 24 * 60}",
required: false
}
section("Polling Restrictions") {
input "pollingExcluded", "enum",
title: "Exclude these devices from Polling",
multiple: true,
required: false,
options: getExcludedDeviceOptions("Polling")
}
}
}

private getExcludedDeviceOptions(capabilityName) {
if (capabilityName) {
getDevicesByCapability(capabilityName).collect { it.displayName }?.sort()
Expand Down Expand Up @@ -1143,26 +1112,11 @@ def performScheduledTasks() {
if (canCheckDevices(state.lastDeviceCheck)) {
checkDevices()
}
if (canPollDevices(state.lastDevicePoll)) {
runIn(61, refreshDeviceActivityCache)
pollDevices()
}
else {
refreshDeviceActivityCache()
}
}

void pollDevices() {
logDebug "Polling Devices"
state.lastDevicePoll = new Date().time
getDevicesByCapability("Polling", pollingExcluded)*.poll()
}

private canPollDevices(lastPoll) {
return settings.pollingEnabled &&
timeElapsed((lastPoll ?: 0) + msMinute(safeToInteger(settings.pollingInterval, 5)), true)
}

void refreshDeviceActivityCache() {
def devices = getAllDevices()
def deviceCount = devices?.size()
Expand Down Expand Up @@ -1978,7 +1932,7 @@ private api_getJS() {
private api_getCSS() {
// return "<link rel=\"stylesheet\" href=\"${getResourcesUrl()}/dashboard.css\">"

def css = "body { font-size: 100%; text-align:center; font-family:Helvetica,arial,sans-serif; margin:0 0 10px 0; background-color: #000000;}header, nav, section, footer { display: block; text-align:center;}header { margin: 0 0 0 0; padding: 4px 0 4px 0; width: 100%; font-weight: bold; font-size: 100%; background-color:#808080; color:#ffffff;}nav.top{ padding-top: 0;}nav.bottom{ padding: 4px 4px 4px 4px;}section { padding: 10px 20px 40px 20px;}.command-results { background-color: #d6e9c6; margin: 0 20px 20px 20px; padding: 10px 20px 10px 20px; border-radius: 100px;}.command-results h1 { margin: 0 0 0 0;}.command-results ul { list-style: none;}.command-results li { line-height: 1.5; font-size: 120%;}.dashboard-url { display:block; width:100%; font-size: 80%;}.device-id-none{ background-color: #d6e9c6 !important;}.refresh { background-image: url('refresh.png');}.acceleration-active { background-image: url('acceleration-active.png');}.acceleration-inactive{ background-image: url('acceleration-inactive.png');}.alarm, .alarm-both { background-image: url('alarm-both.png');}.alarm-siren { background-image: url('alarm-siren.png');}.alarm-strobe { background-image: url('alarm-strobe.png');}.alarm-off { background-image: url('alarm-off.png');}.battery, .normal-battery { background-image: url('normal-battery.png');}.normal-75-battery { background-image: url('normal-75-battery.png');}.normal-50-battery { background-image: url('normal-50-battery.png');}.normal-25-battery { background-image: url('normal-25-battery.png');}.low-battery { background-image: url('low-battery.png');}.open { background-image: url('open.png');}.contactSensor, .closed { background-image: url('closed.png');}.light, .light-on { background-image: url('light-on.png');}.light-off { background-image: url('light-off.png');}.lock, .locked{ background-image: url('locked.png');}.unlocked { background-image: url('unlocked.png');}.motionSensor, .motion { background-image: url('motion.png');}.no-motion { background-image: url('no-motion.png');}.presenceSensor, .present { background-image: url('present.png');}.not-present { background-image: url('not-present.png');}.smokeDetector, .smoke-detected { background-image: url('smoke-detected.png');}.smoke-clear { background-image: url('smoke-clear.png');}.switch, .switch-on { background-image: url('switch-on.png');}.switch-off { background-image: url('switch-off.png');}.temperatureMeasurement, .normal-temp { background-image: url('normal-temp.png');}.low-temp { background-image: url('low-temp.png');}.high-temp { background-image: url('high-temp.png');}.waterSensor, .dry { background-image: url('dry.png');}.wet { background-image: url('wet.png');}.ok { background-image: url('ok.png');}.warning { background-image: url('warning.png');}.device-item { width: 200px; display: inline-block; background-color: #ffffff; margin: 2px 2px 2px 2px; padding: 4px 4px 4px 4px; border-radius: 5px;}.item-image-text { position: relative; height: 75px; width:100%; display: table;}.item-image { display: table-cell; position: relative; width: 35%; border: 1px solid #cccccc; border-radius: 5px; background-repeat:no-repeat; background-size:auto 70%; background-position: center bottom;}.item-status { width: 100%; font-size:75%; display:inline-block;}.item-text { display: table-cell; width: 65%; position: relative; vertical-align: middle;}a.item-text { color:#000000;}.item-text.wait, .menu-item a.wait{ color:#ffffff; background-image:url('wait.gif'); background-repeat:no-repeat; background-position: center bottom;}.item-text.wait{ background-size:auto 100%;}.label { display:inline-block; vertical-align: middle; line-height:1.4; font-weight: bold; padding-left:4px;}.menu-item { display: inline-block; background-color:#808080; padding:4px 4px 4px 4px; border:1px solid #000000; border-radius: 5px; font-weight:bold;}.menu-item .item-image{ display:table-cell; background-size:auto 45%; height:50px; width:75px; border:0; border-radius:0;}.menu-item .item-image.switch,.menu-item .item-image.light,.menu-item .item-image.battery,.menu-item .item-image.alarm,.menu-item .item-image.refresh { background-size:auto 60%;}.menu-item a, .menu-item a:link, .menu-item a:hover, .menu-item a:active,.menu-item a:visited { color: #ffffff; text-decoration:none;}.menu-item:hover, .menu-item:hover a, .menu-item a:hover { background-color:#ffffff; color:#000000 !important;}.menu-item span { width: 100%; font-size:75%; display:inline-block;}@media (max-width: 639px){ .device-item { width:125px; } .item-image-text { height: 65px; } .item-image { background-size: auto 60%; } .item-text .label { font-size: 80%; line-height: 1.2; }}"
def css = "body { font-size: 100%; text-align:center; font-family:Helvetica,arial,sans-serif; margin:0 0 10px 0; background-color: #000000;}header, nav, section, footer { display: block; text-align:center;}header { margin: 0 0 0 0; padding: 4px 0 4px 0; width: 100%; font-weight: bold; font-size: 100%; background-color:#808080; color:#ffffff;}nav.top{ padding-top: 0;}nav.bottom{ padding: 4px 4px 4px 4px;}section { padding: 10px 20px 40px 20px;}.command-results { background-color: #d6e9c6; margin: 0 20px 20px 20px; padding: 10px 20px 10px 20px; border-radius: 100px;}.command-results h1 { margin: 0 0 0 0;}.command-results ul { list-style: none;}.command-results li { line-height: 1.5; font-size: 120%;}.dashboard-url { display:block; width:100%; font-size: 80%;}.device-id-none{ background-color: #d6e9c6 !important;}.refresh { background-image: url('refresh.png');}.acceleration-active { background-image: url('acceleration-active.png');}.acceleration-inactive{ background-image: url('acceleration-inactive.png');}.alarm, .alarm-both { background-image: url('alarm-both.png');}.alarm-siren { background-image: url('alarm-siren.png');}.alarm-strobe { background-image: url('alarm-strobe.png');}.alarm-off { background-image: url('alarm-off.png');}.battery, .normal-battery { background-image: url('normal-battery.png');}.normal-75-battery { background-image: url('normal-75-battery.png');}.normal-50-battery { background-image: url('normal-50-battery.png');}.normal-25-battery { background-image: url('normal-25-battery.png');}.low-battery { background-image: url('low-battery.png');}.open { background-image: url('open.png');}.contactSensor, .closed { background-image: url('closed.png');}.light, .light-on { background-image: url('light-on.png');}.light-off { background-image: url('light-off.png');}.lock, .locked{ background-image: url('locked.png');}.unlocked { background-image: url('unlocked.png');}.motionSensor, .motion { background-image: url('motion.png');}.no-motion { background-image: url('no-motion.png');}.presenceSensor, .present { background-image: url('present.png');}.not-present { background-image: url('not-present.png');}.smokeDetector, .smoke-detected { background-image: url('smoke-detected.png');}.smoke-clear { background-image: url('smoke-clear.png');}.switch, .switch-on { background-image: url('switch-on.png');}.switch-off { background-image: url('switch-off.png');}.temperatureMeasurement, .normal-temp { background-image: url('normal-temp.png');}.low-temp { background-image: url('low-temp.png');}.high-temp { background-image: url('high-temp.png');}.waterSensor, .dry { background-image: url('dry.png');}.wet { background-image: url('wet.png');}.ok { background-image: url('ok.png');}.warning { background-image: url('warning.png');}.device-item { width: 200px; display: inline-block; background-color: #ffffff; margin: 2px 2px 2px 2px; padding: 4px 4px 4px 4px; border-radius: 5px;}.item-image-text { position: relative; height: 75px; width:100%; display: table;}.item-image { display: table-cell; position: relative; width: 35%; border: 1px solid #cccccc; border-radius: 5px; background-repeat:no-repeat; background-size:auto 70%; background-position: center bottom;}.item-status { width: 100%; font-size:75%; display:inline-block;}.item-text { display: table-cell; width: 65%; position: relative; vertical-align: middle;}a.item-text { color:#000000;}.item-text.wait, .menu-item a.wait{ color:#ffffff; background-image:url('wait.gif'); background-repeat:no-repeat; background-position: center bottom;}.item-text.wait{ background-size:auto 100%;}.label { display:inline-block; vertical-align: middle; line-height:1.4; font-weight: bold; padding-left:4px;}.menu-item { display: inline-block; background-color:#808080; padding:4px 4px 4px 4px; border:1px solid #000000; border-radius: 5px; font-weight:bold;}.menu-item .item-image{ display:table-cell; background-size:auto 45%; background-position: bottom center; height:50px; width:75px; border:0; border-radius:0;}.menu-item .item-image.switch,.menu-item .item-image.light,.menu-item .item-image.battery,.menu-item .item-image.alarm,.menu-item .item-image.refresh { background-size:auto 60%;}.menu-item a, .menu-item a:link, .menu-item a:hover, .menu-item a:active,.menu-item a:visited { color: #ffffff; text-decoration:none;}.menu-item:hover, .menu-item:hover a, .menu-item a:hover { background-color:#ffffff; color:#000000 !important;}.menu-item span { width: 100%; font-size:55%; display:inline-block;}@media (max-width: 639px){ .device-item { width:125px; } .item-image-text { height: 65px; } .item-image { background-size: auto 60%; } .item-text .label { font-size: 80%; line-height: 1.2; }}"

css = css.replace("url('", "url('${getResourcesUrl()}/")
css += api_getLayoutCSS()
Expand Down

0 comments on commit 850e334

Please sign in to comment.