u9n / dlms-cosem

A Python library for DLMS/COSEM
Other
87 stars 43 forks source link

Implement encoding rules for TimeData and DateData #101

Open Krolken opened 1 day ago

Krolken commented 1 day ago

There is no .to_bytes() defined for dlms_data.TimeData and `dlms_data.DateData``

They should be instanciated with either datetime, data or time object. None should also be allowed and encoded to all ones.

@define 
class TimeData:

   value: time | None = field(converter=convert_datetime_to_time)

@define
class DateData

   value: date | None = field(converters=convert_datetime_to_date)
Krolken commented 1 day ago

All onces b"x\ffx\ffx\ffx\ff" should also be implemented in the parsing rules.