HomeGenie Forum

Automation Program Plugins and Wizard Scripting => Help => Topic started by: nobody on March 14, 2016, 08:01:53 AM

Title: Getting module parameter
Post by: nobody on March 14, 2016, 08:01:53 AM
Hi All!

So, I wrote a script (C#) which communicate with the serial port. I created an virtual module for that, basic sensor type. It has a few parameter and these parameters can be write and read with:
Code: [Select]
module = Modules.InDomain("HomeAutomation.Smthng").WithAddress("0").Get();

module.Parameter("sensor.Temperature").Value = "25"; // write

param = module.Parameter("sensor.Temperature").Value; //read

It is working fine, but when I'm trying to use this parameter from another (Python) script I always get error.

Here is my code in python:
Code: [Select]
module = hg.Modules.InDomain("HomeAutomation.python").WithAddress("0").Get()
param = hg.module.Parameter("sensor.Temperature").Value

Error: Scripting host has no attribute 'module'

The other script running and I can see the module.

Is it even possible to do this? If it is, then what am I doing wrong?

Thanks for Your help! :)
Title: Re: Getting module parameter
Post by: bkenobi on March 14, 2016, 03:34:24 PM
I don't know python for HG, but it looks like it doesn't like how you are using the "module" variable that holds your HG module.  Perhaps you need to call it in a different way?
Title: Re: Getting module parameter
Post by: [email protected] on March 21, 2016, 03:50:22 PM
Code: [Select]
module = hg.Modules.InDomain("HomeAutomation.python").WithAddress("0").Get()
param = module.Parameter("sensor.Temperature").Value

??
Title: Re: Getting module parameter
Post by: bkenobi on March 21, 2016, 10:03:08 PM
That would have been my guess, but without having looked at Python for HG, I'd likely have sent the OP in the wrong direction.