swnewman Posted October 9, 2014 Posted October 9, 2014 In my quest to get the iRule app on my tablet subscribed to ISY messages, I've had to try to figure out ISY web services. Without much familiarity with SOAP or WSDL, I was able to do the following from a desktop browser: Using the Postman extension in Chrome, I posted the example SOAP subscription xml to ISY /services. Attached shows the screenshot results of that. Essentially I get a Status 200 OK and some response xml. Assuming that means I have successfully subscribed to ISY, how would I go about viewing messages that should be now flowing to my desktop machine every time ISY records an action? I would like to see the format of the responses to, say, a light switch turning on. I assume it is xml; does it follow the same format as the REST responses? I need to know in order to be able to parse the feedback in iRule. On the other hand if anyone has already gotten subscription to work in iRule, I would welcome any pointers. So far I have not been successful. Doesn't seem like I am getting the gateway and/or command set up correctly. Thanks for your help. -Seth
Michel Kohanim Posted October 10, 2014 Posted October 10, 2014 Hi Seth, I thought iRule already does that. Does it not? For subscription to work, you need to make sure iRule keeps the subscription socket open. With kind regards, Michel
swnewman Posted October 11, 2014 Author Posted October 11, 2014 (edited) iRule has an ISY module which I'm sure is set up to work with the web services, but it is fairly limited on how you can design with it. (Trust me I would purchase the module if it would work with my design, it would be so much simpler.) I am trying to do it with the built in http gateway capability. Everybody keeps saying it should be possible, but I have yet to run into anybody that has actually done it. Edited October 11, 2014 by swnewman
Michel Kohanim Posted October 12, 2014 Posted October 12, 2014 Hi swnewman, Please try the subscription method as described above and let me know what you find. With kind regards, Michel
swnewman Posted October 27, 2014 Author Posted October 27, 2014 (edited) Michel, I still haven't had much success with this. I've tried browser-based plugins on my desktop to try to help me understand the web service subscription outside of the iRule application. As shown in my first post, I can send a subscribe command and get back a "Status 200 OK", along with some xml containing some sort of ID. This is where I hit a road block. Once I am "subscribed" successfully, in theory I should be able to receive event-driven responses (i.e. a switch turning on or off), right? I get no other notices to my desktop when devices are updated in ISY via a switch. Is this even possible in the browser-based approach I am using? Or could you suggest another tool more appropriate to the task? I tried one tool recommended in the wiki but I wasn't even able to get the "Status 200 OK" response to my subscribe POST message. Perhaps I am missing some key piece of knowledge to get this working. Maybe the socket? I am simple following the tutorial for the subscribe command and entering "REUSE_SOCKET" for the report url. Please let me know if that's not right. Sorry for all the questions, I hope you can help me get this working. I've asked for help on the iRule forums but nobody is able/willing to help me. I'm sure it's something simple I'm missing, unless they do not provide the ability for the end user to subscribe to ISY feedback outside of their separate ISY module. That's why I kinda want to get this working outside of their app just to better understand the process. Thanks for the help. -Seth Edited October 27, 2014 by swnewman
Michel Kohanim Posted October 29, 2014 Posted October 29, 2014 Hi Seth, Please send an email to support@universal-devices.com and I'll hook you up with iRule's dev team as I know they have already done all of this. Do you keep the subscription socket open after you make a call or is it closed? You can check the error log for -5011 or -5012 errors. These basically let you know if ISY thinks the socket is closed. With kind regards, Michel
swnewman Posted October 29, 2014 Author Posted October 29, 2014 I'll check the logs. Is there a certain command that instructs the socket to remain open? Email sent.
swnewman Posted October 30, 2014 Author Posted October 30, 2014 (edited) Okay, another iRule user tackled this and managed to get it working using a TCP gateway in iRule versus HTTP. I've followed his instructions and it looks like I'm getting a good connection to ISY for sending the subscribe command, but I don't appear to be getting any feedback. I just checked the error log after multiple times pressing the button to send the subscribe command and I see errors like the following: -170001 [uDSockets] RSub:32 error:6 -5012 30 -170001 [uDSockets] RSub:33 error:6 -170001 [uDSockets] RSub:33 error:6 -5012 31 -170001 [uDSockets] RSub:33 error:6 -170001 [uDSockets] RSub:33 error:6 -170001 [uDSockets] RSub:33 error:6 -170001 [uDSockets] RSub:33 error:6 Does ISY think the socket is closed? I did notice my rest/subscriptions now has two unexpired subscriptions amongst the expired ones. <Sub isExpired="no" isPortal="no" sid="33" sock="33" isReusingSocket="yes" isConnecting="no"/> <Sub isExpired="no" isPortal="no" sid="35" sock="30" isReusingSocket="yes" isConnecting="no"/> On a related note, I decided to clear my error logs and since then every time I press Error Log in the Tools menu it says Request Failed! Is this a bug? I've tried creating more subscribe errors but now it seems I can no longer get the error log to download. Edited October 30, 2014 by swnewman
swnewman Posted October 31, 2014 Author Posted October 31, 2014 Well the error log is now working again. I guess maybe there is some delay before it is available.
Michel Kohanim Posted October 31, 2014 Posted October 31, 2014 Hi snewman, As I suspected, -5012 errors: http://wiki.universal-devices.com/index.php?title=ISY-99i/ISY-26_INSTEON:Errors_And_Error_Messages This basically means that ISY tried to publish the events to the client but the client was not there anymore (or didn't respond). Are you immediately going to listen mode after your subscribe? If the log is empty, you get that error. With kind regards, Michel
swnewman Posted October 31, 2014 Author Posted October 31, 2014 Is there a separate command for "listen mode"? All I do is send the subscribe command and wait for a response on the screen in a feedback textbox. I saw no response to the subscribe command or subsequent ISY update events. The feedback textbox is set to listen for any response (i.e. no parsing). The other user who got this working has shared his setup in the iRule library. I'm going to import his version, when I get the time, to see if I missed anything in the setup.
Michel Kohanim Posted November 2, 2014 Posted November 2, 2014 Hi swnewman, Thank you. I suspect whatever you're using as socket framework is immediately closing the socket that's why you do not see any responses in the feedback. With kind regards, Michel
swnewman Posted November 3, 2014 Author Posted November 3, 2014 Actually, I got it working finally! I had a problem with how I was parsing the feedback, but now I see all of the messages coming across. I think I still get errors in the log, but I'm getting feedback anyway. Quick question: For updating the state of my devices, I'm guessing I should use the events listed as "ST". Is that correct?
Michel Kohanim Posted November 3, 2014 Posted November 3, 2014 Hi swnewman, That's perfect! We might need your solution!!! Yes, ST is the correct control to use the value of. With kind regards, Michel
swnewman Posted November 4, 2014 Author Posted November 4, 2014 Thanks for your help. I've told Mike that I can write up something if needed.
chrishick Posted November 25, 2014 Posted November 25, 2014 swnewman, Can you please share how you were able to get subscriptions to work with iRule? Right now I have to query every few seconds and parse the response which is slow. I would love to get the subscription working but don't know where to even begin. Thanks Chris
piplight Posted January 23, 2016 Posted January 23, 2016 (edited) I'm also curious on this subscription, if there was a right up done on how to make it work. Thanks. Edit: For anyone looking to do this, found a great write up at:https://getsatisfaction.com/irule/topics/isy-web-service-subscription I got feedback working first try, have yet to do anything with it though. That'll be another day. Edited January 23, 2016 by piplight
Recommended Posts