예제 #1
0
 def test_set_aux_heat_bad_attr(self):
     """Test setting the auxiliary heater without required attribute."""
     state = self.hass.states.get(ENTITY_CLIMATE)
     assert 'off' == state.attributes.get('aux_heat')
     common.set_aux_heat(self.hass, None, ENTITY_CLIMATE)
     self.hass.block_till_done()
     assert 'off' == state.attributes.get('aux_heat')
예제 #2
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)
        assert 'off' == state.attributes.get('aux_heat')

        common.set_aux_heat(self.hass, True, ENTITY_CLIMATE)
        self.hass.block_till_done()
        state = self.hass.states.get(ENTITY_CLIMATE)
        assert '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)
        assert '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)
        assert '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)
        assert '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)
        assert 'off' == state.attributes.get('aux_heat')

        common.set_aux_heat(self.hass, True, ENTITY_CLIMATE)
        self.hass.block_till_done()
        state = self.hass.states.get(ENTITY_CLIMATE)
        assert '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)
        assert '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)
        assert '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)
        assert 'off' == state.attributes.get('aux_heat')
예제 #4
0
 def test_set_aux_heat_bad_attr(self):
     """Test setting the auxiliary heater without required attribute."""
     state = self.hass.states.get(ENTITY_CLIMATE)
     assert 'off' == state.attributes.get('aux_heat')
     common.set_aux_heat(self.hass, None, ENTITY_CLIMATE)
     self.hass.block_till_done()
     assert '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)
        assert 'off' == state.attributes.get('aux_heat')
        common.set_aux_heat(self.hass, True, ENTITY_CLIMATE)
        self.hass.block_till_done()
        self.mock_publish.async_publish.assert_called_once_with(
            'aux-topic', 'ON', 0, False)
        self.mock_publish.async_publish.reset_mock()
        state = self.hass.states.get(ENTITY_CLIMATE)
        assert 'on' == state.attributes.get('aux_heat')

        common.set_aux_heat(self.hass, False, ENTITY_CLIMATE)
        self.hass.block_till_done()
        self.mock_publish.async_publish.assert_called_once_with(
            'aux-topic', 'OFF', 0, False)
        state = self.hass.states.get(ENTITY_CLIMATE)
        assert '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)
        assert 'off' == state.attributes.get('aux_heat')
        common.set_aux_heat(self.hass, True, ENTITY_CLIMATE)
        self.hass.block_till_done()
        self.mock_publish.async_publish.assert_called_once_with(
            'aux-topic', 'ON', 0, False)
        self.mock_publish.async_publish.reset_mock()
        state = self.hass.states.get(ENTITY_CLIMATE)
        assert 'on' == state.attributes.get('aux_heat')

        common.set_aux_heat(self.hass, False, ENTITY_CLIMATE)
        self.hass.block_till_done()
        self.mock_publish.async_publish.assert_called_once_with(
            'aux-topic', 'OFF', 0, False)
        state = self.hass.states.get(ENTITY_CLIMATE)
        assert 'off' == state.attributes.get('aux_heat')
예제 #7
0
 def test_set_aux_heat_off(self):
     """Test setting the auxiliary heater off/false."""
     common.set_aux_heat(self.hass, False, ENTITY_CLIMATE)
     self.hass.block_till_done()
     state = self.hass.states.get(ENTITY_CLIMATE)
     assert 'off' == state.attributes.get('aux_heat')
예제 #8
0
 def test_set_aux_heat_on(self):
     """Test setting the axillary heater on/true."""
     common.set_aux_heat(self.hass, True, ENTITY_CLIMATE)
     self.hass.block_till_done()
     state = self.hass.states.get(ENTITY_CLIMATE)
     assert 'on' == state.attributes.get('aux_heat')
예제 #9
0
 def test_set_aux_heat_off(self):
     """Test setting the auxiliary heater off/false."""
     common.set_aux_heat(self.hass, False, ENTITY_CLIMATE)
     self.hass.block_till_done()
     state = self.hass.states.get(ENTITY_CLIMATE)
     assert 'off' == state.attributes.get('aux_heat')
예제 #10
0
 def test_set_aux_heat_on(self):
     """Test setting the axillary heater on/true."""
     common.set_aux_heat(self.hass, True, ENTITY_CLIMATE)
     self.hass.block_till_done()
     state = self.hass.states.get(ENTITY_CLIMATE)
     assert 'on' == state.attributes.get('aux_heat')