Inspired by yesterday, I also made a Crestron PoC tonight. So far, the code creates a Crestron object that can:
*) Be configured with:
var $server;
var $ip;
var $port;
var $terminator;
var $password;
var $socket = NULL;
var $showErrors = false;
var $debug = false;
*) Resolve server names to IP addresses.
*) Connect to the Crestron CPU over TCP.
*) Retrieve all dimmer/relay/scenario settings as an array of key/value pairs (and the key codes are unique for each setup, so some kind of local translation table is needed for each installation, but you already do the same thing with the Tellstick numerical codes).
*) Send a command.
*) Retrieve the output of the command (in the same key/value pairs format).
The terminator is the hexadecimal value that terminates commands sent, and each key/value pair received. In my setup it is 0x03 and I think it's the default. There are no newlines ever sent or received. There's no user login, just a password. The i=1 output only shows key with values other than 0 (so it won't list any lights turned off or dimmers at minimum). There's a keep alive command (h=0h) but a better solution is to use periodical "i=1" (to keep track of on/off, dimmer levels and active scenarios). There's no need for any sleeps to wait for stuff (at least not in my setup over 1 Gbit/s LAN), but I don't know if it is buffering or just fast.
I've so far succeeded in getting the current status (i=1), setting the dimmer level (0-65535) for a dimmer of my choice, turning on/off a relay of my choice and choosing a scenario of my choice.
Left to do:
Save scenarios. The TCP interface mimics the wall buttons (and the XPanel interface), which means that you save stuff by keeping buttons pressed for a few seconds. You do that the TCP way by sending a "button down" command, followed by a "button up" command after the specified amount of time. As long as no network connection fuss or similar is in the way, it should be easy enough to do with a simple timer.
Integrate Crestron scenarios into Home Automation scenarios. I haven't tried Home Automation scenarios yet, so I have no ideas on how to make it nice.
General integration into Home Automation. So far, this is standalone code. The object is there, but there's no integration with any of your code. I choose device and what to do by simply assigning variables directly in the code. The Crestron relays/dimmers should exist as devices in the database, as any other device.
User interface. This is what I've got so far:
https://auto.home.pal.pp.se/auto/pal.crestrontest.php (output from i=1 at the moment) which is... less than useful without access to the code, and not much even with access.

I guess much can be recycled from existing Home Automation code.
Initiation process. Since it won't list keys with 0 value, we need to find a way to make it do so, or ask the user to turn everything on and then click the query button to read and store all the channels.
Settings stuff in database and on settings page (which, when put in the database, is automatic)
/P
Edit: I unintentionally made it somewhat stateful. Since I don't unset the array variable keeping the output, and I use the key/value pairs as keys/values in the array, it keeps the last known state of all equipment for as long as the object exists (which is the same as the session lifetime I guess). And if anything starting at 0 (and thus unknown) is turned on, it will be added to the array at the next i=1. If the PHP object is used to turn it on, it is added instantly.