more G-Labs products

Author Topic: Set Name of Module/Widget from Program  (Read 656 times)

August 17, 2016, 11:15:49 PM
Read 656 times

Deggle

  • *
  • Information
  • Newbie
  • Posts: 11
I have a program that reads in some temperature data from an API and updates "Sensor.Temperature" with this information. The API also sends though the name of the sensor (in my case it's location name) - it would be great to be able to set the modules name to this, however I can't work out how to do so.

The only way I can find to name a module is via the name box on it's settings popup.

Can anyone point me in the right direction?

Many thanks!

August 18, 2016, 05:25:29 PM
Reply #1

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
I use virtual modules with my environmental sensors.  Virtual modules can be created/destroyed from the program.  Once created, you can add the module to your dashboard like any other module.  The down side is that once it is created, that's what it's called.  I don't know of a programmatic way to rename it.  If you want to call the module something else, you would write to a different virtual module and the old data would be retained by the old module.

August 18, 2016, 06:45:27 PM
Reply #2

saue0

  • **
  • Information
  • Jr. Member
  • Posts: 40
Try this

Modules.InDomain(YOUR_DOMAIN4).WithAddress(YOUR_ADDRESS).Get().Instance.Name =

August 18, 2016, 07:19:46 PM
Reply #3

Deggle

  • *
  • Information
  • Newbie
  • Posts: 11

August 20, 2016, 06:51:28 AM
Reply #4

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
Interesting. I didn't realize the instance.name property was writable.