Jump to content
Gen2 Devices: FW Update Required / Gen2 Geräte: FW-Update erforderlich ×

Script access from local Shelly device to a remote Shelly device via WLAN


Recommended Posts

Since some days I tried to figure out the type and syntax of script commands to access a remote shelly device. 

I have several http text lines which work very well if they are sent via a browser to the remote device (PlusPlugS).

e.g.  http://192.168.2.139/relay/0?turn=off   or 

http://192.168.2.139/rpc/PLUGS_UI.SetConfig?config={"leds":{"mode":"switch", "colors":{"switch:0":{"on":{"rgb":[100,0,0],"brightness":100},"off":{"rgb":[0,0,100],"brightness":100}}}}}

But finally these commands should reside in the script of a shelly device PlusPlugS (e.g. 192.168.2.140) and shall be sent to the other PlusPlugS (e.g. 192.168.2.139).

There were several examples on the Internet telling it might work with Shelly.call("http.get", ....) and there are hundreds of examples showing "http://...." strings for the shellys, but since days I was not able to find any variant of command which works in the script the same way it works directly from the browser. Does anyone have an example that really works in a script?

Maybe its also a problem to find the correct syntax for the Shelly-command.

Many thanks in advance for your help. 

Link to comment
Share on other sites

Hi Pluto. Thanks for your suggestion, but unfortunately the syntax of the example does not really solve my problem. 

My initial instruction string like "http://192.168.2.139/relay/0?turn=off" is working very well if sent via the browser.
It is the correct syntax for the browser.

I am looking for a solution/instruction within a script which is doing the same function (=switch on/off the remote switch).

A part of the script in device 192.168.2.140 could look like:

.....
if (apower >= 12) {
     //turn off the remote switch at 192.168.2.139

     ??? "http://192.168.2.139/relay/0?turn=off" ???     //this should do the same from within the script as it does in the browser
}
else {

     //turn on the remote switch at 192.168.2.139
     ??? "http://192.168.2.139/relay/0?turn=on" ???     //this should do the same from within the script as it does in the browser
}
....

I know that the red text above is wrong as a script instruction, but what would be the right instruction to fullfill this function in the script (=switch on/off the remote switch in a Shelly PlusPlugS)?

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...