Page 1 of 1

Correct way to send commands from shell

Posted: Wed Nov 11, 2015 5:40 pm
by lassiko
I would like to know that what is the best way to send commands to Nethome from Shell?
Currently i am doing it (from another Raspberry) with wget, e.g TV_ON: wget -O - "http://192.168.0.105:8020/home?page=roo ... ion=toggle"

Is there a better or right way to do this?

thank you!

Re: Correct way to send commands from shell

Posted: Thu Nov 12, 2015 8:53 pm
by stefangsbb
That was a quite creative way of doing it! There are many ways, but the one you use is a bit dangerous, since you are using a non published GUI interface which can change at any time when the GUI changes...

From Linux I would recommend to use NetCat (nc) to connect to an UDPCommandPort. In this example I have created a UDPCommandPort on port 8005, and the Id of my window lamp is 108. To toggle that lamp I use the command:

Code: Select all

echo 'call,108,toggle' | nc -u -w 0 192.168.1.100 8005
You can use a TCPCommandPort too, but then you get a line in the log for each connection and UDP is faster. For more information about the commands in the UDPCommandPort, see http://wiki.nethome.nu/doku.php/commandportsyntax

Re: Correct way to send commands from shell

Posted: Tue Nov 17, 2015 7:51 am
by lassiko
Hi Stefan,

Thank you for this hint, works much better! :)

How about if i want to toggle a set of lights, e.g;
<HomeItem Class="Scene" >
<Attribute Name="ID">300</Attribute>
<Attribute Name="Name">Ulkovalot off scene</Attribute>
<Attribute Name="Delay">1.0</Attribute>
<Attribute Name="Command1">call,170,off</Attribute>
<Attribute Name="Command2">call,150,off</Attribute>
</HomeItem>

using a ID 300 did not work.

Thanks.

Re: Correct way to send commands from shell

Posted: Wed Nov 18, 2015 10:13 pm
by stefangsbb
I am not sure I understand what you mean... The Id of an Item is automatically assigned by the server when the Item is created. The Scene-Item only have one action (called "Action"), so the only thing you can do with it would be:

Code: Select all

call,300,Action
Then it would perform the two commands with one seconds pause between.