more G-Labs products

Author Topic: Adding Sensor types  (Read 779 times)

October 15, 2016, 09:57:55 AM
Read 779 times

mvdarend

  • *****
  • Information
  • Hero Member
  • Posts: 431
I'm working on a new MySensor plugin for HG but I'm running into a small problem with the Generic Widgets not displaying values

In older versions of HG, the Generic Widget displayed alle values beginning with 'Status.' 'Sensor.' etc. but in newer versions of HG, displaying a value is defined by the following code:

Code: [Select]
var ctx = $$.ui.GetParameterContext($$.module, parameter.Name, parameter.Value);
if (!ctx.isUnknown)

I've adapted it to the following for testing:

Code: [Select]
var ctx = $$.ui.GetParameterContext($$.module, parameter.Name, parameter.Value);
if (!ctx.isUnknown) | parameter.Name.indexOf("Sensor.") >= 0 | parameter.Name.indexOf("Meter.") >= 0 | parameter.Name.indexOf("Status.") >= 0){{

but is there a better way for value types to be 'known' to HG? Or am I better off creating a new custom widget for MySensors?

October 17, 2016, 04:47:01 PM
Reply #1

mvdarend

  • *****
  • Information
  • Hero Member
  • Posts: 431
I think I've found how to add new Sensor types, will test this evening and then submit a pull request.

October 17, 2016, 07:45:10 PM
Reply #2

mvdarend

  • *****
  • Information
  • Hero Member
  • Posts: 431
Sorted, pull request has been sent.

October 17, 2016, 08:34:30 PM
Reply #3

raptorjr

  • ***
  • Information
  • Full Member
  • Posts: 78
Thank you for all the MySensor work you do. Is it only Gene that can commit your pull requests? Is it hard to build from source and add your changes manually?

October 17, 2016, 08:47:39 PM
Reply #4

mvdarend

  • *****
  • Information
  • Hero Member
  • Posts: 431
I think it's only Gene that can commit stuff, I'm not sure.

If you've got Visual Studio then it's fairly easy to download the code and build it for a local HomeGenie instance to play around with. The coding itself is very neat and easy to read, which is nice. (Although I'm always worried about adding 'ugly' code to Genes work :/ )


October 24, 2016, 10:13:32 AM
Reply #5

mvdarend

  • *****
  • Information
  • Hero Member
  • Posts: 431
Still Waiting on a Git merge from Gene, for those who want the icons earlier you can do the following:

- Add the files in from indicators.zip to the 'indicators' folder: /html/images/indicators

- Use the code in the following pull requests:
 - /Common/html/js/api/homegenie.ui.js
 - https://github.com/genielabs/HomeGenie/pull/290/files
   
 - BaseFiles/Common/html/css/my.css
 - https://github.com/genielabs/HomeGenie/pull/289/files

Edit: forgot to add the attachment
     
« Last Edit: October 24, 2016, 11:47:38 AM by mvdarend »