Simple TCP server

Questions and comments specific to a particular plugin should go here.

Simple TCP server

Postby Rvergo » Thu Jun 19, 2014 12:54 am

Hey All

I have made a plug-in to event-ghost so it is easy to have a TCP connection with my RTI XP controller. But it shut work with all TCP clients

I have tested it with my HTPC and my XP-6

It is my first go in python so please be nice to me.. :)

Hope it is something you can use.
I have really mist at plug-in like that to event-ghost

Best regards Rasmus Vergo

__init__.py
RTI Simpel TCP Server
(7.5 KiB) Downloaded 171 times
Rvergo
 
Posts: 2
Joined: Sat Jun 14, 2014 1:22 am

Re: Simple TCP server

Postby holdestmade » Sat Jun 17, 2017 7:40 pm

Just found this, works great, many thanks.

Simon
holdestmade
 
Posts: 34
Joined: Thu Dec 04, 2014 2:44 pm

Re: Simple TCP server

Postby viperguy » Fri Sep 01, 2017 1:41 pm

hi there, I can get this working great sending srings from Eventghost to my RTI controller, but cannot get it working back the other way (sending strings from RTI to Eventghost), is that possible?
viperguy
 
Posts: 1
Joined: Sat Apr 20, 2013 11:52 pm

Re: Simple TCP server

Postby kgschlosser » Fri Sep 01, 2017 7:50 pm

I just took a look at the code for this.. I am not sure if the RTI remote would have an always on connection or not. seems kind of odd that it would. and that is how this plugin works. Its a modified version of the network event sender plugin.

If someone has a breakdown on RTi's API for they remotes i can look at it and see what can be done.
If you like the work I have been doing then feel free to Image
User avatar
kgschlosser
Site Admin
 
Posts: 2710
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Simple TCP server

Postby kgschlosser » Sat Sep 02, 2017 4:41 am

here I hammered out a variation of this plugin. I do not think the RTi connection would be persistent. I think it connects drops whatever data it needs to and closes the connection. the way the original is coded up is it sends data to the socket that is waiting for a connection. and RTi connects and runs there is no one there to send a message to it falls on def ears. that is why messages form RTi make it to EG but not vice versa. It also uses asyncore which I am not a huge fan of.


So this one i made up will create a new socket for sending data to RTi. I do not know if there is an API for this. but give it a go and see if it works.

The data that is sent to EG has to be json data. there is only one keyword that 100% of the time has to be there the other 2 are optional

the suffix keyword is mandatory
Code: Select all
{"suffix": "some_event_suffix"}


Code: Select all
{"suffix": "some_event_suffix", "prefix": "some_event_prefix", "payload": "some payload data"}


the payload can be a list, or a json object. a string. bool. whatever basically.
if you use the prefix keyword this will override the prefix you have entered in the plugin config.
If you like the work I have been doing then feel free to Image
User avatar
kgschlosser
Site Admin
 
Posts: 2710
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Simple TCP server

Postby holdestmade » Sat Sep 02, 2017 1:00 pm

I've been using this for months very successfully both ways. In the RTI driver, you have to end the SEND string with %0a.

The EG driver insists on this (see the top of the script):

# This plugin is a tcp server that can send and receive data.
#
# Strings send until get "\n" (or %0a) added to them.
# String received will not generate an event before "\n" (or %0a) is received.


As an example:

In the Driver settings, Enable Stop Char, %0a

In the Driver Command window I use NOTIFY.BLUE.OFFLINE%0a

This arrives in EG's log as RTI.NOTIFY.BLUE.OFFLINE '192.168.1.100'

RTI is the prefix, NOTIFY.BLUE.OFFLINE is the suffix and the IP address comes in as payload

I'll give your new driver a try sometime, it might work better.

Cheers

Simon
holdestmade
 
Posts: 34
Joined: Thu Dec 04, 2014 2:44 pm

Re: Simple TCP server

Postby holdestmade » Sat Sep 02, 2017 1:13 pm

Just gave the new plugin a try but fails on startup:

14:09:14 Traceback (most recent call last):
14:09:14 File "C:\ProgramData\EventGhost\plugins\RTi\__init__.py", line 67, in run
14:09:14 self._sock.bind((self._ip_address, self._local_port))
14:09:14 File "socket.pyc", line 228, in meth
14:09:14 error: [Errno 10049] The requested address is not valid in its context

What are the 2 different port numbers for ? the RTI driver only has one port setting available

Cheers
holdestmade
 
Posts: 34
Joined: Thu Dec 04, 2014 2:44 pm

Re: Simple TCP server

Postby kgschlosser » Sat Sep 02, 2017 9:19 pm

bah! i screwed up the network connection.

But..i do not how you set the information to be transmitted to EG on the RTI end of things. But i could have sworn i saw a screen shot of something about json coming from the remote. and if that is the case then this would be a much better transport mechanism I would think.

and I am guessing that the RTI remote keeps a thread looping to keep on trying to make a connection until it makes one. kind of a silly waste of processor if you ask me but they have to have their reasons.
If you like the work I have been doing then feel free to Image
User avatar
kgschlosser
Site Admin
 
Posts: 2710
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Simple TCP server

Postby holdestmade » Sun Sep 03, 2017 11:48 am

The driver that the RTI processor uses is RTI's own two way strings driver and you can basically send any string you want, you can also cause an event when a particular string is received like volume level etc. It uses less than 1% of the processor. The eg driver has been written by a user or dealer to work with the RTI strings driver. I've had it working without problems for months. I'd love to try a new approach if you've got one !

Cheers
holdestmade
 
Posts: 34
Joined: Thu Dec 04, 2014 2:44 pm


Return to Plugin Support

Who is online

Users browsing this forum: No registered users and 4 guests

cron