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!
Correct way to send commands from shell
-
- Site Admin
- Posts: 313
- Joined: Sun Nov 30, 2014 2:16 pm
Re: Correct way to send commands from shell
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:
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
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
Re: Correct way to send commands from shell
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.
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.
-
- Site Admin
- Posts: 313
- Joined: Sun Nov 30, 2014 2:16 pm
Re: Correct way to send commands from shell
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:
Then it would perform the two commands with one seconds pause between.
Code: Select all
call,300,Action