• 10 dec 2017: forum version update. In case of issues use this topic.
  • 30 nov 2017: pilight moved servers. In case of issues use this topic.
Hello There, Guest! Login Register


WebGUI support for illuminance sensors
#1
Hi,

please add support for the illuminance sensors to show the values (and optional an icon) in the webgui. Here are the patches :

pilight.js / diff
Code:
--- pilight.js_org    2016-11-27 12:53:18.035840800 +0100
+++ pilight.js    2016-11-26 17:43:58.000000000 +0100
@@ -19,7 +19,7 @@
var sDateTimeFormat = "HH:mms YYYY-MM-DD";
var aDateTimeFormats = new Array();
var aWebcamUrl = new Array();
-var aDecimalTypes = ["temperature", "humidity", "wind", "pressure", "sunriseset"];
+var aDecimalTypes = ["temperature", "humidity", "wind", "pressure", "sunriseset", "illuminance"];
var userLang = navigator.language || navigator.userLanguage;
var language;

@@ -604,6 +604,10 @@
            $('#'+sDevId+'_sunrise_icon').addClass('yellow');
            $('#'+sDevId+'_sunset_icon').addClass('gray');
        }
+        if('show-illuminance' in aValues && aValues['show-illuminance']) {
+            oTab.find('#'+sDevId+'_weather').append($('<div class="illuminance">&nbsp;lx</div><div class="illuminance" id="'+sDevId+'_illu"></div>'));
+        /*    oTab.find('#'+sDevId+'_weather').append($('<div class="illuminance_icon"></div><div class="illuminance" id="'+sDevId+'_illu"></div>')); */
+        }
    }
    oTab.listview();
    oTab.listview("refresh");
@@ -1053,6 +1057,10 @@
                                $('#'+dvalues+'_upd').removeClass('update_inactive').addClass('update_active');
                            }
                        }
+                    } else if(vindex == 'illuminance' && $('#'+dvalues+'_illu').length > 0) {
+                        if(dvalues in aDecimals) {
+                            $('#'+dvalues+'_illu').text(vvalues.toFixed(aDecimals[dvalues]['illuminance']));
+                        }
                    }
                } else if(iType == 9) {
                    if(vindex == "action" && $('#'+dvalues+'_action').length > 0) {

pilight.css / diff
Code:
--- pilight.css_org    2016-11-27 12:53:01.361217000 +0100
+++ pilight.css    2016-11-26 17:42:03.000000000 +0100
@@ -167,10 +167,10 @@
    float: left;
}

-div.humidity, div.temperature, div.pressure,
+div.humidity, div.temperature, div.pressure,div.illuminance,
div.rain, div.windavg, div.windgust, div.winddir,
div.temperature_icon, div.humidity_icon, div.pressure_icon,
-div.rain_icon, div.windavg_icon,
+div.rain_icon, div.windavg_icon,div.illuminance_icon,
div.windgust_icon, div.winddir_icon,
div.update_active, div.update_inactive,
div.sunrise, div.sunset, div.sunset_icon.gray,
@@ -196,7 +196,7 @@
}

div.temperature_icon, div.humidity_icon, div.pressure_icon,
-div.rain_icon, div.windavg_icon,
+div.rain_icon, div.windavg_icon,div.illuminance_icon
div.windgust_icon {
    width: 16px;
    height: 16px;
@@ -297,6 +297,10 @@
    background: url('windgust.png') 0px 0px no-repeat;
}

+div.illuminance_icon {
+    background: url('illuminance.png') 0px 0px no-repeat;
+}
+
div.update_active {
    background: url('update_active.png') 0px 0px no-repeat;
}

If anyone wants an icon, please design one in 16px * 16px, name it illuminance.png

greetz
Marc


Attached Files
.jpg   screenshot.jpg (Size: 11.66 KB / Downloads: 20)
 
Reply
#2
Can you open a PR on GitHub with these patches as a commit please? I'm in favour of this feature, I would like to have a nice little icon with it too Smile Dunno where to get one though, or what it should look like Tongue
 
Reply
#3
(11-29-2016, 07:00 PM)pilino1234 Wrote: Can you open a PR on GitHub with these patches as a commit please? I'm in favour of this feature, I would like to have a nice little icon with it too Smile Dunno where to get one though, or what it should look like Tongue

done...https://github.com/pilight/pilight/pull/308


greetz

Marc

PS: I integrate a simple icon, see the attachment..


Attached Files
.png   illuminance.png (Size: 610 bytes / Downloads: 15)
 
Reply
  


Possibly Related Threads...
Thread Author Replies Views Last Post
  Modifying Webgui Alex 4 1,277 03-10-2019, 05:50 PM
Last Post: Alex
  pilight & piSchedule works fine but no webgui Sven 4 1,134 01-13-2019, 06:12 PM
Last Post: Sven
  webgui - registry "tabs": 1 usage and possibility to order fcoelho 3 3,758 03-22-2018, 07:31 PM
Last Post: Oliver
  New tab in webgui Roger 0 679 09-15-2017, 02:14 PM
Last Post: Roger
  Cannot connect to WebGUI von BlackBerry 10 device. muecke 2 1,105 12-02-2016, 10:22 AM
Last Post: muecke
  Webgui Remuko 1 2,063 09-17-2016, 10:14 AM
Last Post: buldogwtf
  WebGUI doesn't retrieve state Thunder84 1 1,388 05-01-2016, 08:35 PM
Last Post: Thunder84
  Plenary - An alternative webGUI for pilight mitch187 20 16,337 03-29-2016, 06:25 AM
Last Post: curlymo
  Show registry Data in WebGUI bastardop 0 1,254 03-10-2016, 12:31 AM
Last Post: bastardop
  webgui pilight 6.0 iphone / android browser Jeroenk 3 2,990 02-03-2016, 05:08 PM
Last Post: serge

Forum Jump:


Browsing: 1 Guest(s)