Closed Hagenmue closed 3 years ago
OK, I have found the problem.
if hex(target_temperature)[2:]
< 0x10 (this occure if mode=AUTOMATIC) the conversion fails, so I have changed the code to:
target_temperature = int(temperature * 2) + (mode << 6) tmp = hex(target_temperature)[2:] bl=len(tmp) if (bl % 2): tmp = '0' + tmp byte_cmd = '000440000000' + rf_address + room + tmp
device is a thermostat
cube.set_mode(device, MAX_DEVICE_MODE_MANUAL)
works fine, butcube.set_mode(device,MAX_DEVICE_MODE_AUTOMATIC)
failed with:Traceback (most recent call last): File "./test_einstellung.py", line 31, in <module> cube.set_mode(device,MAX_DEVICE_MODE_AUTOMATIC) File "/usr/local/lib/python2.7/dist-packages/maxcube/cube.py", line 253, in set_mode self.set_temperature_mode(thermostat, thermostat.target_temperature, mode) File "/usr/local/lib/python2.7/dist-packages/maxcube/cube.py", line 270, in set_temperature_mode command = 's:' + base64.b64encode(bytearray.fromhex(byte_cmd)).decode('utf-8') + '\r\n' ValueError: non-hexadecimal number found in fromhex() arg at position 20