Пример #1
0
 def test_set_aux_heat_bad_attr(self):
     """Test setting the auxillary heater without required attribute."""
     state = self.hass.states.get(ENTITY_CLIMATE)
     self.assertEqual('off', state.attributes.get('aux_heat'))
     climate.set_aux_heat(self.hass, None, ENTITY_CLIMATE)
     self.hass.block_till_done()
     self.assertEqual('off', state.attributes.get('aux_heat'))
Пример #2
0
 def test_set_aux_heat_bad_attr(self):
     """Test setting the auxillary heater without required attribute."""
     state = self.hass.states.get(ENTITY_CLIMATE)
     self.assertEqual('off', state.attributes.get('aux_heat'))
     climate.set_aux_heat(self.hass, None, ENTITY_CLIMATE)
     self.hass.pool.block_till_done()
     self.assertEqual('off', state.attributes.get('aux_heat'))
Пример #3
0
    def test_set_aux_pessimistic(self):
        """Test setting of the aux heating in pessimistic mode."""
        config = copy.deepcopy(DEFAULT_CONFIG)
        config['climate']['aux_state_topic'] = 'aux-state'
        assert setup_component(self.hass, climate.DOMAIN, config)

        state = self.hass.states.get(ENTITY_CLIMATE)
        self.assertEqual('off', state.attributes.get('aux_heat'))

        climate.set_aux_heat(self.hass, True, ENTITY_CLIMATE)
        self.hass.block_till_done()
        state = self.hass.states.get(ENTITY_CLIMATE)
        self.assertEqual('off', state.attributes.get('aux_heat'))

        fire_mqtt_message(self.hass, 'aux-state', 'ON')
        self.hass.block_till_done()
        state = self.hass.states.get(ENTITY_CLIMATE)
        self.assertEqual('on', state.attributes.get('aux_heat'))

        fire_mqtt_message(self.hass, 'aux-state', 'OFF')
        self.hass.block_till_done()
        state = self.hass.states.get(ENTITY_CLIMATE)
        self.assertEqual('off', state.attributes.get('aux_heat'))

        fire_mqtt_message(self.hass, 'aux-state', 'nonsense')
        self.hass.block_till_done()
        state = self.hass.states.get(ENTITY_CLIMATE)
        self.assertEqual('off', state.attributes.get('aux_heat'))
Пример #4
0
    def test_set_aux_pessimistic(self):
        """Test setting of the aux heating in pessimistic mode."""
        config = copy.deepcopy(DEFAULT_CONFIG)
        config['climate']['aux_state_topic'] = 'aux-state'
        assert setup_component(self.hass, climate.DOMAIN, config)

        state = self.hass.states.get(ENTITY_CLIMATE)
        self.assertEqual('off', state.attributes.get('aux_heat'))

        climate.set_aux_heat(self.hass, True, ENTITY_CLIMATE)
        self.hass.block_till_done()
        state = self.hass.states.get(ENTITY_CLIMATE)
        self.assertEqual('off', state.attributes.get('aux_heat'))

        fire_mqtt_message(self.hass, 'aux-state', 'ON')
        self.hass.block_till_done()
        state = self.hass.states.get(ENTITY_CLIMATE)
        self.assertEqual('on', state.attributes.get('aux_heat'))

        fire_mqtt_message(self.hass, 'aux-state', 'OFF')
        self.hass.block_till_done()
        state = self.hass.states.get(ENTITY_CLIMATE)
        self.assertEqual('off', state.attributes.get('aux_heat'))

        fire_mqtt_message(self.hass, 'aux-state', 'nonsense')
        self.hass.block_till_done()
        state = self.hass.states.get(ENTITY_CLIMATE)
        self.assertEqual('off', state.attributes.get('aux_heat'))
Пример #5
0
    def test_set_aux(self):
        """Test setting of the aux heating."""
        assert setup_component(self.hass, climate.DOMAIN, DEFAULT_CONFIG)

        state = self.hass.states.get(ENTITY_CLIMATE)
        self.assertEqual('off', state.attributes.get('aux_heat'))
        climate.set_aux_heat(self.hass, True, ENTITY_CLIMATE)
        self.hass.block_till_done()
        self.assertEqual(('aux-topic', 'ON', 0, False),
                         self.mock_publish.mock_calls[-2][1])
        state = self.hass.states.get(ENTITY_CLIMATE)
        self.assertEqual('on', state.attributes.get('aux_heat'))

        climate.set_aux_heat(self.hass, False, ENTITY_CLIMATE)
        self.hass.block_till_done()
        self.assertEqual(('aux-topic', 'OFF', 0, False),
                         self.mock_publish.mock_calls[-2][1])
        state = self.hass.states.get(ENTITY_CLIMATE)
        self.assertEqual('off', state.attributes.get('aux_heat'))
Пример #6
0
    def test_set_aux(self):
        """Test setting of the aux heating."""
        assert setup_component(self.hass, climate.DOMAIN, DEFAULT_CONFIG)

        state = self.hass.states.get(ENTITY_CLIMATE)
        self.assertEqual('off', state.attributes.get('aux_heat'))
        climate.set_aux_heat(self.hass, True, ENTITY_CLIMATE)
        self.hass.block_till_done()
        self.assertEqual(('aux-topic', 'ON', 0, False),
                         self.mock_publish.mock_calls[-2][1])
        state = self.hass.states.get(ENTITY_CLIMATE)
        self.assertEqual('on', state.attributes.get('aux_heat'))

        climate.set_aux_heat(self.hass, False, ENTITY_CLIMATE)
        self.hass.block_till_done()
        self.assertEqual(('aux-topic', 'OFF', 0, False),
                         self.mock_publish.mock_calls[-2][1])
        state = self.hass.states.get(ENTITY_CLIMATE)
        self.assertEqual('off', state.attributes.get('aux_heat'))
Пример #7
0
 def test_set_aux_heat_off(self):
     """Test setting the auxillary heater off/false."""
     climate.set_aux_heat(self.hass, False, ENTITY_CLIMATE)
     self.hass.block_till_done()
     state = self.hass.states.get(ENTITY_CLIMATE)
     self.assertEqual('off', state.attributes.get('aux_heat'))
Пример #8
0
 def test_set_aux_heat_on(self):
     """Test setting the axillary heater on/true."""
     climate.set_aux_heat(self.hass, True, ENTITY_CLIMATE)
     self.hass.block_till_done()
     state = self.hass.states.get(ENTITY_CLIMATE)
     self.assertEqual('on', state.attributes.get('aux_heat'))
Пример #9
0
 def test_set_aux_heat_off(self):
     """Test setting the auxillary heater off/false."""
     climate.set_aux_heat(self.hass, False, ENTITY_CLIMATE)
     self.hass.pool.block_till_done()
     state = self.hass.states.get(ENTITY_CLIMATE)
     self.assertEqual('off', state.attributes.get('aux_heat'))
Пример #10
0
 def test_set_aux_heat_on(self):
     """Test setting the axillary heater on/true."""
     climate.set_aux_heat(self.hass, True, ENTITY_CLIMATE)
     self.hass.pool.block_till_done()
     state = self.hass.states.get(ENTITY_CLIMATE)
     self.assertEqual('on', state.attributes.get('aux_heat'))