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_min_celsius(self, _):
     thermostat = NuHeatThermostat(None, None)
     self.assertEqual(thermostat.min_celsius, None)
     thermostat.min_temperature = 500
     self.assertEqual(thermostat.min_celsius, 5)
 def test_min_fahrenheit(self, _):
     thermostat = NuHeatThermostat(None, None)
     self.assertEqual(thermostat.min_fahrenheit, None)
     thermostat.min_temperature = 500
     self.assertEqual(thermostat.min_fahrenheit, 41)