Skip to content

Commit

Permalink
Added device types 3/4
Browse files Browse the repository at this point in the history
UPDATE to 0.4.0 PRE-RELEASE
- Device types 3 (Smart Door) and 4 (Smart Lock 3.0) added
- Added images
- Fixed color for RSSI to static green/yellow/red
  • Loading branch information
christianTF committed Jan 14, 2022
1 parent 072bf93 commit 14799d4
Show file tree
Hide file tree
Showing 6 changed files with 271 additions and 12 deletions.
2 changes: 1 addition & 1 deletion plugin.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ EMAIL=michael@loxberry.de
# The version of your plugin - important if you would like to write an
# upgrade script. Use a correct syntax, which is supported by LoxBerry:
# More info: http://www.loxwiki.eu/x/LYG3AQ
VERSION=0.3.5
VERSION=0.4.0

# Short name and prefered subfolder of your Plugin (do not use blanks - they
# will be filtered - and use lowercase only)! Used for script names in
Expand Down
4 changes: 2 additions & 2 deletions prerelease.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
# the donwload link here

# Version of the new pre-release
VERSION=0.3.5
VERSION=0.4.0

# Download URL of the ZIP Archive
ARCHIVEURL=https://github.com/mschlenstedt/LoxBerry-Plugin-Nuki/archive/0.3.5.zip
ARCHIVEURL=https://github.com/mschlenstedt/LoxBerry-Plugin-Nuki/archive/0.4.0.zip

# URL for further information about this release
INFOURL=https://github.com/mschlenstedt/LoxBerry-Plugin-Nuki/releases
17 changes: 14 additions & 3 deletions templates/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -756,8 +756,6 @@ <h3 class="ui-title" style="text-align: center;"><TMPL_VAR DEVICES.HINT_VIVO> <s


});


}


Expand Down Expand Up @@ -1130,14 +1128,27 @@ <h3 class="ui-title" style="text-align: center;"><TMPL_VAR DEVICES.HINT_VIVO> <s
switch(item.deviceType) {
case 0: $('<td />', { html: '<img src="./images/nuki-smart-lock.svg" alt="'+DEVICETYPE[item.deviceType]+'" height="32"></img>' }).appendTo(row); break;
case 2: $('<td />', { html: '<img src="./images/nuki-opener.svg" alt="'+DEVICETYPE[item.deviceType]+'" height="32"></img>' }).appendTo(row); break;
case 3: $('<td />', { html: '<img src="./images/nuki-smart-door.svg" alt="'+DEVICETYPE[item.deviceType]+'" height="32"></img>' }).appendTo(row); break;
case 4: $('<td />', { html: '<img src="./images/nuki-smart-lock3-white.svg" alt="'+DEVICETYPE[item.deviceType]+'" height="32"></img>' }).appendTo(row); break;
default: $('<td />', { html: '<img src="./images/nuki-unknown.svg" alt="unknown" height="32"></img>' }).appendTo(row);
}
$('<td />', { text: item.nukiId }).appendTo(row);
$('<td />', { text: item.name }).appendTo(row);
$('<td />', { text: item.bridgeId }).appendTo(row);
$('<td />', { text: ( item.paired == true ? '<TMPL_VAR COMMON.YES>' : '<TMPL_VAR COMMON.NO>' ) }).appendTo(row);
/*
// Formular out_min+(rssi-in_min)*(out_max-out_min)/(in_max-in_min)
rssicol = item.rssi ? numberToColorHsl( 100+(item.rssi+40)*(0-100)/(-100+40) ) : "transparent";
var in_min = -90;
var out_min = 0;
var in_max = -20;
var out_max = 120;
// item.rssi = -50; // To test
//rssicol = item?.rssi ? numberToColorHsl( out_min+(item.rssi-in_min)*(out_max-out_min)/(in_max-in_min) ) : "transparent";
*/
if( item.rssi < -80 ) rssicol = '#d90000';
else if ( item.rssi < -70 ) rssicol = '#ffff00';
else rssicol = '#6cd900';

$('<td />', { html: '<span style="background-color:'+rssicol+'">&nbsp;'+item.rssi+'&nbsp;</span>' }).appendTo(row);
$('<td />', { html: '\
<span class="deviceVOdownload" data-intbridgeid="'+item.bridgeId+'" data-nukiid="'+item.nukiId+'"><a href="#" id="btndeviceVOdownload'+item.nukiId+'" name="btndeviceVOdownload'+item.nukiId+'" \
Expand Down
110 changes: 110 additions & 0 deletions webfrontend/htmlauth/images/nuki-smart-door.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
96 changes: 96 additions & 0 deletions webfrontend/htmlauth/images/nuki-smart-lock3-white.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
54 changes: 48 additions & 6 deletions webfrontend/htmlauth/index.cgi
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,8 @@
# Modules
##########################################################################

# use Config::Simple '-strict';
# use CGI::Carp qw(fatalsToBrowser);
use CGI;
use LoxBerry::System;
# use LoxBerry::Web;
# use LoxBerry::JSON; # Available with LoxBerry 2.0
require "$lbpbindir/libs/LoxBerry/JSON.pm";
use LoxBerry::Log;
Expand Down Expand Up @@ -65,8 +62,10 @@ my %bridgeType = (
2 => "Software bridge",
);
my %deviceType = (
0 => "Smartlock",
0 => "Smart Lock",
2 => "Opener",
3 => "Smart Door",
4 => "Smart Lock 3.0"
);
my %lockState = (
0 => {
Expand All @@ -91,7 +90,36 @@ my %lockState = (
7 => "opening",
253 => "boot run",
255 => "undefined"
}
},
3 => {
-1 => "plugin connection error",
0 => "uncalibrated",
1 => "locked",
2 => "unlocking",
3 => "unlocked",
4 => "locking",
5 => "unlatched",
6 => "unlocked (lock&go)",
7 => "unlatching",
254 => "motor blocked",
255 => "undefined"
},
4 => {
-1 => "plugin connection error",
0 => "uncalibrated",
1 => "locked",
2 => "unlocking",
3 => "unlocked",
4 => "locking",
5 => "unlatched",
6 => "unlocked (lock&go)",
7 => "unlatching",
254 => "motor blocked",
255 => "undefined"
},



);
my %lockAction = (
0 => {
Expand All @@ -107,7 +135,21 @@ my %lockAction = (
3 => "electric strike actuation",
4 => "activate continuous mode",
5 => "deactivate continuous mode"
}
},
3 => {
1 => "unlock",
2 => "lock",
3 => "unlatch",
4 => "lock&go",
5 => "lock&go with unlatch"
},
4 => {
1 => "unlock",
2 => "lock",
3 => "unlatch",
4 => "lock&go",
5 => "lock&go with unlatch"
},
);

##########################################################################
Expand Down

0 comments on commit 14799d4

Please sign in to comment.