Jump to content

Trying to pass variable between 2 ISY's using the Portal


GDavis01
Go to solution Solved by Javi,

Recommended Posts

Posted

I have been passing variables between my 2 ISY's (different locations) for several years using Raspberry pi's and python programs.  I understand that it is possible to use the portal and eliminate the Raspberry but I'm having trouble finding the information to make this happen!

Both of my ISY's are 994i/IP Pro versions running v.5.0.16C.

I found one topic in the forum discussing this but the topic is now closed.

I am trying to grab a variable from ISY-2, with a value in the integer variable location of 30 (1.30) and move that value to an integer variable on ISY-1 (1.63). 

Here is a description of how I have been filling in the Network Resource information in my attempts:

- I understand that I need to be use https and GET, and to not check off either Encode URL or Use SNI.

- Host box, I understand that I need to grab the value from the portal of ISY-2. However that value is "https://my.isy.io/isy/xxxxxxxxxxxxxxxxx" What part of that string am I supposed to put in the Host box?

- port is 443, which is https port set up

- path: based on what I saw in that closed thread, I tried "rest/vars/set/1/63/${var.1.30}"

- Authorization: which User Name and Password should I be using... the credentials to log into the Admin Console or the credentials to log into the Portal?

Here is one attempt I tried, using a variation of the host 

GET rest/vars/set/1/63/${var.1.30} HTTP/1.1
Host: /isy/xxxxxxxxxxxxxxxxxxxxxxxx
User-Agent: Mozilla/4.0
Connection: Close
Content-Type: application/x-www-form-urlencoded
Authorization: Basic xxxxxxxxxxxxxxxxx

I have tried various attempts with host values using different parts of the string from the portal but each time I get a response, after running the NR, of TCP client DNS error!

Any suggestions on how to resolve this? 

Posted (edited)

I formerly had this setup with some bidirectional variable traffic. Each ISY must have NR support and changes in variable are send to the passive ISY's variable using the GET protocol.

Note: GET does not mean to "get it" from the other ISY but is just a protocol name to "push" it into the other ISY's variable. Bot directions use a GET protocol.

The only problem is writing an ISY program to detect a value change, send it into the other ISY's variable but not doing the reciprocal, as it would create an endless loop of IP packet traffic. IIRC I used only a few programs that detected a change in multiple variable values and sent all those in multiple NR GETs from the same program.

My system runs mostly on state variable values so controlling lights and devices only required a program or two at the dying ISY end. The active end (polisy and PLM controller) ) didn't care where the variable value came from, internal or external. I could never detect any increased delay in timing of anything. The CPUs split up the processing somewhat anyway.

I also never use HTTPS. You may need to generate a custom security package and I could never see the point of passing an encryption password online to be used for security. My system doesn't require that kind of complexity and it only keeps out the internet ignorant hackers.

Edited by larryllix
Posted

@larryllix Thanks for the reply.

Both of my ISY's have the Portal Integration and I am trying to send the variable from ISY-1 to ISY-2, running the NR on ISY-1.

I have tried using HTTP with port 80 but I am still getting the TCP client DNS error.

Do you have any advice on the HOST question... what part of the string from the portal should I be using in the NR for the HOST?

Similar question with respect to the AUTHORIZATION, should I use the Portal credentials or the Admin Console credentials?

To provide a little context, ISY-1 is my home device, whereas ISY-2 is my vacation home device. Whenever there is a power outage at my vacation home (which happens too often!), my router resets several minutes before the Bell modem resets and as a result the router just sits there without internet access.

What I am trying to do is send a variable (value of 9) daily from ISY-1 to ISY-2 at a specific time (at 5:00am), using a program; on ISY-2, I run one daily program (at 4:00am) to reset the variable to 0; then, also on ISY-2, I later run another program (at 5:30am) to check the value of the variable; If the variable = 0, it means that I do not have an internet connection because the value should have changed to 9, the THEN part of the program calls a program that turns off the Bell modem and the router and then restarts them in the proper order (note that I have Insteon On/Off switches attached to each); if the program finds that the variable = 9, ELSE does nothing. So, the programming is not complicated.

As an aside, I already do this process with the Raspberry's using a script that I adapted from something you posted several years ago. It works well but I am trying to understand how I can accomplish the same thing without using the Raspberry's.

 

Posted
3 hours ago, GDavis01 said:

@larryllix Thanks for the reply.

Both of my ISY's have the Portal Integration and I am trying to send the variable from ISY-1 to ISY-2, running the NR on ISY-1.

