more G-Labs products

Author Topic: Generic Sensor Widget - Change Label Possible?  (Read 1813 times)

January 14, 2015, 11:12:32 PM
Read 1813 times

xefil

  • **
  • Information
  • Jr. Member
  • Posts: 31
Hello,

After some tests I was able to parse an external json data and use the generic sensor widget to display data.
Is possible to change the default labels into something shorter? Temperature is displayed as "Temp..." and Humidity as "Humi...".
Looking on the source code of the html page, seems the full name reflects the variable name used in the following part, in example, in my code:

Code: [Select]
Program.RaiseEvent(module31, "Sensor.Temperature.31", N3_DHT11_T.ToString(), "Node01 DHT11 Temperature");

Also the HTML page displays "Temperature.31" which is then shown as "Temp..."

Is possible to insert custom string? In case "C°"..

In attach a screenshot.

Thank's

Simon

January 15, 2015, 06:52:51 AM
Reply #1

mvdarend

  • *****
  • Information
  • Hero Member
  • Posts: 431
If you change Sensor.Temperature.31 to Sensor.Temperature (so without the .31 at the end, you'll get icons instead of text. If you want to keep the 31 you might have to make a custom widget.

January 15, 2015, 10:19:48 AM
Reply #2

xefil

  • **
  • Information
  • Jr. Member
  • Posts: 31
If you change Sensor.Temperature.31 to Sensor.Temperature (so without the .31 at the end, you'll get icons instead of text. If you want to keep the 31 you might have to make a custom widget.

Are your widget custom or do I'm using the wrong widget?
I've an antenna as symbol, not a thermometer :-)

Do you mean I should use this:
Code: [Select]
Program.RaiseEvent(module31, "Sensor.Temperature", N3_DHT11_T.ToString(), "Node01 DHT11 Temperature");

Instead of this:
Code: [Select]
Program.RaiseEvent(module31, "Sensor.Temperature.31", N3_DHT11_T.ToString(), "Node01 DHT11 Temperature");

Doing this I've obtained the right icons, great.
But now I'm missing the graphs in the ANALYZE tab (Analyze -> Options -> 2.nd drop down window)
Before I was able to identify (even if difficult) the graphs selecting:
Temperature.11
Temperature.12
Temperature.13
(...)
What happen if now all are saved with "Temperature"?
How can I identify and select to show graphs?
Another custom name would be better.


Thanks!

Simon
« Last Edit: January 15, 2015, 10:31:41 AM by xefil »

January 15, 2015, 10:48:24 AM
Reply #3

mvdarend

  • *****
  • Information
  • Hero Member
  • Posts: 431
You can set a custom Icon as follows:
Code: [Select]
Program.Setup( () => {
  // set the widget
  Program.AddControlWidget("homegenie/generic/sensor");
  Program.Parameter("Widget.DisplayIcon").Value = "images/thermometer.png";
....
}
(Not sure on the path/name of icon, you might need to change that.)

In My 'Analyze' page I can select the different temperature controls by name, you don't have that?

January 15, 2015, 01:59:53 PM
Reply #4

xefil

  • **
  • Information
  • Jr. Member
  • Posts: 31
You can set a custom Icon as follows:
Code: [Select]
Program.Setup( () => {
  // set the widget
  Program.AddControlWidget("homegenie/generic/sensor");
  Program.Parameter("Widget.DisplayIcon").Value = "images/thermometer.png";
....
}
(Not sure on the path/name of icon, you might need to change that.)

In My 'Analyze' page I can select the different temperature controls by name, you don't have that?

Thanks for the hint to change the icons.
I've found now the temperatures with their own name. MAYBE until it was with name like "Temperature.<number>" it was ordered a little more confused. Now it's shown correctly.

Thanks a lot!

Do you know if it's possible to import old data?
In this case, I'll move in my script every reference from "Temperature.<number>" to "Temperature". I'll loos so the history data. It's possible to merge the two variables as well as import from external source?

Thanks!!

Simon