HomeGenie Forum

General Category => Troubleshooting and Support => Topic started by: mvdarend on October 15, 2016, 09:57:55 AM

Title: Adding Sensor types
Post by: mvdarend on October 15, 2016, 09:57:55 AM
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?
Title: Re: Adding Sensor types
Post by: mvdarend on October 17, 2016, 04:47:01 PM
I think I've found how to add new Sensor types, will test this evening and then submit a pull request.
Title: Re: Adding Sensor types
Post by: mvdarend on October 17, 2016, 07:45:10 PM
Sorted, pull request has been sent.
Title: Re: Adding Sensor types
Post by: raptorjr on October 17, 2016, 08:34:30 PM
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?
Title: Re: Adding Sensor types
Post by: mvdarend on October 17, 2016, 08:47:39 PM
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 :/ )

Title: Re: Adding Sensor types
Post by: mvdarend on October 24, 2016, 10:13:32 AM
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