Quantcast
Viewing latest article 25
Browse Latest Browse All 42

Crestron - custom component to integrate a Crestron control system via XSIG

I’m also using this repository of @georgesak and I’ve also encountered some problems.
I’ll start by saying that I’m not a python programmer, but Crestron, but I managed to somehow make it work.
I changed the def async_setup in init with this:

    """Set up a the crestron component."""
    _LOGGER.debug("Crestron: Starting async_setup")
    try:
        if config.get(DOMAIN) is not None:
            _LOGGER.debug("Crestron: Configuration found")
            hass.data[DOMAIN] = {}
            hub = CrestronHub(hass, config[DOMAIN])
            _LOGGER.debug("Crestron: CrestronHub instance created")
            await hub.start()
            _LOGGER.debug("Crestron: hub.start() completed")
            hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, hub.stop)
            tasks = [async_load_platform(hass, platform, DOMAIN, {}, config) for platform in PLATFORMS]
            await asyncio.gather(*tasks)
            _LOGGER.debug("Crestron: Platforms loaded")
        else:
            _LOGGER.warning("Crestron: Configuration not found")
    except Exception as e:
        _LOGGER.error(f"Crestron: Error during async_setup: {e}")
    finally:
        _LOGGER.debug("Crestron: async_setup completed")

    return True

and then in the crestron.py file I commented out these two lines:

server.serve_forever()
await server.start()

and added this:
await server.serve_forever()
it’s currently working, although with some warnings (which I’m working on)

Read full topic


Viewing latest article 25
Browse Latest Browse All 42

Trending Articles