Jump to content

Network Module / EventGhost / TCP / UDP / Etc.


dpower

Recommended Posts

  • 3 weeks later...
Here is how I am doing it:

 

I create a program. Every program get's a unique number. The program contents is empty. I then run the program by right clicking on it and choosing run and then I get the corresponding event in EG. You can also look up the unique numbers in the summary page on the ISY. Then I just make respective calls to the program when I want to trigger something in EG.

 

Seems to be working great so far. Not sure how others are doing things.

I started playing around with this today. What I find is that EventGhost does not know the difference between a program running run if/run then/run else, and the macro executes when any of them are triggered. Do you see the same thing?

 

Also can anyone explain how, if at all possible, to have Eventghost send a command to the ISY? How does the "send manual command" work?

Link to comment
  • 4 weeks later...

First, I want to thank kingtd and PalChgo for writing and modifying this plugin.

 

Thought I give something back...through some trial and error, I was able to use the 'Send Manual Command' action to send commands to devices connected to my ISY99i.

 

For 'Control' - Input the different device commands. DOF, DON, DFOF, DFON, DIM, BRT

For 'Action' - Leave it blank

For 'Flag' - Leave it blank

For Node: - Input the device code. Ie. '18 CE 54 1'

 

I have no idea what the Action and Flag fields are used for. Maybe an UDI developer can chime in. :)

Link to comment
  • 2 months later...

I don't have eventghost but FWIW my homeseer plugin timeouts every now and again; and almost always when I'm making heavy use of the admin console. Fortunately it has a watchdog timer that most of the time fixes the problem but sometimes the watchdog timer is running every 30 mins or so long after I'm done fiddling with the admin console. I have to stop and start the plugin or homeseer to fix when it gets into that loop. I'm hoping to be able to get rid of HS soon. I think it's too demanding for the ISY processing power. DSCLink also sometimes can't update a variable.

 

 

Sent from my iPad using Tapatalk

Link to comment

Hi johnnyt,

 

The only way we can figure out whether the issue is related to processing power or a simple timeout, it would be best to turn debugging on (telnet, DON) and then look at the error log. This way you can see all the requests that are hitting ISY including their IP addresses.

 

We had a case last night where ISY was quite sluggish. It turned out that IRule was bombarding ISY with /rest/node requests (like 10 every second) but without having the correct credentials.

 

With kind regards,

Michel

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

Hi johnnyt,

 

The only way we can figure out whether the issue is related to processing power or a simple timeout, it would be best to turn debugging on (telnet, DON) and then look at the error log. This way you can see all the requests that are hitting ISY including their IP addresses.

 

We had a case last night where ISY was quite sluggish. It turned out that IRule was bombarding ISY with /rest/node requests (like 10 every second) but without having the correct credentials.

 

With kind regards,

Michel

 

