Пример #1
0
    def parseSensor(data, device):
        value = Convert.bytesToDecimal(data[21:22])
        state = Convert.bytesToInt(data[24:25]) == 255
        device.value = value
        device.state = state

        return device
Пример #2
0
    def parseSensor(self, data, device):
        value = Convert.bytesToDecimal(data[21:22])
        state = Convert.bytesToInt(data[24:25]) == 255
        device._state = state
        device._value = value
        device._runCallbacks()

        return device
Пример #3
0
 def test_bytesToDecimal(self):
     data = bytearray(b"\xd5")
     ints = Convert.bytesToDecimal(data)
     self.assertEqual(21.3, ints)