Ejemplo n.º 1
0
    def __init__(self, hass, ctrl, dev):
        """Initialize a Mochad Light Device."""

        self._controller = ctrl
        self._address = dev[CONF_ADDRESS]
        self._name = dev.get(CONF_NAME, f"x10_light_dev_{self._address}")
        self._comm_type = dev.get(CONF_COMM_TYPE, "pl")
        self.light = device.Device(ctrl, self._address, comm_type=self._comm_type)
        self._brightness = 0
        self._state = self._get_device_status()
        self._brightness_levels = dev.get(CONF_BRIGHTNESS_LEVELS) - 1
Ejemplo n.º 2
0
    def __init__(self, hass, ctrl, dev):
        """Initialize a Mochad Switch Device."""
        from pymochad import device

        self._controller = ctrl
        self._address = dev[CONF_ADDRESS]
        self._name = dev.get(CONF_NAME, 'x10_switch_dev_%s' % self._address)
        self._comm_type = dev.get('comm_type', 'pl')
        self.device = device.Device(ctrl,
                                    self._address,
                                    comm_type=self._comm_type)
        self._state = self._get_device_status()
Ejemplo n.º 3
0
    def __init__(self, hass, ctrl, dev):
        """Initialize a Mochad Light Device."""
        from pymochad import device

        self._controller = ctrl
        self._address = dev[CONF_ADDRESS]
        self._name = dev.get(CONF_NAME,
                             'x10_light_dev_{}'.format(self._address))
        self._comm_type = dev.get(mochad.CONF_COMM_TYPE, 'pl')
        self.device = device.Device(ctrl,
                                    self._address,
                                    comm_type=self._comm_type)
        self._brightness = 0
        self._state = self._get_device_status()
Ejemplo n.º 4
0
    def __init__(self, opp, ctrl, dev):
        """Initialize a Mochad Switch Device."""

        self._controller = ctrl
        self._address = dev[CONF_ADDRESS]
        self._name = dev.get(CONF_NAME, "x10_switch_dev_%s" % self._address)
        self._comm_type = dev.get(CONF_COMM_TYPE, "pl")
        self.switch = device.Device(ctrl, self._address, comm_type=self._comm_type)
        # Init with false to avoid locking OPP for long on CM19A (goes from rf
        # to pl via TM751, but not other way around)
        if self._comm_type == "pl":
            self._state = self._get_device_status()
        else:
            self._state = False
Ejemplo n.º 5
0
    def __init__(self, hass: HomeAssistant, ctrl: controller.PyMochad,
                 dev: dict[str, Any]) -> None:
        """Initialize a Mochad Light Device."""

        self._controller = ctrl
        self._address: str = dev[CONF_ADDRESS]
        self._attr_name: str = dev.get(CONF_NAME,
                                       f"x10_light_dev_{self._address}")
        self._comm_type: str = dev.get(CONF_COMM_TYPE, "pl")
        self.light = device.Device(ctrl,
                                   self._address,
                                   comm_type=self._comm_type)
        self._attr_brightness = 0
        self._attr_is_on = self._get_device_status()
        self._brightness_levels: int = dev[CONF_BRIGHTNESS_LEVELS] - 1
Ejemplo n.º 6
0
    def __init__(self, hass, ctrl, dev):
        """Initialize a Mochad Switch Device."""
        from pymochad import device

        self._controller = ctrl
        self._address = dev[CONF_ADDRESS]
        self._name = dev.get(CONF_NAME, 'x10_switch_dev_%s' % self._address)
        self._comm_type = dev.get(mochad.CONF_COMM_TYPE, 'pl')
        self.switch = device.Device(
            ctrl, self._address, comm_type=self._comm_type)
        # Init with false to avoid locking HA for long on CM19A (goes from rf
        # to pl via TM751, but not other way around)
        if self._comm_type == 'pl':
            self._state = self._get_device_status()
        else:
            self._state = False
Ejemplo n.º 7
0
    def __init__(self, hass: HomeAssistant, ctrl: controller.PyMochad,
                 dev: dict[str, str]) -> None:
        """Initialize a Mochad Switch Device."""

        self._controller = ctrl
        self._address: str = dev[CONF_ADDRESS]
        self._attr_name: str = dev.get(CONF_NAME,
                                       f"x10_switch_dev_{self._address}")
        self._comm_type: str = dev.get(CONF_COMM_TYPE, "pl")
        self.switch = device.Device(ctrl,
                                    self._address,
                                    comm_type=self._comm_type)
        # Init with false to avoid locking HA for long on CM19A (goes from rf
        # to pl via TM751, but not other way around)
        if self._comm_type == "pl":
            self._attr_is_on = self._get_device_status()
        else:
            self._attr_is_on = False