mirror of
https://github.com/mjg59/python-broadlink.git
synced 2024-11-22 15:10:12 +01:00
Attempt to handle timezones
The timezone should be embedded in the discovery packet, so make a better attempt to do that.
This commit is contained in:
parent
ecab016a73
commit
6936bc750e
@ -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
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user