diff options
author | Matthew Garrett <mjg59@coreos.com> | 2016-10-10T08·09-0700 |
---|---|---|
committer | Matthew Garrett <mjg59@coreos.com> | 2016-10-10T08·09-0700 |
commit | 6936bc750ee00e495556eee6a28f240020bec945 (patch) | |
tree | 403df6586d1564ba239a4892ef0a20e17226ea46 /broadlink | |
parent | ecab016a73eee8d018a4b8617eb2c2680dbc284d (diff) |
Attempt to handle timezones
The timezone should be embedded in the discovery packet, so make a better attempt to do that.
Diffstat (limited to 'broadlink')
-rwxr-xr-x | broadlink/__init__.py | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/broadlink/__init__.py b/broadlink/__init__.py index c981d6b3eaa4..2891052708a3 100755 --- a/broadlink/__init__.py +++ b/broadlink/__init__.py @@ -25,14 +25,21 @@ class rm2: self.cs.bind(('',0)) self.port = self.cs.getsockname()[1] + timezone = time.timezone/-3600 packet = bytearray(0x30) year = datetime.now().year - packet[0x08] = 0xf9 - packet[0x09] = 0xff - packet[0x0a] = 0xff - packet[0x0b] = 0xff + if timezone < 0: + packet[0x08] = 0xff + timezone - 1 + packet[0x09] = 0xff + packet[0x0a] = 0xff + packet[0x0b] = 0xff + else: + packet[0x08] = timezone + packet[0x09] = 0 + packet[0x0a] = 0 + packet[0x0b] = 0 packet[0x0c] = year & 0xff packet[0x0d] = year >> 8 packet[0x0e] = datetime.now().minute |