Skip to content

Instantly share code, notes, and snippets.

@nomis
Last active February 24, 2019 16:30
Show Gist options
  • Save nomis/4e534ddd0e0822a2191edba04610c7fa to your computer and use it in GitHub Desktop.
Save nomis/4e534ddd0e0822a2191edba04610c7fa to your computer and use it in GitHub Desktop.
Decode Evohome schedule data
#!/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")
@nomis
Copy link
Author

nomis commented Jan 17, 2019

Zone 0: Mon at 06:30 = 21.00 (2100)
Zone 0: Mon at 08:00 = 18.00 (1800)
Zone 0: Mon at 18:00 = 21.00 (2100)
Zone 0: Mon at 22:30 = 16.00 (1600)
Zone 0: Tue at 06:30 = 21.00 (2100)
Zone 0: Tue at 08:00 = 18.00 (1800)
Zone 0: Tue at 18:00 = 21.00 (2100)
Zone 0: Tue at 22:30 = 16.00 (1600)
Zone 0: Wed at 06:30 = 21.00 (2100)
Zone 0: Wed at 08:00 = 18.00 (1800)
Zone 0: Wed at 18:00 = 21.00 (2100)
Zone 0: Wed at 22:30 = 16.00 (1600)
Zone 0: Thu at 06:30 = 21.00 (2100)
Zone 0: Thu at 08:00 = 18.00 (1800)
Zone 0: Thu at 18:00 = 21.00 (2100)
Zone 0: Thu at 22:30 = 16.00 (1600)
Zone 0: Fri at 06:30 = 21.00 (2100)
Zone 0: Fri at 08:00 = 18.00 (1800)
Zone 0: Fri at 18:00 = 21.00 (2100)
Zone 0: Fri at 22:30 = 16.00 (1600)
Zone 0: Sat at 08:00 = 21.00 (2100)
Zone 0: Sat at 10:00 = 21.00 (2100)
Zone 0: Sat at 18:00 = 21.00 (2100)
Zone 0: Sat at 23:00 = 16.00 (1600)
Zone 0: Sun at 08:00 = 21.00 (2100)
Zone 0: Sun at 10:00 = 21.00 (2100)
Zone 0: Sun at 18:00 = 21.00 (2100)
Zone 0: Sun at 23:00 = 16.00 (1600)

Zone 0: Mon at 06:30 = 21.00 (61423)
Zone 0: Mon at 08:00 = 18.00 (61423)
Zone 0: Mon at 18:00 = 21.00 (61423)
Zone 0: Mon at 22:30 = 16.00 (61423)
Zone 0: Tue at 06:30 = 21.00 (61423)
Zone 0: Tue at 08:00 = 18.00 (61423)
Zone 0: Tue at 18:00 = 21.00 (61423)
Zone 0: Tue at 22:30 = 16.00 (61423)
Zone 0: Wed at 06:30 = 21.00 (61423)
Zone 0: Wed at 08:00 = 18.00 (61423)
Zone 0: Wed at 18:00 = 21.00 (61423)
Zone 0: Wed at 22:30 = 16.00 (61423)
Zone 0: Thu at 06:30 = 21.00 (61423)
Zone 0: Thu at 08:00 = 18.00 (61423)
Zone 0: Thu at 18:00 = 21.00 (61423)
Zone 0: Thu at 22:30 = 16.00 (61423)
Zone 0: Fri at 06:30 = 21.00 (61423)
Zone 0: Fri at 08:00 = 18.00 (61423)
Zone 0: Fri at 18:00 = 21.00 (0)
Zone 0: Fri at 22:30 = 16.00 (8199)
Zone 0: Sat at 08:00 = 21.00 (0)
Zone 0: Sat at 10:00 = 21.00 (8199)
Zone 0: Sat at 18:00 = 21.00 (8303)
Zone 0: Sat at 23:00 = 16.00 (0)
Zone 0: Sun at 06:30 = 21.00 (0)
Zone 0: Sun at 08:00 = 18.00 (0)
Zone 0: Sun at 18:00 = 21.00 (61184)
Zone 0: Sun at 22:30 = 16.00 (8203)

When compressing the data the maximum window size accepted is 16384 bytes but the compression level can be 9.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment