Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Graphical Update for V 2.0 #50

Merged
merged 7 commits into from
Jul 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
509 changes: 298 additions & 211 deletions README.md

Large diffs are not rendered by default.

Binary file removed images/SC_BasicUI_Main.png
Binary file not shown.
Binary file removed images/SC_BasicUI_MainStatus.png
Binary file not shown.
Binary file added images/SC_BasicUI_Main_Action.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/SC_BasicUI_Main_Battery.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/SC_BasicUI_Main_DeviceInfo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/SC_BasicUI_Main_Home.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/SC_BasicUI_Main_Orientation.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/SC_BasicUI_Main_Settings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/SC_BasicUI_Main_Settings_MultiZone.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/SC_BasicUI_Main_Settings_Schedule.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/SC_BasicUI_Main_Statistic.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/SC_BasicUI_Main_Status.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed images/SC_BasicUI_MultiZone.png
Binary file not shown.
Binary file removed images/SC_BasicUI_Schedule.png
Binary file not shown.
Binary file added openhab-conf/icons/mlock.zip
Binary file not shown.
54 changes: 54 additions & 0 deletions openhab-conf/transform/minstohours.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
Javascript transform function to change the number
of minutes of CPU time from the System Info Binding
into a more readable format
eg: 2365 into '1 day 15 hours 25 minutes

The item in the items file is defined as follow:
Number LocalComputer_Cpu_SystemUptime "[JS(CPUTime.js):%s]"
and linked via PaperUI to the System uptime channel
of the System Info Thing
*/

(function(i) {
if (i == 'NULL') { return i; }
if (i == '-') { return 'Undefined'; }
var val = parseInt(i); // The value sent by OH is a string so we parse into an integer
var days = 0; // Initialise variables
var hours = 0;
var minutes = 0;
if (val >= 1440) { // 1440 minutes in a days
days = Math.floor(val / 1440); // Number of days
val = val - (days * 1440); // Remove days from val
}
if (val >= 60) { // 60 minutes in an hour
hours = Math.floor(val /60); // Number of hours
val = val - (hours * 60); // Remove hours from val
}
minutes = Math.floor(val); // Number of minutes

var stringDays = ''; // Initialse string variables
var stringHours = '';
var stringMinutes = '';
if (days === 1) {
stringDays = '1 day '; // Only 1 day so no 's'
} else if (days > 1) {
stringDays = days + ' days '; // More than 1 day so 's'
} // If days = 0 then stringDays remains ''

if (hours === 1) {
stringHours = '1 hour '; // Only 1 hour so no 's'
} else if (hours > 1) {
stringHours = hours + ' hours '; // More than 1 hour so 's'
} // If hours = 0 then stringHours remains ''

if (minutes === 1) {
stringMinutes = '1 minute'; // Only 1 minute so no 's'
} else if (minutes > 1) {
stringMinutes = minutes + ' minutes'; // More than 1 minute so 's'
} // If minutes = 0 then stringMinutes remains ''

var returnString = stringDays + stringHours + stringMinutes
return returnString.trim(); // Removes the extraneous space at the end

})(input)