custom_components/xiaomi_miot_raw/__init__.py
async def _try_command(self, mask_error, func, *args, **kwargs):
        """Call a device command handling error messages."""
        try:
            result = await self.hass.async_add_job(partial(func, *args, **kwargs))

            _LOGGER.info("Response received from %s: %s", self._name, result)
            # This is a workaround. The action should not only return whether operation succeed, but also the 'out'.
            if 'aiid' in result:
                return True if result['code'] == 0 else False
            return True if result[0]['code'] == 0 else False

        except DeviceException as exc:
            _LOGGER.error(mask_error, exc)
            return False
Call a device command handling error messages.
Call a device command handling error messages.
Call a device command handling error messages .
async def _try_command(self, mask_error, func, *args, **kwargs):
        try:
            result = await self.hass.async_add_job(partial(func, *args, **kwargs))
            _LOGGER.info("Response received from %s: %s", self._name, result)
            if 'aiid' in result:
                return True if result['code'] == 0 else False
            return True if result[0]['code'] == 0 else False
        except DeviceException as exc:
            _LOGGER.error(mask_error, exc)
            return False
async def _try_command ( self , mask_error , func , * args , ** kwargs ) : try : result = await self . hass . async_add_job ( partial ( func , * args , ** kwargs ) ) _LOGGER . info ( "Response received from %s: %s" , self . _name , result ) if 'aiid' in result : return True if result [ 'code' ] == 0 else False return True if result [ 0 ] [ 'code' ] == 0 else False except DeviceException as exc : _LOGGER . error ( mask_error , exc ) return False
Call a device command handling error messages.
Call a device command handling error messages .
"""Call a device command handling error messages.""" # This is a workaround. The action should not only return whether operation succeed, but also the 'out'.
self
mask_error
func