Receive message over RS232 and IP. trigger and action

Posted on
Thu Jun 05, 2014 6:53 pm
mark_anderson_us offline
Posts: 65
Joined: Jun 05, 2014

Receive message over RS232 and IP. trigger and action

Hi All

Total Noob

I'm testing Indigo with a view to moving from HomeSeer. My HomeSeer has a few serial and IP interfaces. I send an message over RS232 to my HS PC, there's a simple .NET script that registers a callback function on ComPort XX. This parses the message band fires the appropriate event.

I've read the quick start, added a bunch of devices and plug-ins and read the docs on triggers, actions, devices, etc.

Where would I start with something like this on Indigo and OS X (assuming I have a working RS232 connection on the Mac already.

Need to register something to receive messages and trigger stuff in Indigo

Any pointers greatly appreciated

Thanks

Mark

Posted on
Thu Jun 05, 2014 7:57 pm
RogueProeliator offline
User avatar
Posts: 2501
Joined: Nov 13, 2012
Location: Baton Rouge, LA

Re: Receive message over RS232 and IP. trigger and action

Where would I start with something like this on Indigo and OS X (assuming I have a working RS232 connection on the Mac already

For your IP connections, you could check out the Cynical Network Plugin -- it allows you to send/receive on a socket, defining actions for received messages via regular expressions IIRC. Been a while since I used it, but it is solid and used by a lot of people.

There is a serial plugin floating around somewhere that could give you a start, but your best and tightest integration would be to write a custom plugin. They are very quick and easy, assuming you are writing it only for yourself. A little more work, like any software, to generalize for others.

Also, the plugin list is very extensive -- so you might search for anything that can already control equipment or do very close to what you want to get you started.

Adam

Posted on
Fri Jun 06, 2014 1:26 pm
mark_anderson_us offline
Posts: 65
Joined: Jun 05, 2014

Re: Receive message over RS232 and IP. trigger and action

RogueProeliator wrote:
Where would I start with something like this on Indigo and OS X (assuming I have a working RS232 connection on the Mac already

For your IP connections, you could check out the Cynical Network Plugin -- it allows you to send/receive on a socket, defining actions for received messages via regular expressions IIRC. Been a while since I used it, but it is solid and used by a lot of people.

There is a serial plugin floating around somewhere that could give you a start, but your best and tightest integration would be to write a custom plugin. They are very quick and easy, assuming you are writing it only for yourself. A little more work, like any software, to generalize for others.

Also, the plugin list is very extensive -- so you might search for anything that can already control equipment or do very close to what you want to get you started.

Adam


Thanks Adam

I searched the plug-ins forum, but didn't find anything. To get up and running quickly, I'd like to use what's out there and replace (if needed) once I get more familiar.

The main thing I'm integrating is my URC system (with MSC 400), as the URC remote controls a lot of lights too (currently via HomeSeer). It's all based on macros I wrote in CCP that send messages (HomeSeer event names) to HomeSeer via RS232. These are then used to trigger HS events. So basically I need to create a trigger in Indigo to receive the message and action groups that match my HomeSeer event names (assuming I can pass the action group name as a parameter, if not, will need a lot of triggers). When a message is received, it will run the action group with the name in the message.

Regards

Mark

Posted on
Fri Jun 06, 2014 3:22 pm
berkinet offline
User avatar
Posts: 3290
Joined: Nov 18, 2008
Location: Berkeley, CA, USA & Mougins, France

Re: Receive message over RS232 and IP. trigger and action

For a quick prototype setup I'd suggest...

  1. Make your serial connection look like an IP socket.
      OS X comes with nc (netcat) and there is a nice GUI program that does the basics, MultiCom. But I'd suggest ser2sock. Very easy to setup, though you will need to compile it - simple one line compile. I can provide you with a binary if you need it.
      You can also check out this blog page on the topic.
  2. Install Perry the Cynic's Cynical Network Plugin to let Indigo listen to your serial data stream via the IP socket you have connected to it.
  3. Setup Indigo triggers, based on events from the Cynical Network Plugin, for each of the patterns you want to trap and in each trigger, define the action to take.

That should get you going. But, I'll warn you. Once you get the hang of this you will absolutely want to build a custom plugin. Going that route, instead of using triggers, you could actually create pseudo-devices where each device would represent a specific serial instruction and the related action. Then, this device would appear in the Indigo DEVICES window, just like any other device and the state Icons would reflect the actual state of the virtual device. If your context supports it, you could even turn the device on and off from Indigo or the Indigo Touch app.

WARNING, this can be VERY habit forming and there is no 12 step program to break the habit. Just a bunch of other addicts to help keep you hooked. :P

Posted on
Fri Jun 06, 2014 3:43 pm
RogueProeliator offline
User avatar
Posts: 2501
Joined: Nov 13, 2012
Location: Baton Rouge, LA

Re: Receive message over RS232 and IP. trigger and action

WARNING, this can be VERY habit forming and there is no 12 step program to break the habit. Just a bunch of other addicts to help keep you hooked.

This may be the truest statement ever typed on this forum. Too many plugins, not enough time...

Posted on
Fri Jun 06, 2014 4:17 pm
mark_anderson_us offline
Posts: 65
Joined: Jun 05, 2014

Re: Receive message over RS232 and IP. trigger and action

berkinet wrote:
For a quick prototype setup I'd suggest...

  1. Make your serial connection look like an IP socket.
      OS X comes with nc (netcat) and there is a nice GUI program that does the basics, MultiCom. But I'd suggest ser2sock. Very easy to setup, though you will need to compile it - simple one line compile. I can provide you with a binary if you need it.
      You can also check out this blog page on the topic.
  2. Install Perry the Cynic's Cynical Network Plugin to let Indigo listen to your serial data stream via the IP socket you have connected to it.
  3. Setup Indigo triggers, based on events from the Cynical Network Plugin, for each of the patterns you want to trap and in each trigger, define the action to take.

That should get you going. But, I'll warn you. Once you get the hang of this you will absolutely want to build a custom plugin. Going that route, instead of using triggers, you could actually create pseudo-devices where each device would represent a specific serial instruction and the related action. Then, this device would appear in the Indigo DEVICES window, just like any other device and the state Icons would reflect the actual state of the virtual device. If your context supports it, you could even turn the device on and off from Indigo or the Indigo Touch app.

WARNING, this can be VERY habit forming and there is no 12 step program to break the habit. Just a bunch of other addicts to help keep you hooked. :P


Thanks berkinet. NC will be great as that's what I was planning to use for my IP messaging project. I built a siri integration with HomeSeer using the siri proxy and IP messages socat (wrote about it here: http://www.hometoys.com/emagazine.php?art_id=2088).

if I can funnel everything to NC I'll only have to process a single channel.

There wouldn't be any point in me creating virtual devices for my project. Basically, when I turn on the TV or press play on DVR, AppleTV, Blu-ray, etc. it dims the lights. All it does is send a message to Homeseer saying "Movie". This triggers the movie event, which is used from many other triggers. This event sets the lighting levels of several z-wave switches (real devices). When the movie/TV is paused or TV is turned off, it raises the light level in the living room. Resuming again dims them. Way cool.

Once I get stuff up and running, learn python and get my head round the plug-in architecture, I'll definitely do one if it warrants it.

Thanks again

Mark

Posted on
Sat Jun 07, 2014 8:26 am
berkinet offline
User avatar
Posts: 3290
Joined: Nov 18, 2008
Location: Berkeley, CA, USA & Mougins, France

Re: Receive message over RS232 and IP. trigger and action

mark_anderson_us wrote:
...There wouldn't be any point in me creating virtual devices for my project. Basically, when I turn on the TV or press play on DVR, AppleTV, Blu-ray, etc. it dims the lights. All it does is send a message to Homeseer saying "Movie". This triggers the movie event, which is used from many other triggers. This event sets the lighting levels of several z-wave switches (real devices). When the movie/TV is paused or TV is turned off, it raises the light level in the living room. Resuming again dims them. Way cool....

It sounds like you've thought this through pretty well. As you describe the functionality, I'd agree, a plugin probably wouldn't add a lot. Maybe make the setup interface a bit more seamless, but no real benefit.

BTW, in Indigo terms, the HS movie event would be an Action Group.. Each Action Group contains one or more actions for Indigo to take. These actions can be device changes, scripts executed, log entries, emails, etc. The other half of the equation is the Trigger. A Trigger "looks" for a specific event to take pace: a light turns on, a plugin indicates a pattern has been matched, an X10 signal is received, etc. The Trigger can contain an action to execute, or it can execute an Action Group. Thus, in your model, several Triggers might exist each looking for specific conditions to take place (RS232 message, Light switch dimmed, room occupied, etc.) but, regardless of the event that set the Trigger, the same set of actions would be executed.

Posted on
Sun Jun 22, 2014 5:29 pm
mark_anderson_us offline
Posts: 65
Joined: Jun 05, 2014

Re: Receive message over RS232 and IP. trigger and action

berkinet wrote:
For a quick prototype setup I'd suggest...

ser2sock Very easy to setup, though you will need to compile it - simple one line compile. I can provide you with a binary if you need it.


Hi Berkinet

Could I take you up on the offer of a binary. i don;t have compiler setup on my Mac

Thanks

Mark

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 2 guests