HomeGenie Forum

General Category => General Discussion => Topic started by: Deggle on August 17, 2016, 11:15:49 PM

Title: Set Name of Module/Widget from Program
Post by: Deggle on August 17, 2016, 11:15:49 PM
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!
Title: Re: Set Name of Module/Widget from Program
Post by: bkenobi on August 18, 2016, 05:25:29 PM
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.
Title: Re: Set Name of Module/Widget from Program
Post by: saue0 on August 18, 2016, 06:45:27 PM
Try this

Modules.InDomain(YOUR_DOMAIN4).WithAddress(YOUR_ADDRESS).Get().Instance.Name =
Title: Re: Set Name of Module/Widget from Program
Post by: Deggle on August 18, 2016, 07:19:46 PM
Bingo - thank you!
Title: Re: Set Name of Module/Widget from Program
Post by: bkenobi on August 20, 2016, 06:51:28 AM
Interesting. I didn't realize the instance.name property was writable.