It would seem that this is happening to me.  I have a message on the eventghost log that just says connection closed (or something to that effect) with the ISY IP address after it (I already deleted the log by doing a restart and don't remember the exact language it used).

 

EDIT:  The closing of the connection shows up as an event on eventghost and as such, I should be able to use that event to trigger a macro.  The macro could run autohotkey script that closes and restarts eventghost.  Since I already cleared the log, I can't copy that event into a macro, but next time it happens I'll be sure to do that.  I believe this is the second time in 24 hours that it has done this.

 

Alternatively, does anyone know if I could skip the subscription to ISY and use the network module to have ISY push a message to eventghost to trigger a macro?  I really don't need eventghost to track everything in ISY, just the home/away variable.

Link to comment

Hi apostolakisl,

 

You do not need to have subscriptions to ISY at all.

 

With kind regards,

Michel

 

I don't really know anything about how the plugin works, it is written in python I believe, but regardless, I don't know whatever it is.  I can say that with the plugin running, all ISY events get sent to eventghost and I can pick any of these events as triggers.  This connection established by the plugin just closes for no reason that I can tell.  There isn't an error, it just says it closed.  ?????  Anyway, I need it to not do that!

Link to comment

Hi apostolakisl,

 

Subscription is from ISY to the plugin (client) and not the other way around. ISY will definitely close all http connections if it does not have keep-alive (and after 2 seconds). So, if the plugin completely loses connection to ISY and cannot recover, then the issue is that either can no longer find ISY OR that ISY is too busy to respond.

 

With kind regards,

Michel

Link to comment

 

 

Alternatively, does anyone know if I could skip the subscription to ISY and use the network module to have ISY push a message to eventghost to trigger a macro?  I really don't need eventghost to track everything in ISY, just the home/away variable.

 

I use the Broadcaster plugin for EventGhost to receive messages from the ISY and it works very well. I use the 255.255.255.255 network broadcast so I can get messages on my laptop or PC if they are on as well as send commands to the always on windows tablet.   I also use a python script to send EventGhost messages to the ISY via rest.

 

ISY Network Resources

udp

Host:EG_Ip_Address(or 255.255.255.255 for network broadcast)

Port: 33333

Timeout: 500

Mode: Raw Text

 

I have noticed EG will stop working a few times a year so I have EG send an event to the ISY which triggers a program with a wait task. If the task is not restarted by EG I will get a text message saying EG is down so I know the tablet needs to be rebooted.  I also have EG check to see which A\V devices are ON (via ISY rest) in a given room when a voice command asks for "Volume UP" or "Down"  so the correct device volume is raised/lowered without needing to specify a device.  If receiver is on turn up the receiver volume if the receiver is off turn up the TV volume.

Link to comment

Hi apostolakisl,

 

Subscription is from ISY to the plugin (client) and not the other way around. ISY will definitely close all http connections if it does not have keep-alive (and after 2 seconds). So, if the plugin completely loses connection to ISY and cannot recover, then the issue is that either can no longer find ISY OR that ISY is too busy to respond.

 

With kind regards,

Michel

 

I see that this plugin has a heartbeat.  I assumed that the heartbeat was an event received from ISY, but it would seem instead that the heartbeat is generated by eventghost plugin for ISY and is designed to keep the connection open.  Though the heartbeat is about every 30 seconds, not 2 seconds.

 

EDIT:  I also noted that my ISY admin console had lost its connection.  This happens often for me.  And frequently there is a hidden window when this happens.  I have to hit the tab key and return to close the window, which I never end up seeing, before I can move on.  Otherwise every click on the ISY console just gives me a "ding" noise.

Link to comment

I use the Broadcaster plugin for EventGhost to receive messages from the ISY and it works very well. I use the 255.255.255.255 network broadcast so I can get messages on my laptop or PC if they are on as well as send commands to the always on windows tablet.   I also use a python script to send EventGhost messages to the ISY via rest.

 

ISY Network Resources

udp

Host:EG_Ip_Address(or 255.255.255.255 for network broadcast)

Port: 33333

Timeout: 500

Mode: Raw Text

 

I have noticed EG will stop working a few times a year so I have EG send an event to the ISY which triggers a program with a wait task. If the task is not restarted by EG I will get a text message saying EG is down so I know the tablet needs to be rebooted.  I also have EG check to see which A\V devices are ON (via ISY rest) in a given room when a voice command asks for "Volume UP" or "Down"  so the correct device volume is raised/lowered without needing to specify a device.  If receiver is on turn up the receiver volume if the receiver is off turn up the TV volume.

 

This looks interesting.

 

I am seeing this as

1) ISY broadcasts every event as a result of the network resource to anyone listening

2) Eventghost listens on port 33333 via the EG broadcast plugin

 

 

 

EDIT:  OK, I have this sort of working.  When I run the network resource, I just get "broadcast" as the event in EG.  How do I get something specific?

Link to comment

Hi apostolakisl,

 

You do not need to have subscriptions to ISY at all.

 

With kind regards,

Michel

 

It happened again.  The ISY plugin for eventghost does refer to the connection as a "subscription".  It reported "Insteon.Subscription - Closed 192.168.1.9:80" in the EG log.  The person who wrote the plugin would have been responsible for calling it a subscription, and from the standpoint of EG, I think it might be reasonable to call it a subscription, but not vice-versa.

 

I don't know why it is doing this.  If I restart Eventghost, it works fine.  But this plugin seems way to unstable to use for this purpose.  

 

I am hoping to get the network resource method described elsewhere to work, however, Trouble is, I can't get any content to show in Event ghost.  I probably need some forward slashes or something in the body to get it to work, but I just don't know what.  At present, EG just reports that it received a "broadcast" when I run the resource, but there is no content.

 

EDIT:  OK, I just forget to hit the "save" at the bottom of the network resource page after hitting "save" on the event itself.  Now it shows whatever I type in the body section.  Errrrrgggg.  I find this needing to hit save multiple times to actually have something save frustrating.  Can't hitting "save" on the actual resource actually save it to ISY instead of just my local java window?

Link to comment

I use the Broadcaster plugin for EventGhost to receive messages from the ISY and it works very well. I use the 255.255.255.255 network broadcast so I can get messages on my laptop or PC if they are on as well as send commands to the always on windows tablet.   I also use a python script to send EventGhost messages to the ISY via rest.

 

ISY Network Resources

udp

Host:EG_Ip_Address(or 255.255.255.255 for network broadcast)

Port: 33333

Timeout: 500

Mode: Raw Text

 

