def test_set_target_temperature(self, set_data, _):
        thermostat = NuHeatThermostat(None, None)
        thermostat.min_temperature = 500
        thermostat.max_temperature = 7000

        # Permanent hold
        thermostat.set_target_temperature(2222)
        set_data.assert_called_with({
            "SetPointTemp": 2222,
            "ScheduleMode": config.SCHEDULE_HOLD
        })

        # Temporary hold
        thermostat.set_target_temperature(2222,
                                          mode=config.SCHEDULE_TEMPORARY_HOLD)
        set_data.assert_called_with({
            "SetPointTemp":
            2222,
            "ScheduleMode":
            config.SCHEDULE_TEMPORARY_HOLD
        })

        # Below minimum
        thermostat.set_target_temperature(481)
        set_data.assert_called_with({
            "SetPointTemp": 500,
            "ScheduleMode": config.SCHEDULE_HOLD
        })

        # Above maximum
        thermostat.set_target_temperature(7020)
        set_data.assert_called_with({
            "SetPointTemp": 7000,
            "ScheduleMode": config.SCHEDULE_HOLD
        })

        # Invalid mode
        with self.assertRaises(Exception) as _:
            thermostat.set_target_temperature(2222, 5)
 def test_max_celsius(self, _):
     thermostat = NuHeatThermostat(None, None)
     self.assertEqual(thermostat.max_celsius, None)
     thermostat.max_temperature = 7000
     self.assertEqual(thermostat.max_celsius, 69)
 def test_max_fahrenheit(self, _):
     thermostat = NuHeatThermostat(None, None)
     self.assertEqual(thermostat.max_fahrenheit, None)
     thermostat.max_temperature = 7000
     self.assertEqual(thermostat.max_fahrenheit, 157)