def ToTLV(cls, tag: Union[int, None], value): writer = tlv.TLVWriter() wrapped_value = cls._cluster_object(Value=value) cls.attribute_type.PutFieldToTLV(tag, asdict(wrapped_value)['Value'], writer, '') return writer.encoding
def DictToTLV(self, data: dict) -> bytes: tlvwriter = tlv.TLVWriter(bytearray()) self.DictToTLVWithWriter('', None, data, tlvwriter) return bytes(tlvwriter.encoding)