HomeGenie Forum
General Category => Troubleshooting and Support => Topic started by: kevinvinv on January 22, 2016, 04:42:42 AM
-
Hi all, thanks for your patience.
I am still at a loss as to how to figure out the syntax of a particular command - in C# in my case.
As an example. the documentation says something like this:
Set the level of the module with address <module_address> to <level>% (0-100).
Syntax
/api/HomeAutomation.X10/<module_address>/Control.Level/<level>
GET /api/HomeAutomation.X10/A4/Control.Level/35
So how do I figure out how to call that function from a C# script?
Thanks!!!
-
That is not the C# code, that is the WebAPI call. You use that with a web call (e.g., web browser). There is a different section of the help guide that includes the C# methods but it does not always include an example for seeing syntax (which is something I have struggled with at times. I generally search the forum for examples for syntax which is not ideal.
-
If you happen across the section of the help that contains ANY functions related to X10 listed... I'd appreciate a pointer. I guess I still haven't found it... but will keep looking.
I see the web api stuff which contains a lot of X10 commands -- and I see the "helper" section which seems to contain C# commands but I haven't found any X10 section in there.
Anyhow- thanks again!!!
-
I've been using HG for a couple years and still struggle with determining syntax from the functions that are listed in the help section. I generally just try it and see what the error is. I wish there was a better way, but since I'm not a programmer by trade, this might be the standard way to document. :-\
-
Hi Kevin,
Not sure if this is what you need, but have you taken a look at the X10 Firecracker Program.
This contains at least some hints to your question.
I asume you need something like:
var my_X10_mod = Modules.WithName("A4");
my_X10_mod.Level = 35;
I have no way to test it, but in ZWave it does work.
Cheers Louis
-
That's the method I almost always end up using to learn a new language. Find example code that does similar tasks and glean as much information about syntax as possible. I generally copy snippets from different sources and stitch them together to construct my first attempts at working code.