Help

Forum: System Design Forum ListTopic List
01. Aug 2008, 19:32 CET | Link

Someone sent me an email earlier

Hi, I saw this nice project, OpenRemote. Do you know CRESTRON ? I am working at the Université Laval in Québec City, Canada, and we are using CRESTRON automation devices (Processors, Touchpanels, etc..) Do you know if somebody plans to incorporate the Crestron Protocol (wich is proprietary..) to OpenRemote ? If not, I think i’ll give it a shot. I am currently working on a web remote control system that does not use the Crestron Protocol SDK (e-control), because we don’t want to pay for this SDK, we prefer in-house developpement. How can I get startet with this ? Thank you.

In house developers are the best :) Ok yes this is clearly something we would be interested in supporting as a module. Give us some time to get our docs in order, what does it mean from a code standpoint to write a module for OR and having CRESTRON support would definitely be a big plus for OR.

23 Replies:
01. Aug 2008, 19:45 CET | Link

As an A+ Partner, I contacted the Crestron True Blue Support team to know about the crestron they are using for processor-to-device communication. The protocol is called Crestron-CIP, and operate on port 41794 TCP and UDP.

The Crestron guy told me he would check that for me. When I asked, he said this funny thing:

Can you please tell me exactly what you are trying to eventually accomplish here?

So, I'm hoping to get some information soon, but if they cannot give me some information about the protocol, we have some alternatives to enable communication between OpenRemote and Crestron Processors. Here are two:

1. Reverse engineer the protocol (wich look pretty simple looking at it with WireShark) 2. Write some kind of middleware-module between a Crestron Processor symbol and a touchpanel symbol (I am currently writing one that will report Crestron modules events, and permits to send commands to the Processor)

I'll get back on this.

02. Aug 2008, 21:00 CET | Link

I definitely can help with this given an achievable scope. But to send commands to a Crestron processor, you really need to know the code inside it, not just send packets based on some sort of protocol interpreter. This could crash their box or produce undesirable and unpredictable events triggering elsewhere in the code. These boxes are at heart a state driven machine.

Their CIP is just a way to map ID's associated with certain signal types within the code to provide an interface(generic for the most part). So by creating a ethernet symbol in their code that can listen for CIP commands, you can make it do what you need to in the code and not by triggering a state of a signal that could be dependent on many other factors. Being associated with their ethernet symbol, you drastically reduce complications to being predictable, therefore controllable.

Crestron just released a SDK kit for adobe flash action script. Many guy are doing iPhone interfaces by using this means of Crestron ethernet CIP connections. I have seen ajax used several times. It really isn't a big deal. Crestron processor can just about adapt to any interface, not just the ones they sell. You just got to get someone to build the code on their box first.

cheers

03. Aug 2008, 04:33 CET | Link

Action Script SDK ? Where you see this ? I am interested!

03. Aug 2008, 10:12 CET | Link

I've created a project page for you at Crestron Integration Project.

03. Aug 2008, 13:55 CET | Link

Clearly a worthwhile integration. Crestron is used in high-end residential as well as industrial and commercial. The ethernet symbols that Tres talks about is what we want to understand for mapping. We would expect a clean API from the server, not meddling with its process or internal state machine. Yes the ORC would support state, persistence of state, state replication, messaging, eventing, scheduling, state machines and workflow languages. HA programming is no mean feat but could ultimately be a visual driven one. Maybe consider integration to Sketchup?

In any case, Crestron support is something we want to have. Everyone does it and as was pointed out the panel is the king. A flash-driven panel is a great idea and where the iPhone may go critically wrong with their stubborn lack of support for the ever growingly popular flash format on their latest hardware. Have you ever looked at cocoa? buark!

It seems everyone is focusing on this CIP API which is a good thing it may mean it is stable. People are doing that with iPhone and Ajax and it isn't a big deal. It is a big deal. Good to hear about the excitement around the flash format. Have you seen flash-games lately? Some of them are excellent.

Good to have this on-board, JL or CB, I still can't find that magic toggle switch thingy that makes the thread sticky.

03. Aug 2008, 17:47 CET | Link

And how do you see, technically, the connection between OpenRemote and a Crestron processor ? I have many ideas, but I don't want to go a way others would find it wrong.

03. Aug 2008, 18:44 CET | Link

If you have many ideas, get it started.

04. Sep 2008, 00:11 CET | Link

One way would be to use a Crestron module that exposes TCP server on a given port. This module would have signal inputs and outputs. You could either drive an output signal high/low via an input message or get feedback via an output message from an input signal that is changing. I suppose that UDP could be an option as well.

22. Sep 2008, 12:12 CET | Link

Use ActiveCnx from crestron. http://www.crestron.com/downloads/pdf/productmisc/activecnx.pdf

06. Oct 2008, 01:59 CET | Link

