h4 / lywsd02

MIT License
169 stars 34 forks source link

Please add new device support #36

Open bdfy opened 1 year ago

bdfy commented 1 year ago

I bought a new version of the device - it does not work with the current code. If you change the code:

    @property
    def time(self):
        with self.connect():
            ch = self._peripheral.getCharacteristics(uuid=UUID_TIME)[0]
            value = ch.read()
        if len(value) == 7:
            value = value[:-2]
        if len(value) == 5:
            ts, tz_offset = struct.unpack('Ib', value)

all OK

Looks like the format has changed. 2.txt 1.txt