I have noticed EG will stop working a few times a year so I have EG send an event to the ISY which triggers a program with a wait task. If the task is not restarted by EG I will get a text message saying EG is down so I know the tablet needs to be rebooted.  I also have EG check to see which A\V devices are ON (via ISY rest) in a given room when a voice command asks for "Volume UP" or "Down"  so the correct device volume is raised/lowered without needing to specify a device.  If receiver is on turn up the receiver volume if the receiver is off turn up the TV volume.

 

 

Any chance you can post an example of a REST command as a python script in EG?  

Link to comment

Any chance you can post an example of a REST command as a python script in EG?  

<?xml version="1.0" encoding="UTF-8" ?>
<EventGhost Version="1700">
    <Folder Name="ISY Examples" Expanded="True">
        <Macro Name="Set ISY Global Variables" Expanded="True">
            <Event Name="Main.OnInit" />
            <Action Name="Set ISY Global Variables">
                EventGhost.PythonScript(u'#SET YOUR ISY INFORMATION HERE\n\n#ISY USER NAME\neg.globals.isyusername = "Isy_Username_here"\n\n#ISY PASSWORD\neg.globals.isypassword = "Isy_Password_Here"\n\n#ISY IP ADDRESS\neg.globals.isyipaddress = "Isy_Ip_Address_Here"')
            </Action>
        </Macro>
        <Macro Name="Example Device On" Expanded="True">
            <Action Name="Trigger device action">
                EventGhost.PythonScript(u'import urllib\n\n#ENTER THE DEVICE ID BELOW IN THE FOLLOWING FORMAT "XX.XX.XX"\ndeviceid = "22.89.3A"\n#ENTER THE DEVICE SUB ID BELOW. THIS IS USUALLY "1", EXEPT FOR DEVICES WHICH HAVE MORE THAN ONE ITEM TO CONTROL LIKE A KEYPAD OR FAN MODULE\ndevicesubid = "1"\n#ENTER THE COMMAND BELOW. ON IS "DON", OF IS "DOF", ON LEVEL (DIM/BRIGHTEN) IS "DON/1" THROUGH "DON/255"\ndevicecommand = "DON"\n\n\n#DO NOT CHANGE ANYTHING BELOW THIS LINE\n\ndeviceid = deviceid + "." + devicesubid\ndeviceid = deviceid.replace(".", "%20")\nurl = "http://" + eg.globals.isyusername + ":" + eg.globals.isypassword + "@" + eg.globals.isyipaddress + "/rest/nodes/" + deviceid + "/cmd/" + devicecommand\n\n#THIS WILL SEND THE COMMAND\nurllib.urlopen(url)\n\n')
            </Action>
        </Macro>
        <Macro Name="Example Request device status" Expanded="True">
            <Action Name="Request Device Status">
                EventGhost.PythonScript(u'import urllib\n#import xml.etree\nfrom xml.etree import ElementTree as ET\n\n\n#ENTER THE DEVICE ID BELOW IN THE FOLLOWING FORMAT "XX.XX.XX"\ndeviceid = "22.89.3A"\n\n#ENTER THE DEVICE SUB ID BELOW. THIS IS USUALLY "1", EXEPT FOR DEVICES WHICH HAVE MORE THAN ONE ITEM TO CONTROL LIKE A KEYPAD OR FAN MODULE\ndevicesubid = "1"\n\n\n\n#DO NOT CHANGE ANYTHING UNTIL EXEPT IN THE IF OR ELSE STATEMENT BELOW\ndeviceid = deviceid + "." + devicesubid\ndeviceid = deviceid.replace(".", "%20")\nurl = "http://" + eg.globals.isyusername + ":" + eg.globals.isypassword + "@" + eg.globals.isyipaddress + "/rest/status/" + deviceid\n\n\n#--------This is the XML File---------\n#<?xml version="1.0" encoding="UTF-8"?>\n\n#-<properties>\n\n#<property uom="%/on/off" formatted="Off" value="0" id="ST"/>\n\n#</properties>\n#---------That was the XML File------------\n\n\nresponse = urllib.urlopen(url)\n\nstatus = response.read()\n#"ET" is short for ElementTree as "from xml.etree import ElementTree as ET is above\nstatus = ET.fromstring(status)\nstatus = status.find(\'property\')\nstatus = status.attrib[\'value\']\nstatus = int(float(status))\n\nif status == 0:\n     print "Device is OFF"\nelse:\n    print "Device is ON"\n')
            </Action>
        </Macro>
    </Folder>
</EventGhost>

Copy and paste this into your EventGhost Tree

 

You will need to edit the macro "Set ISY Global Variables" with your ISY username, password, and ip_address. Then save the script, then save the EventGhost file! This script will be triggered on startup from now on but you will need to Execute the macro at least one time to set the variables after you update the username, password ext. unless you restart eventghost.

 