Just joined this group. I have been giving this concept some thought for a while (several years) and am glad to have found OR - should have known others were already out there doing something similar.

Anyhow, having been a Crestron Dealer/Integrator/Designer/Programmer my thoughts are as follows:

- Best integration option IMO, would be to create a shim module that effectively duplicates functionality of Crestron's Test Manager application. This presumably speaks the CIP (Cresnet over IP) protocol but has the advantage of being able to access every signal within a crestron SimplWindows/SimplPlus program. It exposes read/write access to these signals and when tied together with a native program file (can display appropriate names/device IDs).

- The eControl family of applications/modules also already implements IP-enabled passing of signals bi-directionally, however the exposure of the API is not low level enough to get raw access to the individual programming signals and also assumes the use of their ActiveX or (older) Java UI controls to simulate touchpanel-like inputs/displays. The eControl Gateway does provide the functionality you'd be looking for, but it is not documented from the perspective of someone trying to create these lower-level native interfaces. Queries to Crestron as recently as a few months ago effectively went nowhere. I think Crestron is leery of exposing this degree of access into their protocols, etc - as they are used to providing a controlled/closed ecosystem from a programming perspective.

- I would bet that you're going to have to end up sniffing the CIP protocol. Good way to do so would be to sniff a session between Test Manager and a running system. I suspect that there is a fairly lightweight packet format for every event/signal which would contain a Device ID, Signal ID, Signal Type, and Value (possibly other things). I have thought about Wireshark-ing this session, but haven't done so yet...

A couple of other issues (misc) to keep in mind on the Crestron front:

- Need to anticipate the existence of a Crestron controller on a Crestron system. I don't see it as realistic to think that an OR-based application would replace that. Too many CresNet-only devices and hardware plant in a typical Crestron system to do without a Crestron controller entirely. - Need to create a stub host application that identifies all Crestron devices in the main controller, provides appropriate signals/names as hooks to OR, and provides certain types of autonomic logic functions so that keypads and other critical devices can function natively. - Move much other event logic into the OR-based server/applications so that complex events, sequences, and higher-level UI interfaces (IP-based devices, rich GUI's, etc) can be done outside of the Crestron domain... - From what I've been told native Cresnet protocol is effectively a serial, token-ring, network. So the processor is expecting to be polling devices and processing signals as they change.

I'd be interested in contributing to this sub-project further, and I think this specific area is one that provides one of those commercialization paths for the OR project. If you can create an environment that provides a smaller, lightweight, installer-configurable program stub in the main Crestron controller, and then allow for more logic to be done in a more macro style than what current Crestron programming paradigm provides, that would be worth a LOT of money in the HA marketplace... I too have a bunch of ideas about this domain, but am not a hard-core Java programmer. So perhaps I can contribute design and architectural ideas, specific knowledge of the Crestron programming and system engineering space, etc and those more Java-savvy can do the implementation.

06. Oct 2008, 18:02 CET | Link

Ted,

A lot of (interesting) information there. I've no expertise in Crestron at all, however some of the things you say do make sense.

The Crestron integration ball is very much in the air so if you're willing then go ahead, grab and run with it. I think the first step there is figuring out the CIP protocol part, as you say if it needs to be sniffed then that's a hacking project for someone, no Java skills needed.

The next logical step would be to get that information into our knowledge base, if we can get something akin to what we have for INSTEON wrt message structure we can at least mock some Crestron stuff and move from there towards real integration. And also, don't worry about your Java -- at this point just getting the protocol down would be helpful, as long as we can understand what happens on the wire we can get all the rest of it integrated -- fugly or not, as long as it works. I don't care if you just print stuff on the standard output as long as I can see what the protocol looks like.

WRT how we should integrate with Crestron controller what you describe is my current thinking as well, OR controller would pretend to be an application in a Crestron network, listen in on the network on events and try to build macro, scene management and UI tools on top of that and provide the option to integrate with other control networks and/or hardware as necessary.

09. Oct 2008, 01:37 CET | Link

OK, so I've made minor progress on the protocol front. I've dug out some information from a previously overlooked Appendix that eludes more specifically to protocol (UDP) and packet count/sizes used for CIP for various signal types - In Crestron-land there are 3 basic signals (Digital, Analog, and Serial) - each containing different data types.

That gives me a little more to go on. I'll be getting my hands on (either physially or virtually) a Crestron controller again to do the sniff in coming days I think - perhaps this weekend. Should be able to have some better details to go on then.

09. Oct 2008, 08:47 CET | Link

Cool, keep us posted! :-)

09. Oct 2008, 18:17 CET | Link

If I wanted to post/share some diagrams or other information/files with you guys, how should I do so. I haven't found a facility for either embedding images in a post or uploading/posting a file beyond a hyperlink to another site where I could host it.

