(self, ent_reg: EntityRegistry, dev_reg: DeviceRegistry,
                                area_reg: AreaRegistry)
return device
Serialize entity for a devices response.

        https://yandex.ru/dev/dialogs/alice/doc/smart-home/reference/get-devices-docpage/
Serialize entity for a devices response.
Serialize entity for a devices response .
async def devices_serialize(self, ent_reg: EntityRegistry, dev_reg: DeviceRegistry,
                                area_reg: AreaRegistry) -> dict[str, Any] | None:
        """Serialize entity for a devices response.

        https://yandex.ru/dev/dialogs/alice/doc/smart-home/reference/get-devices-docpage/
        """
        if self.state.state == STATE_UNAVAILABLE:
            return None

        if not self.capabilities() and not self.properties():
            return None

        entity_config = self.config.get_entity_config(self.entity_id)
        name = (entity_config.get(CONF_NAME) or self.state.name).strip() or self.entity_id
        entity_entry, device_entry = await self._get_entity_and_device(ent_reg, dev_reg)

        device = {
            'id': self.entity_id,
            'name': name,
            'type': self.yandex_device_type,
            'capabilities': [],
            'properties': [],
            'device_info': {
                'model': self.entity_id,
            },
        }

        room = entity_config.get(CONF_ROOM)
        if room:
            device['room'] = room
        else:
            area = await self._get_area(entity_entry, device_entry, area_reg)
            if area and area.name:
                device['room'] = area.name

        if device_entry:
            if device_entry.manufacturer:
                device['device_info']['manufacturer'] = device_entry.manufacturer
            if device_entry.model:
                device['device_info']['model'] = f'{device_entry.model} | {self.entity_id}'
            if device_entry.sw_version:
                device['device_info']['sw_version'] = str(device_entry.sw_version)

        for item in [c.description() for c in self.capabilities()]:
            if item not in device['capabilities']:
                device['capabilities'].append(item)

        for item in [p.description() for p in self.properties()]:
            if item not in device['properties']:
                device['properties'].append(item)

        return device
async def devices_serialize ( self , ent_reg : EntityRegistry , dev_reg : DeviceRegistry , area_reg : AreaRegistry ) -> dict [ str , Any ] | None : if self . state . state == STATE_UNAVAILABLE : return None if not self . capabilities ( ) and not self . properties ( ) : return None entity_config = self . config . get_entity_config ( self . entity_id ) name = ( entity_config . get ( CONF_NAME ) or self . state . name ) . strip ( ) or self . entity_id entity_entry , device_entry = await self . _get_entity_and_device ( ent_reg , dev_reg ) device = { 'id' : self . entity_id , 'name' : name , 'type' : self . yandex_device_type , 'capabilities' : [ ] , 'properties' : [ ] , 'device_info' : { 'model' : self . entity_id , } , } room = entity_config . get ( CONF_ROOM ) if room : device [ 'room' ] = room else : area = await self . _get_area ( entity_entry , device_entry , area_reg ) if area and area . name : device [ 'room' ] = area . name if device_entry : if device_entry . manufacturer : device [ 'device_info' ] [ 'manufacturer' ] = device_entry . manufacturer if device_entry . model : device [ 'device_info' ] [ 'model' ] = f'{device_entry.model} | {self.entity_id}' if device_entry . sw_version : device [ 'device_info' ] [ 'sw_version' ] = str ( device_entry . sw_version ) for item in [ c . description ( ) for c in self . capabilities ( ) ] : if item not in device [ 'capabilities' ] : device [ 'capabilities' ] . append ( item ) for item in [ p . description ( ) for p in self . properties ( ) ] : if item not in device [ 'properties' ] : device [ 'properties' ] . append ( item ) return device