How to use the aioswitcher.api.SwitcherV2Api function in aioswitcher

To help you get started, we’ve selected a few aioswitcher examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github home-assistant / home-assistant / homeassistant / components / switcher_kis / __init__.py View on Github external
async def async_set_auto_off_service(service: ServiceCallType) -> None:
            """Use for handling setting device auto-off service calls."""

            await _validate_edit_permission(
                hass, service.context, service.data[CONF_ENTITY_ID]
            )

            async with SwitcherV2Api(
                hass.loop, device_data.ip_addr, phone_id, device_id, device_password
            ) as swapi:
                await swapi.set_auto_shutdown(service.data[CONF_AUTO_OFF])
github home-assistant / home-assistant / homeassistant / components / switcher_kis / switch.py View on Github external
async def _control_device(self, send_on: bool) -> None:
        """Turn the entity on or off."""

        response: "SwitcherV2ControlResponseMSG" = None
        async with SwitcherV2Api(
            self.hass.loop,
            self._device_data.ip_addr,
            self._device_data.phone_id,
            self._device_data.device_id,
            self._device_data.device_password,
        ) as swapi:
            response = await swapi.control_device(
                COMMAND_ON if send_on else COMMAND_OFF
            )

        if response and response.successful:
            self._self_initiated = True
            self._state = SWITCHER_STATE_ON if send_on else SWITCHER_STATE_OFF
            self.async_schedule_update_ha_state()

aioswitcher

Switcher Python Integration.

Apache-2.0
Latest version published 4 months ago

Package Health Score

75 / 100
Full package analysis

Similar packages