Thoughts?

10. Oct 2008, 00:20 CET | Link

There's a way to upload images to the website but I don't really remember all the steps -- maybe we need to set you up with access rights.

I'll try to look into that tomorrow and let you know.

10. Oct 2008, 01:19 CET | Link

Happy to collaborate offline too so that we can post more fully developed documentation. I've got a thread going with Marc, but I don't have an email address for you. Skpye, Email, ichat or any other model would work. I want to contribute some possible architectural thoughts in diagrammatic form - I'm a picture person. Some of these discussions wold be more productive offline if you're agreeable...

10. Nov 2008, 07:42 CET | Link
Been distracted by my day job for a couple of weeks, but this post excerpted from some experimentation done this weekend - finally! Thanks to Jerrod who supplied remote access for me to a controller I could experiment with remotely.

Should post a formatted version in Knowledgebase at some point, but there is no CRESTRON category there yet...
---snip---

I have confirmed part of my theory about a potential way to interact with the system, but also found a behavior that may make it the less than ideal approach.

My thought was to bypass the use of Intersystem Communication, XPanels, eControl and various other methods and essentially attempt to do what the old Test Manager (now SimplWindows Debugger in Toolbox) does. Since it can effectively "sniff" any signals within a running program as well as set values of any digital/analog joins, I thought that that might be a shortcut.

That does indeed work using a very simplistic protocol and set of undocumented controller commands.

You can essentially just establish a basic telnet connection to the CIP port and issue commands to it. That part was already a known fact (although I suppose not everyone would have tried this). But there are a couple of commands that the debugger issues that are of interest:



"- DBGSIGNAL ALL ON - puts the controller in a mode where any signal state changes are echoed on the CIP port in readable form, in the form of Signal = Value. Signal is an 8 digital zero padded decimal value and Value is the signal's current value. Digital joins are a 0 or 1, analogs are the integer value (didn't check the full range to see about signed/unsigned and 0-32K or 64K - I recall reading that analog's are -32K to +32K; Strings(serials) are interesting in that they are returned as a series of [xx] ASCII values for the characters. Therefore Value is variable length and needs to be parsed and translated into a literal string.
When DBGSIGNAL ALL ON is set, all values that change as a result of any SETSIGNAL command, or as they change state in the program are echo'd to the session, effectively creating a trace of events occuring in the running program
"



"- DBSIGNAL ALL SYNC - fetches and displays all signal values. It is what debug does when it asks if you want to "sync" with the current program at startup.
"


"- SETSIGNAL <sig#> <value> - sets a signal. <sig#> is a decimal value of the signal number (see signal names/numbers below). <value> is a decimal value. 0 or 1 for a digital join, integer for analog. Not sure if you can set serials, not tested."


   That's the good part: it would be easy to create a program that establishes a TCP (telnet-style) session to the CIP port, and can issue simple SETSIGNAL commands to perform any action "trigger" button presses, set analog values, etc.

Now for the downside. It appears that while multiple connections can be made simultaneously to the CIP port (i.e. telnet session in parallel with Debugger), only one can have the DBGSIGNAL ALL ON mode set at a time. If you do it from the telnet session, then Debugger seems to stop displaying signal changes and vice versa - if you have it set in the telnet session, and then start the debugger, the telnet session stops displaying state changes (you can still seem to use the SETSIGNAL command though).

So this kind of puts a damper on this approach, since you could have an external program merrily setting and fetching signals, but then if someone started up a debugger session, your program could get cut off at the knees in terms of signal feedback. Kind of a bummer. Don't know if there's a way around this as this starts to get into the internals in a way that in my experience Crestron doesn't tend to talk about with their integrators/dealers... I suspect even a CAIP might not be able to get this deep with them, but I know some I could try.

So, next plan of attack is to go where you appear to have started: try to simulate an existing PC-based client agent or intersystem channel that they have provided. The obvious choices are:

Pretend to be an Ethernet Intersystem Communication on the other end of the connection. My suspicion is that the ISC controller-to-controller is just what I've described above. But given that each system has an explicit IP address and more importantly IP ID (in Crestron speak), that that might establish a "multi-channel" path into the controller that is allowed to maintain a DBGSIGNAL ALL ON mode in parallel with others so it can continue to send/receive all the join state changes that it wants.

Duplicate the code functionality that the ActiveCNX agent represents. They've effectively exposed this protocol through both the e-control ActiveCNX (and Java classes), as well as the newer eControl Flash SDK. The problem is that they don't expose the code of the basic interface - they just give you a jar file (not sure what in the Flash case) that exposes some documented API's in those specific languages. Now the Flash module is more up-to-date and you can create event handlers that wait for specific join changes as well as change join values explicitly. But what we're all looking for is what their SDK represents - the engine that knows natively how to talk to the controller and set values and get feedback on any join changes so that the "brain" of the eControl SDK's can be reimplemented in other environments than ActiveX and Flash.

