more G-Labs products

Author Topic: Getting module parameter  (Read 1151 times)

March 14, 2016, 08:01:53 AM
Read 1151 times

nobody

  • *
  • Information
  • Newbie
  • Posts: 5
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! :)

March 14, 2016, 03:34:24 PM
Reply #1

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
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?

March 21, 2016, 03:50:22 PM
Reply #2

[email protected]

  • *****
  • Information
  • Hero Member
  • Posts: 271
Code: [Select]
module = hg.Modules.InDomain("HomeAutomation.python").WithAddress("0").Get()
param = module.Parameter("sensor.Temperature").Value

??

March 21, 2016, 10:03:08 PM
Reply #3

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
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.