Пример #1
0
    async def adb_command(self, cmd):
        """Send an ADB command to an Android TV / Fire TV device."""
        key = KEYS.get(cmd)
        if key:
            await self.aftv.adb_shell(f"input keyevent {key}")
            return

        if cmd == "GET_PROPERTIES":
            self._attr_extra_state_attributes[ATTR_ADB_RESPONSE] = str(
                await self.aftv.get_properties_dict())
            self.async_write_ha_state()
            return

        try:
            response = await self.aftv.adb_shell(cmd)
        except UnicodeDecodeError:
            return

        if isinstance(response, str) and response.strip():
            self._attr_extra_state_attributes[
                ATTR_ADB_RESPONSE] = response.strip()
            self.async_write_ha_state()

        return
Пример #2
0
 async def adb_command(self, command):
     """Send an ADB command to an Android TV / Fire TV device."""
     if key := KEYS.get(command):
         await self.aftv.adb_shell(f"input keyevent {key}")
         return