def test_set_vacation(self): msg = SetTemperatureAndModeMessage( '122B65', 1, SetTemperatureAndModeMessage.ModeVacation, temperature=29.5, end=datetime.datetime(2015, 12, 15, 23, 00)) b64payload = msg.to_bytes()[2:] data = base64.b64decode(b64payload) self.assertEqual( data, bytearray([ 0x00, 0x04, 0x40, 0x00, 0x00, 0x00, # base string 0x12, 0x2b, 0x65, # rf addr 0x01, # room 0xBB, 0xCF, 0xF, 0x2E, # vacation, temp = 29.5, end = 15.12.2015, 23:00h # | - | | # date unt. # time until # | temp ]))
def test_set_manual(self): msg = SetTemperatureAndModeMessage( '122B65', 1, SetTemperatureAndModeMessage.ModeManual, temperature=19) b64payload = msg.to_bytes()[2:] data = base64.b64decode(b64payload) self.assertEqual( data, bytearray([ 0x00, 0x04, 0x40, 0x00, 0x00, 0x00, # base string 0x12, 0x2b, 0x65, # rf addr 0x01, # room 0x66, # manual, temp = 19 ]))
def test_set_boost(self): msg = SetTemperatureAndModeMessage('122B65', 1, SetTemperatureAndModeMessage.ModeBoost) b64payload = msg.to_bytes()[2:] data = base64.b64decode(b64payload) self.assertEqual(data, bytearray([ 0x00, 0x04, 0x40, 0x00, 0x00, 0x00, # base string 0x12, 0x2b, 0x65, # rf addr 0x01, # room 0xc0, # boost, temp = 0 ]))
def test_set_vacation(self): msg = SetTemperatureAndModeMessage('122B65', 1, SetTemperatureAndModeMessage.ModeVacation, temperature=29.5, end=datetime.datetime(2015, 12, 15, 23, 00)) b64payload = msg.to_bytes()[2:] data = base64.b64decode(b64payload) self.assertEqual(data, bytearray([ 0x00, 0x04, 0x40, 0x00, 0x00, 0x00, # base string 0x12, 0x2b, 0x65, # rf addr 0x01, # room 0xBB, 0xCF, 0xF, 0x2E, # vacation, temp = 29.5, end = 15.12.2015, 23:00h # | - | | # date unt. # time until # | temp ]))
def test_set_mode_vacation(self): c = self._mocked_cube() response = c.set_mode_vacation(123, '001122', temperature=123, end=datetime.datetime( 2015, 12, 16, 12, 00, 00)) c.send_message.assert_called_with( SetTemperatureAndModeMessage('001122', 123, 0x80, temperature=123, end=datetime.datetime( 2015, 12, 16, 12, 00, 00))) self.assertIsInstance(response, SetResponse)
def test_set_mode_manual(self): c = self._mocked_cube() response = c.set_mode_manual(123, '001122', temperature=123) c.send_message.assert_called_with( SetTemperatureAndModeMessage('001122', 123, 0x40, temperature=123)) self.assertIsInstance(response, SetResponse)
def set_mode(self, room, rf_addr, mode, *args, **kwargs): self.send_message(SetTemperatureAndModeMessage(rf_addr, room, mode, **kwargs)) return self.get_message(SET_RESPONSE)