コード例 #1
0
ファイル: test_climate.py プロジェクト: crazyfish1111/home
 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
ファイル: test_climate.py プロジェクト: ywu093/home-assistant
    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
ファイル: test_mqtt.py プロジェクト: ManHammer/home-assistant
    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
ファイル: test_demo.py プロジェクト: ManHammer/home-assistant
 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
ファイル: test_climate.py プロジェクト: ywu093/home-assistant
    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
ファイル: test_mqtt.py プロジェクト: ManHammer/home-assistant
    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
ファイル: test_climate.py プロジェクト: crazyfish1111/home
 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
ファイル: test_climate.py プロジェクト: crazyfish1111/home
 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
ファイル: test_demo.py プロジェクト: ManHammer/home-assistant
 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
ファイル: test_demo.py プロジェクト: ManHammer/home-assistant
 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')