Пример #1
0
    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
            ]))
Пример #2
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
            ]))
Пример #3
0
	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
		]))
Пример #4
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
		]))