Last active
February 24, 2019 16:30
-
-
Save nomis/4e534ddd0e0822a2191edba04610c7fa to your computer and use it in GitHub Desktop.
Decode Evohome schedule data
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import struct | |
import zlib | |
def decode_schedule(message): | |
data = zlib.decompress(bytes.fromhex(message)) | |
for record in [data[i:i+20] for i in range(0, len(data), 20)]: | |
(zone, day, time, temp, unknown) = struct.unpack("<xxxxLLLHH", record) | |
day = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"][day] | |
hours = time // 60 | |
minutes = time % 60 | |
temp /= 100 | |
print("Zone {0}: {1} at {2:02d}:{3:02d} = {4:.2f} ({5})".format(zone, day, hours, minutes, temp, unknown)) | |
decode_schedule("68816DCCC10D8030084051A0881DA8078F3D398303388B733A8A9A686CDACF8D1F7822FF1C2A5272C94D92F36E79CE73DB161FEFD649A4468D6F57F0143C054FC133F00C3C03CFC04BE025F01278093C07CFC173F01CBCE9FD6DEF9EB6D9D87AEF697BE70578015E80178D77014CCE19AA") | |
print() | |
decode_schedule("68816DD0CD0D80200C86E1B6D49FC42518C283474FCEE000DEDDC239DD80151451A0F1E3F8A67DD24054DEC144631F4295E8BC5BDFD936E97F6E6988E6B634061E038F81C7C013E009F00478023C073C073C073C073C059E024FB357FE4EB3D7F9AF35EF6E3D17DB2AB1D9B9E4EDA66D8F5776DB7C9F6DE93EDBDEFB42DDD27D83BF00896D372AB3D7F9AF35EF6E3D17DB2AB1D9B9E4EDA66D8F5776DB7C9F6DE93EDBDE") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When compressing the data the maximum window size accepted is 16384 bytes but the compression level can be 9.