I have included 2 example macros with python scripts for device status and device actions, you just need to change the device IDs and Actions (if applicable). I left detailed notes in the examples.

 

Best,

Javier

Link to comment

Thanks to Javier with the help on the python scripts.  I have this all working great.

 

Phone via Tasker sets a state variable to 1 (home) or 0 (away) on ISY.  I use wifi connected to home as the tasker trigger.

ISY via a program that triggers on change in that variable to post to my PC running EventGhost that I am home or away.

EventGhost via a python script (not the ones here) runs an Auto Hot Key script that opens internet explorer, IE is set to home page of google voice settings, the ahk script checks to see if my cell phone is being copied to my home, if it should be changed, then it changes it, then it closes internet explorer.  I have myself logged into google voice so no user/pass is needed since it is held in a cookie.  I have a nearly identical script on firefox that does the same thing for my wife and keeps her logged in.  I use chrome for my regular browsing which is why i use ie and firefox for this.

 

The long and short of it is that when I am home (or I guess I should say when my cell phone is home), the home phones ring when someone calls my cell phone and when not at home it doesn't.  Same for my wife.

Link to comment
  • 10 months later...

I am trying to trigger a computer running event ghost that is not on my lan.  I can't seem to get it working. I have no probs triggering computers within my lan using ISY/EG.  What I did

 

1) Port forwarded 33,333 to the LAN IP of the computer running EG (the remote computer)

2) Set ISY to send a UDP to the WAN IP address of the remote network computer, port 33333

3) test it and nothing happens.

 

I am using essentially the exact setup that works when EG and ISY are on the same LAN, I copied my network resource and then changed the host to the WAN of my remote computer.  I copied the event ghost tree from the LAN computer to the remote computer, so all of those settings are identical.

 

I was able to self trigger EG on the remote computer, for whatever that is worth.

 

I can confirm that the port forward is working as I tried an experiment by setting remote desktop to listen on port 33333 and I could connect.

 

What could I be missing here?

Link to comment

Assuming there is a router in front of the remote/destination device; the firewall on the destination side is doing its job: blocking unsolicited traffic. You'll need to set up a firewall rule on the destination to allow that port in, and then supply the internal NAT'd IP address (192.x.x.x) so that the destination router routes the packet correctly

Link to comment

Assuming there is a router in front of the remote/destination device; the firewall on the destination side is doing its job: blocking unsolicited traffic. You'll need to set up a firewall rule on the destination to allow that port in, and then supply the internal NAT'd IP address (192.x.x.x) so that the destination router routes the packet correctly

I port forwarded it. (it being port 33333 of the remote router directing to the LAN IP, port 33333 of the EG computer)

Link to comment

I  recommend using the webserver eventghost plugin if you are trying to do something outside of the local network.  Even if you get UDP to work, which may in itself be an uphill battle, it does not provide feedback so your commands may not reach the destination all of the time.

Link to comment

I  recommend using the webserver eventghost plugin if you are trying to do something outside of the local network.  Even if you get UDP to work, which may in itself be an uphill battle, it does not provide feedback so your commands may not reach the destination all of the time.

Javi,

 

Thanks for pointing that out.  I got it working.  Not sure how much I need to worry about security.  Add a self-signed certificate?  Not sure how hard that is.  Change the port?  Not sure that really does anything.  Or, do nothing?  Not sure if pointing port 80 to EG webserver opens up much of an opportunity to hack the network.

 

The html pages I have written are super basic.  Just displays a message, with 2 hyperlinks, so that I can trigger 2 different macros on EG.

 

 

EDIT:  I have to say, this webserver is looking like a bit of fun.  You can turn your phone in to a remote control for your computer pretty easily and quite responsively.  If only I was better at creating web pages.

Link to comment

 

 

EDIT:  I have to say, this webserver is looking like a bit of fun.  You can turn your phone in to a remote control for your computer pretty easily and quite responsively.  If only I was better at creating web pages.

 

That was the reason I used it a few years back, before I went all in on voice...got tired of changing UIs for websites/apps every time I added/updated/removed/changed my devices.  I did remember you could send a direct command which is why I suggested the plugin.

 

 

 

Thanks for pointing that out.  I got it working.  Not sure how much I need to worry about security.  Add a self-signed certificate?  Not sure how hard that is.  Change the port?  Not sure that really does anything.  Or, do nothing?  Not sure if pointing port 80 to EG webserver opens up much of an opportunity to hack the network.

 

In my opinion you should do everything possible to avoid being compromised, there are tutorials on this forum on how to get a cert.  You may also want to look into vpn.  Those are just my opinions, I am not a network security expert. 

Link to comment

Archived

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


×
×
  • Create New...