(self)
return device
Serialize entity for a query response.

        https://yandex.ru/dev/dialogs/alice/doc/smart-home/reference/post-devices-query-docpage/
Serialize entity for a query response.
Serialize entity for a query response .
def query_serialize(self) -> dict[str, Any]:
        """Serialize entity for a query response.

        https://yandex.ru/dev/dialogs/alice/doc/smart-home/reference/post-devices-query-docpage/
        """
        if self.state.state == STATE_UNAVAILABLE:
            return {
                'id': self.entity_id, 'error_code': ERR_DEVICE_UNREACHABLE
            }

        device = {
            'id': self.entity_id,
            'capabilities': [],
            'properties': [],
        }

        for item in [c for c in self.capabilities() if c.retrievable]:
            state = item.get_state()
            if state is not None:
                device['capabilities'].append(state)

        for item in [p for p in self.properties() if p.retrievable]:
            state = item.get_state()
            if state is not None:
                device['properties'].append(state)

        return device
def query_serialize ( self ) -> dict [ str , Any ] : if self . state . state == STATE_UNAVAILABLE : return { 'id' : self . entity_id , 'error_code' : ERR_DEVICE_UNREACHABLE } device = { 'id' : self . entity_id , 'capabilities' : [ ] , 'properties' : [ ] , } for item in [ c for c in self . capabilities ( ) if c . retrievable ] : state = item . get_state ( ) if state is not None : device [ 'capabilities' ] . append ( state ) for item in [ p for p in self . properties ( ) if p . retrievable ] : state = item . get_state ( ) if state is not None : device [ 'properties' ] . append ( state ) return device