There's clearly a cut-and-paste error in ds1307.py:
@property
def weekday(self) -> int:
"""
Get the weekday from the RTC
:returns: Weekday of RTC
:rtype: int
"""
return self.datetime[5]
The last line should obviously refer to self.datetime[6] instead; as it is, it's returning the current value of seconds.
However I am also doubtful about the implementation and perhaps even the meaning of the property weekday_start. The docs simply define it as "the start of the weekday". It appears to be used as an offset for translating the chip's day of week numbers 0-6 to another range, e.g., 1-7. However, even a value of 1 can cause datetime to call _bcd_to_dec() with a negative argument, in which case it returns a bogus value. Perhaps I'm missing something, but it looks to me as if it has to remain zero.
There's clearly a cut-and-paste error in ds1307.py:
The last line should obviously refer to
self.datetime[6]instead; as it is, it's returning the current value of seconds.However I am also doubtful about the implementation and perhaps even the meaning of the property weekday_start. The docs simply define it as "the start of the weekday". It appears to be used as an offset for translating the chip's day of week numbers 0-6 to another range, e.g., 1-7. However, even a value of 1 can cause
datetimeto call_bcd_to_dec()with a negative argument, in which case it returns a bogus value. Perhaps I'm missing something, but it looks to me as if it has to remain zero.