1 """Support for controlling Global Cache gc100."""
4 import voluptuous
as vol
18 CONFIG_SCHEMA = vol.Schema(
22 vol.Required(CONF_HOST): cv.string,
23 vol.Optional(CONF_PORT, default=DEFAULT_PORT): cv.port,
27 extra=vol.ALLOW_EXTRA,
31 def setup(hass: HomeAssistant, base_config: ConfigType) -> bool:
32 """Set up the gc100 component."""
33 config = base_config[DOMAIN]
34 host = config[CONF_HOST]
35 port = config[CONF_PORT]
37 gc_device = gc100.GC100SocketClient(host, port)
39 def cleanup_gc100(event):
40 """Stuff to do before stopping."""
43 hass.bus.listen_once(EVENT_HOMEASSISTANT_STOP, cleanup_gc100)
45 hass.data[DATA_GC100] =
GC100Device(hass, gc_device)
51 """The GC100 component."""
54 """Init a gc100 device."""
59 """Read a value from a digital input."""
63 """Write a value to a relay."""
67 """Add detection for RISING and FALLING events."""
68 self.
gc_devicegc_device.subscribe_notify(port_addr, callback)
def __init__(self, hass, gc_device)
def write_switch(self, port_addr, state, callback)
def read_sensor(self, port_addr, callback)
def subscribe(self, port_addr, callback)
bool setup(HomeAssistant hass, ConfigType base_config)