Any chance you have Flash coding experience, because if you do, and can create a basic Flash UI against a couple of basic joins of the 3 signal types, we could sniff against that interaction and probably crack this.

Third appoach is what you've tried - simulating an Xpanel. I think the other 2 approaches above might be a bit more robust overall, but this approach could get the job done. Effectively the Xpanel (whether .exe or Web version) is doing the above - just using a different client agent that's a little older. Since the API route is intended to be leveraged via custom code, I think that's a somewhat better route to take.

Anyway, that's what I've learned today, and can collaborate with you some more as time permits.

Oh, one more thing. I also teased out how to map the signal names to the ID numbers. You might already know this, but when you complile a Simpl program, you're left with the source code and 3 files that represent the compiled program. One of these is the .sig (signal table) file that contains a list of all the signal names and numbers. The signal names are inspectable in a list in SimplWindows and the Debugger, but the signal numbers are never referenced in those environments. They are highly dynamic in nature (i.e. when you are creating a program everytime you create a new signal name you use a number. As you've probably experienced any program of any size has lots of signals that either don't get used or you sometimes create signals and then change their names, etc. The point is that signal numbers are non-sequential and you aren't guaranteed that every number is actually even represented in the table. But in effect every signal name and ID is in this file. My belief is that along with some other header info and some meta-data about each signal, that the file contains a big table wherein you can see the literal signal name in ASCII text, followed immediately by it's ASCII encoded signal ID. the hex/decimal value of this ASCII character is it's signal number. For my test it was always in the first byte after the name, but I think that 4 bytes are reserved for the ID, but I didn't create enough to test that theory. Could be better tested against some of Crestron's demo programs/modules that have a lot more signals in them.

10. Nov 2008, 14:18 CET | Link

Thanks for reporting what you have found out, Ted,

If you need Flash UI dev, I am sure we can find someone.

10. Nov 2008, 19:03 CET | Link

Hello Ted,

Thanks for the progress update.

I've created a Crestron page in the knowledge page. You can use it as you see fit.

14. Nov 2008, 18:17 CET | Link

Hi guys, just joined..

So I posted in the KB what some of you may or may not know.

There console commands that aren't publicly documented. If you type HIDHELP ALL on the console of a Crestron Processor you will see publicly known ones and some that are not.

One of the hidden commands is SENDCNETPKT this is useful for communicating on Cresnet.

Hope it is useful in figuring out both CIP (cresnet over ip protocol) and Cresnet Protocol.

14. Nov 2008, 18:40 CET | Link

Hello Daniel,

Thanks a lot. At this point any and all Crestron information into the knowledgebase will be useful. Feel free to add more if something comes up.

-- Juha

20. Nov 2008, 03:25 CET | Link
Hey all, found this site searching for Crestron protocol info, and found a link at AVS about the same topic:

http://www.avsforum.com/avs-vb/showthread.php?p=12457029

No real answers, but some ideas on direction.

I used to be in the CE industry, and put together my own Crestron system from eBay. I have an Ethernet module for my controller, and would love to be able to control it via other interfaces.

Oh, and for the two of you who don't already know, here's the Yahoo Crestron group:

http://tech.groups.yahoo.com/group/Crestron/

Look forward to what OpenRemote will bring!

~Mark

30. Nov 2008, 05:19 CET | Link

I've been doing Crestron and AMX work for quite a few years now and I must admit I am confused by exactly what your trying to accomplish by emulating the debugger.

The real issue to me is what you are your aims for integration. Maybe emulating the debugger would allow you to see every internal signal, but you would have to load the .SIG file to keep the signal index in order, and why you would want to see ALL the signals anyway is beyond me.

For interfacing with an existing Crestron box, a far easier approach is to use a Intersystem Communication symbol, and run the RX$/TX$ to a TCP/IP port. The protocol is defined in the help file for the block, and you can simply export/import the signals you are interested in. This way the Crestron program can change without you having to adjust your program.

The only three scenarios I can imagine in which digging deeper into the low level protocols is necessary is if:

A) You want to talk to a Crestron Cresnet device natively, though you would have to sniff the 485 lines directly

B) You want to add your own - non-crestron device to Cresnet - cool idea, and I could even imagine a market for a small interface card which does just this, but just what this would look like in Crestron software, I have no clue (maybe you could make it look like a Touchpanel, which would have generic Joins).

C) You want to connect to the few Crestron boxes which use CIP without a controller involved. I went down this path a bit, as it would be nice to control an CEN-IDOC, but in the end, decided on throwing a small Crestron controller into the mix and talking to in instead.

Just my 2 cents.

Creative Commons License Content on this website is licensed under Creative Commons BY-NC-SA 3.0.