I have tried using HTTP with port 80 but I am still getting the TCP client DNS error.

Do you have any advice on the HOST question... what part of the string from the portal should I be using in the NR for the HOST?

Similar question with respect to the AUTHORIZATION, should I use the Portal credentials or the Admin Console credentials?

To provide a little context, ISY-1 is my home device, whereas ISY-2 is my vacation home device. Whenever there is a power outage at my vacation home (which happens too often!), my router resets several minutes before the Bell modem resets and as a result the router just sits there without internet access.

What I am trying to do is send a variable (value of 9) daily from ISY-1 to ISY-2 at a specific time (at 5:00am), using a program; on ISY-2, I run one daily program (at 4:00am) to reset the variable to 0; then, also on ISY-2, I later run another program (at 5:30am) to check the value of the variable; If the variable = 0, it means that I do not have an internet connection because the value should have changed to 9, the THEN part of the program calls a program that turns off the Bell modem and the router and then restarts them in the proper order (note that I have Insteon On/Off switches attached to each); if the program finds that the variable = 9, ELSE does nothing. So, the programming is not complicated.

As an aside, I already do this process with the Raspberry's using a script that I adapted from something you posted several years ago. It works well but I am trying to understand how I can accomplish the same thing without using the Raspberry's.

 

You got me on that one. I always used a port forward technique in the router for ISY-2 but that is ill advised these days so you should likely use the DDNS capability of the ISY Portal. I have no clue how you would accomplish that though. The Portal has grown way past my needs over the last few years and I have had no need to explore it further, yet.

As a weird workaround I might set up two port, forwarded and send a second confirmation into the second variable that gets checked against the first. :)

Another thought would be to send a pseudo device through to Alexa and have a routine to set the variable in ISY-2. Trouble is too many mechanisms and dependencies there and too many cloud servers in the mix. They always work until you need it someday. Then we get into checkbacks and creating a semi-blown protocol between them. :)

Posted

@GDavis01 I forgot to mentions that NRs have never received and displayed the response packets correctly, so the responses you are seeing from (assuming) manually sending test NR packets are likely the best you will ever get to see.

Posted (edited)

@Javi  I am still struggling with this!

I tried the code in a browser as follows:

https://my.isy.io/isy/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/rest/vars/set/1/30/5

Because I didn't know how to add the Portal credentials directly into the code (if that is even possible) I was asked to enter them separately. After that, the code worked and this line changed the integer variable 1.30 to the fixed value of 5.

However, when I tried to do the same thing through the Network Resource it failed.

Here is  a screenshot of the Network Resource where I tried to change the variable value to 11.

image.thumb.jpeg.748666029f29ba45fef7cfbda6211d75.jpeg

 

I consistently get a "TCP client DNS error" and the variable does not change!

I have tried changing the timeout with different values but each one failed.

Any thoughts on what I am doing wrong?

Edited by GDavis01
Added correct screenshot
Posted

It seems the Encode URL option would be in order here if you want it encrypted with Basic Authorisation. I haven't been involved in this stuff for a while now but I would give it a try.

Posted
12 hours ago, GDavis01 said:

@Javi  I am still struggling with this!

I tried the code in a browser as follows:

https://my.isy.io/isy/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/rest/vars/set/1/30/5

Because I didn't know how to add the Portal credentials directly into the code (if that is even possible) I was asked to enter them separately. After that, the code worked and this line changed the integer variable 1.30 to the fixed value of 5.

However, when I tried to do the same thing through the Network Resource it failed.

Here is  a screenshot of the Network Resource where I tried to change the variable value to 11.

image.thumb.jpeg.748666029f29ba45fef7cfbda6211d75.jpeg

 

I consistently get a "TCP client DNS error" and the variable does not change!

I have tried changing the timeout with different values but each one failed.

Any thoughts on what I am doing wrong?

See Below,  Timeout should be much higher, host should not contain path.  Authorization should be your Portal Credentials.

Screenshot 2023-10-24 at 4.14.45 AM.png

  • Thanks 1
Posted

@Javi

Thank you! I had incorrectly assumed that the 'very long key' was part of the Host, whereas it should be part of the Path!

That simple change has the NR working properly!  

 

Guest
This topic is now closed to further replies.

  • Recently Browsing

    • No registered users viewing this page.
  • Forum Statistics

    • Total Topics
      37.2k
    • Total Posts
      372.4k
×
×
  • Create New...