def available(self) -> bool:
        """Return if device is online or not."""
        # Both ability to retrieve state from MyQ cloud AND device itself has
        # to be online.
        is_available = self.api.online and \
            next(
                attr['Value'] for attr in
                self._device_json.get('Attributes', [])
                if attr.get('AttributeDisplayName') == 'online') == "True"

        return is_available
def available ( self ) -> bool : is_available = self . api . online and next ( attr [ 'Value' ] for attr in self . _device_json . get ( 'Attributes' , [ ] ) if attr . get ( 'AttributeDisplayName' ) == 'online' ) == "True" return is_available
Return if device is online or not.