Jump to content

Subscribing to ISY for events


ldrinc

Recommended Posts

Michel,

 

I am using a voice control software by the name of VoxCommando. Currently, I have it executing programs and commands in my ISY nicely. I'd like to have the VoxCommando software monitor events that take place in the isy such as when a motion detector is triggered so that it will speak to me when it does.

Link to comment
  • 9 months later...
  • 1 year later...

Sorry to bring up an old conversation, but I'm trying to do what is described in this post. Unfortunately, I'm new to configuring something like this (I primarily deal with large scale computing systems; nothing quite this small). I've configured a Raspberry Pi as a LAMP web server and will use Python and MySQL to watch for conditions and trigger REST entries.

 

I've figured out how to poll the ISY for data using http, but would like to subscribe to it with an open web socket (on the RPi) to avoid abusing the connection and protocol.

 

I've read through various sections of the WS-SDK (including 9.0 Web Sockets and Subscriptions), pieces and parts of RFC 6455 and still don't have a clear picture on how to proceed in making the subscription. Do you have more explicit instructions available (for a newbie), and/or recommended reading where I can learn more detail on what I'm trying to do?

 

I recognize there's quite a learning curve; even after I figure out how to subscribe the RPi to the ISY - I still need to figure out where the acquired data goes and how to get it into MySQL (let alone use Python to query and organize then PHP to present the data...).

 

Thanks.

Luis

Link to comment

Have you seen my Javascript Websocket example at http://forum.universal-devices.com/topic/15248-problems-creating-a-websocket-connection/page-2?do=findComment&comment=150499 ?

 

Granted - it runs in a browser - but I suspect you could modify it to subscribe to events for other use cases.

 

(This is an example page designed to be served directly from ISY....  and the JS executed from the connected browser. This is because of the authorization header and security requirements of WebSockets. In a non-browser implementation - the 

 

var ws_host = "wss://" + isy_host

 

would likely have to be changed to 

 

var ws_host = "wss://username:password@" + isy_host

 

Michael.

Link to comment

Sorry to bring up an old conversation, but I'm trying to do what is described in this post. Unfortunately, I'm new to configuring something like this (I primarily deal with large scale computing systems; nothing quite this small). I've configured a Raspberry Pi as a LAMP web server and will use Python and MySQL to watch for conditions and trigger REST entries.

 

I've figured out how to poll the ISY for data using http, but would like to subscribe to it with an open web socket (on the RPi) to avoid abusing the connection and protocol.

 

I've read through various sections of the WS-SDK (including 9.0 Web Sockets and Subscriptions), pieces and parts of RFC 6455 and still don't have a clear picture on how to proceed in making the subscription. Do you have more explicit instructions available (for a newbie), and/or recommended reading where I can learn more detail on what I'm trying to do?

 

I recognize there's quite a learning curve; even after I figure out how to subscribe the RPi to the ISY - I still need to figure out where the acquired data goes and how to get it into MySQL (let alone use Python to query and organize then PHP to present the data...).

 

Thanks.

Luis

There are already 2 python libraries available that handle this.

https://github.com/evilpete/ISYlib-python

https://github.com/automicus/PyISY

 

 

Sent from my Pixel C using Tapatalk

Link to comment

Michael, No, I hadn't. I searched for "subscribe" and trolled various pages and hadn't come across that. Thanks. I'll take a closer look and consider how that fits in to my set up over the next few days.

 

Jimbo, sounds great. I found those libraries before, but couldn't tell (or know) where to look for the websocket and/or subscription file(s). I presume I'm looking in the ISY folder at /ISYlib-python. To subscribe, am I looking for IsyEvent.py, IsyEventData.py, the Bin folder has isy_showevents.py, other? I saw IsyDiscover.py which is part of the equation.

 

Wow. Thank you both. 

Luis

Link to comment

Sorry I have n used ISYlib-python, I have only used PyISY in my ISYHelper program. But I have to say I am not completely happy with the way PyISY organizes the data structures, but it works great for me, after I pushed a few bug fixes and enhancements. It's document is pretty good to get you started, and I think I still have a couple small scripts I wrote as examples when I was learning it that I can dig up for you.

 

Sent from my Nexus 6P using Tapatalk

Link to comment

Archived

This topic is now archived and is closed to further replies.


×
×
  • Create New...