Deconz-rest-plugin: Sensors in Device WebApp

Created on 28 Jul 2017  ·  3Comments  ·  Source: dresden-elektronik/deconz-rest-plugin

I was crudely able to get the Temperator & Humidity sensors working on the webapp.
Question, will you be moving to Bootstrap 3? (the icons do not have a temperature icon, and the glyphlings icons are in the wrong folder, they need to be in /bootstrap/img/ not /img/

This is what I did to make the Temp/Humidity sensors display on the device page: (changes to devices.js)

Around Line 463:
// sensor already exists. Add endpoint. for (d in devices) { if (devices[d].uniqueid.indexOf(uid[0]) === 0) { devices[d].ep = devices[d].ep + "," + device.id + "-" + uid[1]; if (device.state.humidity) devices[d].state['humidity'] = device.state.humidity; if (device.state.temperature) devices[d].state['temperature'] = device.state.humidity; break; } }

This was needed since the xiaomi sensors show up as 2 devices but your code only detects the first sensor. This adds the second sensor to the device, the name only shows the first sensor but at least it adds it to the array.

and Around Line 510:
} else if (device.type === "ZHATemperature" || device.type === "ZHAHumidity") { // Temperature/Humidity Sensor deviceIcon = "<span class=\"icon-home icon-white\">"; rowtxt += '<tr class="light_item" style=""><td style="width:12%">' + deviceIcon + '</td><td style="width:10px;"></td>'; rowtxt += '<td>' + device.name; if (device.state.temperature) rowtxt += ' Temp: '+ (parseInt(device.state.temperature/100) * 9 / 5 +32).toFixed(2).toString() + "&deg;F"; if (device.state.humidity) rowtxt += ' Humidity: '+ (parseInt(device.state.humidity/100)).toFixed(2).toString()+"%"; rowtxt += '</td>'; rowtxt += "<tr><td colspan=\"4\">&nbsp;</td></tr>"; }

This adds it to the device page and does Celsius to Fahrenheit conversion, and humidity to percent.

I would use git and "attempt" to submit my changes, but i can't figure GIT out without totally breaking things. I attached the devices.js file also.

devices.zip

Most helpful comment

Question, will you be moving to Bootstrap 3? (the icons do not have a temperature icon, and the glyphlings icons are in the wrong folder, they need to be in /bootstrap/img/ not /img/

We did :) a new version of the app will be available as private beta preview in a few days. It uses Glyphicons from Bootstrap very sparingly, but instead has new dedicated icons as SVG.

Here is a screen of a combined sensor view for Philips hue Motion Sensor, it looks very similar for Xiaomi sensors. The sensor view does refresh in realtime due the events from the websocket.

ph_motion_sensor

All 3 comments

Question, will you be moving to Bootstrap 3? (the icons do not have a temperature icon, and the glyphlings icons are in the wrong folder, they need to be in /bootstrap/img/ not /img/

We did :) a new version of the app will be available as private beta preview in a few days. It uses Glyphicons from Bootstrap very sparingly, but instead has new dedicated icons as SVG.

Here is a screen of a combined sensor view for Philips hue Motion Sensor, it looks very similar for Xiaomi sensors. The sensor view does refresh in realtime due the events from the websocket.

ph_motion_sensor

Perfect! to something like Smartthings show the sensors also?

On Fri, Jul 28, 2017 at 2:18 AM, Manuel Pietschmann <
[email protected]> wrote:

Question, will you be moving to Bootstrap 3? (the icons do not have a
temperature icon, and the glyphlings icons are in the wrong folder, they
need to be in /bootstrap/img/ not /img/

We did :) a new version of the app will be available as private beta
preview in a few days. It uses Glyphicons from Bootstrap very sparingly,
but instead has new dedicated icons as SVG.

Here is a screen of a combined sensor view for Philips hue Motion Sensor,
it looks very similar for Xiaomi sensors. The sensor view does refresh in
realtime due the events from the websocket.

[image: ph_motion_sensor]
https://user-images.githubusercontent.com/383386/28704646-0ca80ffa-736c-11e7-80bd-4d2d2e2f7c3f.png


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/dresden-elektronik/deconz-rest-plugin/issues/62#issuecomment-318570272,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AFl6AJukNXi3jotP_qzMXapjAhFaKu7eks5sSX0zgaJpZM4Ol_0q
.

Closing the oldest issues for know to tidy up the tracker and duplicates in newer issues.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tenholde picture tenholde  ·  3Comments

joecas1 picture joecas1  ·  6Comments

stevenwfoley picture stevenwfoley  ·  3Comments

jan666 picture jan666  ·  4Comments

flex-0 picture flex-0  ·  4Comments