Do a separate query to get device status. This can tell if device
        is on/off, lighting level, etc.

def get_device_status(self, device_id, return_led=0, level=None):
        """Do a separate query to get device status. This can tell if device
        is on/off, lighting level, etc."""
        # status['responseCmd2'] is lighting level
        # responseCmd1 contains All-Link Database delta
        # if returnLED = 0. returns light level in responseCmd2
        # if returnLED = 1, returns LED Bit Flags in responseCmd1

        self.logger.info("\nget_device_status for device %s", device_id)
        device_id = device_id.upper()
        status = False

        if not level:
            if return_led == 1:
                level = '01'
            else:
                level = '00'

        if os.path.exists(device_id + CACHE_FILE):
            status = self.get_command_response_from_cache(device_id, '19', level)

        if not status:
            self.logger.info("no cached status for device %s", device_id)
            self.direct_command(device_id, '19', level)

            attempts = 1
            sleep(1)

            status = self.get_buffer_status(device_id)
            while 'success' not in status and attempts < 9:
                status = self.get_command_response_from_cache(device_id, '19', level)
                if not status:
                    if attempts % 3 == 0:
                        self.direct_command(device_id, '19', level)
                    else:
                        sleep(1)
                    status = self.get_buffer_status(device_id)
                attempts += 1
        else:
            self.logger.info("got cached status for device %s", device_id)

        return status