Example #1
0
    def __init__(self, homecontrol: HomeControl, device_instance: Zwave,
                 element_uid: str) -> None:
        """Initialize a devolo device entity."""
        self._device_instance = device_instance
        self._homecontrol = homecontrol

        self._attr_available = (
            device_instance.is_online()
        )  # This is not doing I/O. It fetches an internal state of the API
        self._attr_name: str = device_instance.settings_property[
            "general_device_settings"].name
        self._attr_should_poll = False
        self._attr_unique_id = element_uid
        self._attr_device_info = DeviceInfo(
            configuration_url=
            f"https://{urlparse(device_instance.href).netloc}",
            identifiers={(DOMAIN, self._device_instance.uid)},
            manufacturer=device_instance.brand,
            model=device_instance.name,
            name=self._attr_name,
            suggested_area=device_instance.
            settings_property["general_device_settings"].zone,
        )

        self.subscriber: Subscriber | None = None
        self.sync_callback = self._sync
        self._value: float
Example #2
0
    def __init__(self, homecontrol: HomeControl, device_instance: Zwave,
                 element_uid: str) -> None:
        """Initialize a devolo device entity."""
        self._device_instance = device_instance
        self._homecontrol = homecontrol

        self._attr_available = (
            device_instance.is_online()
        )  # This is not doing I/O. It fetches an internal state of the API
        self._attr_name: str = device_instance.settings_property[
            "general_device_settings"].name
        self._attr_should_poll = False
        self._attr_unique_id = element_uid
        self._attr_device_info = {
            "identifiers": {(DOMAIN, self._device_instance.uid)},
            "name":
            self._attr_name,
            "manufacturer":
            device_instance.brand,
            "model":
            device_instance.name,
            "suggested_area":
            device_instance.settings_property["general_device_settings"].zone,
        }

        self.subscriber: Subscriber | None = None
        self.sync_callback = self._sync
        self._value: int
 def test_in_online_offline(self, mydevolo):
     device = Zwave(mydevolo_instance=mydevolo, **self.devices['offline'])
     assert not device.is_online()
 def test_in_online_online(self, mydevolo):
     device = Zwave(mydevolo_instance=mydevolo,
                    **self.devices['mains']['properties'])
     assert device.is_online()