Dashticz / dashticz_v2

Alternative dashboard for Domoticz
107 stars 62 forks source link

Representation of Humidity Sensor #337

Closed czacha338 closed 6 years ago

czacha338 commented 6 years ago

Hello,

First of all I would like to thank you for perfect dashboard. It's much better for HMI then normal one :)

I have found some bug related to building blocks for Humidity sensor. When in domoticz there is defined sensor only with Humidity sensor it is build twice (one with temperature icon and one with humidity). block_humidity

The problem is laying in main.js file, funtion getTempHumBarBlock(device, idx)

I have corrected it by creating a new function called getHumBlock(device, idx); and changing the switch switch (device['Type'])

My changes are below, if you would like you can marge them to you branch. :)

git diff main.js
diff --git a/js/main.js b/js/main.js
index d5f088b..876ddb0 100644
--- a/js/main.js
+++ b/js/main.js
     switch (device['Type']) {
+      case 'Humidity':
+             return getHumBlock(device, idx);
         case 'Temp + Humidity + Baro':
         case 'Temp + Humidity':
-        case 'Humidity':

+function getHumBlock(device, idx) {
+    this.html = '';
+       var blockValues = [
+        {
+            icon: 'wi wi-humidity',
+            idx: idx,
+            title: device['Name'],
+            value: number_format(device['Humidity'], 0),
+            unit: '%'
+        },
+    ];
+       createBlocks(blockValues, device);
+    return ['', false];
+}

After this change, when sensor has only Humidity defined is represented as one block:

block_humidity_ok

Best regards,

Adrian

DewGew commented 6 years ago

I suggest you make a pull request

lokonli commented 6 years ago

I've created the pull request for this.

robgeerts commented 6 years ago

Merged! :) Thanks!

czacha338 commented 6 years ago

Your welcome :)