Skip to content

Commit f50af68

Browse files
committed
Replave utc_now by fixed_time
1 parent da3ae66 commit f50af68

File tree

1 file changed

+25
-29
lines changed

1 file changed

+25
-29
lines changed

tests/stick_test_data.py

Lines changed: 25 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,10 @@
66
pw_constants = importlib.import_module("plugwise_usb.constants")
77

88
# test using utc timezone - 2025-04-03 22:00:00
9-
utc_now = datetime(2025, 4, 3, 22, 0, 0) # datetime.now(tz=UTC).replace(tzinfo=UTC)
10-
# utc_now_offset = datetime.now(tz=UTC).replace(tzinfo=UTC) + timedelta(
11-
# days=1, hours=4, seconds=30
12-
# )
13-
9+
fixed_time = datetime(2025, 4, 3, 22, 0, 0) # changed from datetime.now(tz=UTC).replace(tzinfo=UTC)
1410

1511
# generate energy log timestamps with fixed hour timestamp used in tests
16-
hour_timestamp = utc_now.replace(minute=0, second=0, microsecond=0)
12+
hour_timestamp = fixed_time.replace(minute=0, second=0, microsecond=0)
1713

1814
LOG_TIMESTAMPS = {}
1915
_one_hour = timedelta(hours=1)
@@ -598,13 +594,13 @@
598594
b"000000C1", # Success ack
599595
b"003A" # msg_id
600596
+ b"0098765432101234" # mac
601-
+ bytes(f"{(utc_now + timedelta(seconds=10)).second:02d}", pw_constants.UTF8) # noqa: UP031
602-
+ bytes(f"{utc_now.minute:02d}", pw_constants.UTF8) # noqa: UP031
603-
+ bytes(f"{utc_now.hour:02d}", pw_constants.UTF8) # noqa: UP031
604-
+ bytes(f"{utc_now.weekday():02d}", pw_constants.UTF8) # noqa: UP031
605-
+ bytes(f"{utc_now.day:02d}", pw_constants.UTF8) # noqa: UP031
606-
+ bytes(f"{utc_now.month:02d}", pw_constants.UTF8) # noqa: UP031
607-
+ bytes(f"{(utc_now.year - 2000):02d}", pw_constants.UTF8), # noqa: UP031
597+
+ bytes(f"{(fixed_time + timedelta(seconds=10)).second:02d}", pw_constants.UTF8) # noqa: UP031
598+
+ bytes(f"{fixed_time.minute:02d}", pw_constants.UTF8) # noqa: UP031
599+
+ bytes(f"{fixed_time.hour:02d}", pw_constants.UTF8) # noqa: UP031
600+
+ bytes(f"{fixed_time.weekday():02d}", pw_constants.UTF8) # noqa: UP031
601+
+ bytes(f"{fixed_time.day:02d}", pw_constants.UTF8) # noqa: UP031
602+
+ bytes(f"{fixed_time.month:02d}", pw_constants.UTF8) # noqa: UP031
603+
+ bytes(f"{(fixed_time.year - 2000):02d}", pw_constants.UTF8), # noqa: UP031
608604
),
609605
b"\x05\x05\x03\x0300280098765432101234000022030304259DDF\r\n": (
610606
"Circle+ Realtime set clock for 0098765432101234",
@@ -616,10 +612,10 @@
616612
b"000000C1", # Success ack
617613
b"003F" # msg_id
618614
+ b"1111111111111111" # mac
619-
+ bytes(f"{utc_now.hour:02x}", pw_constants.UTF8) # noqa: UP031
620-
+ bytes(f"{utc_now.minute:02x}", pw_constants.UTF8) # noqa: UP031
621-
+ bytes(f"{(utc_now + timedelta(seconds=10)).second:02x}", pw_constants.UTF8) # noqa: UP031
622-
+ bytes(f"{utc_now.weekday():02x}", pw_constants.UTF8) # noqa: UP031
615+
+ bytes(f"{fixed_time.hour:02x}", pw_constants.UTF8) # noqa: UP031
616+
+ bytes(f"{fixed_time.minute:02x}", pw_constants.UTF8) # noqa: UP031
617+
+ bytes(f"{(fixed_time + timedelta(seconds=10)).second:02x}", pw_constants.UTF8) # noqa: UP031
618+
+ bytes(f"{fixed_time.weekday():02x}", pw_constants.UTF8) # noqa: UP031
623619
+ b"00" # unknown
624620
+ b"0000", # unknown2
625621
),
@@ -628,10 +624,10 @@
628624
b"000000C1", # Success ack
629625
b"003F" # msg_id
630626
+ b"2222222222222222" # mac
631-
+ bytes(f"{utc_now.hour:02x}", pw_constants.UTF8) # noqa: UP031
632-
+ bytes(f"{utc_now.minute:02x}", pw_constants.UTF8) # noqa: UP031
633-
+ bytes(f"{utc_now.second:02x}", pw_constants.UTF8) # noqa: UP031
634-
+ bytes(f"{utc_now.weekday():02x}", pw_constants.UTF8) # noqa: UP031
627+
+ bytes(f"{fixed_time.hour:02x}", pw_constants.UTF8) # noqa: UP031
628+
+ bytes(f"{fixed_time.minute:02x}", pw_constants.UTF8) # noqa: UP031
629+
+ bytes(f"{fixed_time.second:02x}", pw_constants.UTF8) # noqa: UP031
630+
+ bytes(f"{fixed_time.weekday():02x}", pw_constants.UTF8) # noqa: UP031
635631
+ b"00" # unknown
636632
+ b"0000", # unknown2
637633
),
@@ -640,10 +636,10 @@
640636
b"000000C1", # Success ack
641637
b"003F" # msg_id
642638
+ b"3333333333333333" # mac
643-
+ bytes(f"{utc_now.hour:02x}", pw_constants.UTF8) # noqa: UP031
644-
+ bytes(f"{utc_now.minute:02x}", pw_constants.UTF8) # noqa: UP031
645-
+ bytes(f"{utc_now.second:02x}", pw_constants.UTF8) # noqa: UP031
646-
+ bytes(f"{utc_now.weekday():02x}", pw_constants.UTF8) # noqa: UP031
639+
+ bytes(f"{fixed_time.hour:02x}", pw_constants.UTF8) # noqa: UP031
640+
+ bytes(f"{fixed_time.minute:02x}", pw_constants.UTF8) # noqa: UP031
641+
+ bytes(f"{fixed_time.second:02x}", pw_constants.UTF8) # noqa: UP031
642+
+ bytes(f"{fixed_time.weekday():02x}", pw_constants.UTF8) # noqa: UP031
647643
+ b"00" # unknown
648644
+ b"0000", # unknown2
649645
),
@@ -652,10 +648,10 @@
652648
b"000000C1", # Success ack
653649
b"003F" # msg_id
654650
+ b"4444444444444444" # mac
655-
+ bytes(f"{utc_now.hour:02x}", pw_constants.UTF8) # noqa: UP031
656-
+ bytes(f"{utc_now.minute:02x}", pw_constants.UTF8) # noqa: UP031
657-
+ bytes(f"{utc_now.second:02x}", pw_constants.UTF8) # noqa: UP031
658-
+ bytes(f"{utc_now.weekday():02x}", pw_constants.UTF8) # noqa: UP031
651+
+ bytes(f"{fixed_time.hour:02x}", pw_constants.UTF8) # noqa: UP031
652+
+ bytes(f"{fixed_time.minute:02x}", pw_constants.UTF8) # noqa: UP031
653+
+ bytes(f"{fixed_time.second:02x}", pw_constants.UTF8) # noqa: UP031
654+
+ bytes(f"{fixed_time.weekday():02x}", pw_constants.UTF8) # noqa: UP031
659655
+ b"00" # unknown
660656
+ b"0000", # unknown2
661657
),

0 commit comments

Comments
 (0)