Пример #1
0
    def get_data(self, dt: datetime) -> dict:
        """
        Generates a binary data packet containing the a request for the current time of the controller
        :return: binary data packet
        """
        params = dict(packet_id=0x10,
                      payload1=0x14,
                      year=dt.year - 2000,
                      month=dt.month,
                      day=dt.day,
                      hour=dt.hour,
                      minute=dt.minute,
                      second=dt.second,
                      weekday=dt.isoweekday(),
                      payload2=0x00,
                      remote_or_local=0x0F,
                      checksum=0)

        checksum = _calculate_checksum(params)
        params["checksum"] = checksum

        return self.build(params)
Пример #2
0
def timeUntilNextNotification(thetime: datetime) -> int:
    if thetime.isoweekday() > 5:
        nextreminder = datetime(
            year=thetime.year(),
            month=thetime.month(),
        )