Hack a Crestron system?

Looking at moving into a place with about a 5-yr-old Crestron system… does anyone know if it’s possible to bring it into our universe?

1 Like

Apparently Crestron has a REST API so that may be one avenue to integrating it with Home Assistant:

https://www.crestron.com/getmedia/29921c49-86df-488c-a63b-ab88620d7175/mg_pg_crestron_virtual_control_rest_api

1 Like

So I went digging on Github and found several integrations that folks wrote for SmartThings and one for Homebridge, so apparently it can be done. Sadly I don’t have the expertise required to write an integration for HA, but- as I discovered and posted elsewhere- a SmartThings hub is not required to add devices to SmartThings and have them show up in HA. Thus, maybe we could go
Crestron -> SmartThings -> HA

I’ll post back if I get it to work.

You may be able to get a few done using Home Assistant’s existing RESTful Command integration.

There’s also a RESTful binary_sensor , sensor, and switch.

1 Like

I’ve integrated an 8x8 switcher and associated dm endpoints using basic telnet to the switcher to switch in to out, just use the telnet switch option in HA and use the setroute command to send the vision etc where you want it, I am also controlling an Apple TV using hdmi cec commands and controlling tv’s the same way. I have a series 2 processor (qm-rmc) just to be a translator between the text string I’m sending from HA and triggering the digital signal in the crestron program and forwarding that to the correct module in the program.

It’s been pretty solid so far, I’m going to smarten up the power supply to the main stuff so it’ll power down at night and be part of a goodnight/good morning scene as it runs at 100-120w

- platform: telnet
  switches:
     avloungeapple:
      name: "Lounge AppleTV"
      resource: "IP_OF_DM_SWITCHER"
      port: 41795
      command_on: "setavroute 2 18"
      command_off: "setavroute 2 18"

command syntax is “setavroute INPUT OUTPUT” where in my case as i have an 8x8 INPUT will be from 1-8 and OUTPUT is 17-32, this is because the commad set is the same for the 16x16 switcher and so in the 8x8 configuration 17=output 1, 18=output 2 etc…

once you have all your switches configured you can create your input selects and automation rules

input_select:
  lounge:
    name: Lounge
    options:
      - "None"
      - "DVR"
      - "Apple TV"
      - "Fetch"
      - "Blu-Ray"
      - "CCTV"
      - "HAss"
      - "7"
      - "8"

and

- id: loungeavselect
  alias: Lounge AV source select
  trigger:
  - platform: state
    entity_id: input_select.lounge
  action:
    service: switch.turn_on
    data_template:
      entity_id: "{% if is_state(\"input_select.lounge\", \"DVR\") %}\n  switch.avloungedvr\n\
        {%-elif is_state(\"input_select.lounge\", \"Apple TV\") %}\n  switch.avloungeapple\n\
        {%-elif is_state(\"input_select.lounge\", \"Fetch\") %}\n  switch.avloungefetch\n\
        {%-elif is_state(\"input_select.lounge\", \"Blu-Ray\") %}\n  switch.avloungebluray\n\
        {%-elif is_state(\"input_select.lounge\", \"CCTV\") %}\n  switch.avloungecctv\n\
        {%-elif is_state(\"input_select.lounge\", \"HAss\") %}\n  switch.avloungehass\n\
        {%-elif is_state(\"input_select.lounge\", \"7\") %}\n  switch.avlounge7\n\
        {%-elif is_state(\"input_select.lounge\", \"8\") %}\n  switch.avlounge8\n\
        {%-elif is_state(\"input_select.lounge\", \"None\") %}\n  switch.avloungenone\n\
        {% else %}\n  none\n{% endif %}\n"

Using this code you do not need a processor to run anything which is handy, but anything more than that such as CEC will need some sort or programming and signal routing, i use an old seried 2 QM-RMC for this and it works fine

The only drawback i can see at the moment is that i can’t get amy feedback from crestron to hass as to it’s current status, especially if i am switching the unit off overnight the mappings form input to output are all reset inthe switcher but remain on HAss so you have to select a different input and then back to what you want for it to fire the rule.

1 Like

FWIW, you can streamline the template to this:

- id: loungeavselect
  alias: Lounge AV source select
  trigger:
  - platform: state
    entity_id: input_select.lounge
  action:
    service: switch.turn_on
    data_template:
      entity_id: >
        {% set switches = {'DVR':'dvr', 'Apple TV':'apple', 'Fetch':'fetch', 'Blu-Ray':'bluray',
                           'CCTV':'cctv', 'HAss':'hass', '7':'7', '8':'8', 'None':'none'} %}
        switch.avlounge{{ switches[trigger.to_state.state] if trigger.to_state.state in switches.keys() else 'none' }}

In addition, if you were to rename this switch:

switch.avloungeapple

to this:

switch.avloungeappletv

then the template can be reduced to this:

- id: loungeavselect
  alias: Lounge AV source select
  trigger:
  - platform: state
    entity_id: input_select.lounge
  action:
    service: switch.turn_on
    data_template:
      entity_id: >
        switch.avlounge{{ trigger.to_state.state | lower | replace(' ', '') | replace('-', '') }}
1 Like

Wow… thanks folks. That’s all a bit beyond my skills at the moment but I’m glad it’s here for reference!

Me likey, i’ll impliment this in the near future, some of the files are getting a little substantial these days

FYI, I’ve got a mostly-working integration for Crestron via an XSIG symbol. I posted about it here.

Just got this working, loaded the new version added code and got values coming through first go!

but…

My switch process for turning on a TV is this:

Telnet switch issues a text command “LoungeTV On” to the Crestron processor
This is put through a serial buffer in the SIMPL program than then triggers the CEC control tp power the tv on
The CEC control then signals that the tv is on
This is put through to a toggle control along with the off signal that then outputs a stable binary on or off state
This toggle output is connected to the XSIG control, through the serial client to HA and arrives as a binary sensor which is successfully updated.

So…

What I can’t figure out is how to include this sensor value as the switch state on the interface. i am getting a true\false state from the value template

    loungetv_power:
      name: "Lounge TV Power"
      resource: "A.B.C.D"
      port: EFGH
      command_on: "LoungeTV On"
      command_off: "LoungeTV Off"
      command_state: ""
      value_template: "{{is_state('binary_sensor.lounge_tv_status', 'on')}}"

If I keep the command_state: “” item in as above then I don’t have to use the assumed_state: false customisation but regardless whether I have one or the other the status doesn’t update. Really teh assumed state is just an aesthetic having a slide switch like everything else instead of 2 discreet on\off buttons

The one thing I really like is that even if you use the IR remote the status gets updates so everything stays in sync, and as the Crestron is polling each device the status is always udated too