예제 #1
0
 def test_set_fan_mode_bad_attr(self):
     """Test setting fan mode without required attribute."""
     state = self.hass.states.get(ENTITY_CLIMATE)
     self.assertEqual("On High", state.attributes.get('fan_mode'))
     climate.set_fan_mode(self.hass, None, ENTITY_CLIMATE)
     self.hass.pool.block_till_done()
     self.assertEqual("On High", state.attributes.get('fan_mode'))
예제 #2
0
 def test_set_fan_mode_bad_attr(self):
     """Test setting fan mode without required attribute."""
     state = self.hass.states.get(ENTITY_CLIMATE)
     self.assertEqual("On High", state.attributes.get('fan_mode'))
     climate.set_fan_mode(self.hass, None, ENTITY_CLIMATE)
     self.hass.pool.block_till_done()
     self.assertEqual("On High", state.attributes.get('fan_mode'))
예제 #3
0
 def test_set_fan_mode(self):
     """Test setting of new fan mode."""
     state = self.hass.states.get(ENTITY_CLIMATE)
     self.assertEqual("On High", state.attributes.get('fan_mode'))
     climate.set_fan_mode(self.hass, "On Low", ENTITY_CLIMATE)
     self.hass.block_till_done()
     state = self.hass.states.get(ENTITY_CLIMATE)
     self.assertEqual("On Low", state.attributes.get('fan_mode'))
예제 #4
0
 def test_set_fan_mode(self):
     """Test setting of new fan mode."""
     state = self.hass.states.get(ENTITY_CLIMATE)
     self.assertEqual("On High", state.attributes.get('fan_mode'))
     climate.set_fan_mode(self.hass, "On Low", ENTITY_CLIMATE)
     self.hass.pool.block_till_done()
     state = self.hass.states.get(ENTITY_CLIMATE)
     self.assertEqual("On Low", state.attributes.get('fan_mode'))
예제 #5
0
    def test_set_fan_mode_bad_attr(self):
        """Test setting fan mode without required attribute."""
        assert setup_component(self.hass, climate.DOMAIN, DEFAULT_CONFIG)

        state = self.hass.states.get(ENTITY_CLIMATE)
        self.assertEqual("low", state.attributes.get('fan_mode'))
        climate.set_fan_mode(self.hass, None, ENTITY_CLIMATE)
        self.hass.block_till_done()
        state = self.hass.states.get(ENTITY_CLIMATE)
        self.assertEqual("low", state.attributes.get('fan_mode'))
예제 #6
0
    def test_set_fan_mode_bad_attr(self):
        """Test setting fan mode without required attribute."""
        assert setup_component(self.hass, climate.DOMAIN, DEFAULT_CONFIG)

        state = self.hass.states.get(ENTITY_CLIMATE)
        self.assertEqual("low", state.attributes.get('fan_mode'))
        climate.set_fan_mode(self.hass, None, ENTITY_CLIMATE)
        self.hass.block_till_done()
        state = self.hass.states.get(ENTITY_CLIMATE)
        self.assertEqual("low", state.attributes.get('fan_mode'))
예제 #7
0
    def test_set_fan_mode(self):
        """Test setting of new fan mode."""
        assert setup_component(self.hass, climate.DOMAIN, DEFAULT_CONFIG)

        state = self.hass.states.get(ENTITY_CLIMATE)
        self.assertEqual("low", state.attributes.get('fan_mode'))
        climate.set_fan_mode(self.hass, 'high', ENTITY_CLIMATE)
        self.hass.block_till_done()
        self.mock_publish.async_publish.assert_called_once_with(
            'fan-mode-topic', 'high', 0, False)
        state = self.hass.states.get(ENTITY_CLIMATE)
        self.assertEqual('high', state.attributes.get('fan_mode'))
예제 #8
0
    def test_set_fan_mode(self):
        """Test setting of new fan mode."""
        assert setup_component(self.hass, climate.DOMAIN, DEFAULT_CONFIG)

        state = self.hass.states.get(ENTITY_CLIMATE)
        self.assertEqual("low", state.attributes.get('fan_mode'))
        climate.set_fan_mode(self.hass, 'high', ENTITY_CLIMATE)
        self.hass.block_till_done()
        self.mock_publish.async_publish.assert_called_once_with(
            'fan-mode-topic', 'high', 0, False)
        state = self.hass.states.get(ENTITY_CLIMATE)
        self.assertEqual('high', state.attributes.get('fan_mode'))
예제 #9
0
    def test_set_fan_mode_pessimistic(self):
        """Test setting of new fan mode in pessimistic mode."""
        config = copy.deepcopy(DEFAULT_CONFIG)
        config['climate']['fan_mode_state_topic'] = 'fan-state'
        assert setup_component(self.hass, climate.DOMAIN, config)

        state = self.hass.states.get(ENTITY_CLIMATE)
        self.assertEqual("low", state.attributes.get('fan_mode'))

        climate.set_fan_mode(self.hass, 'high', ENTITY_CLIMATE)
        self.hass.block_till_done()
        state = self.hass.states.get(ENTITY_CLIMATE)
        self.assertEqual("low", state.attributes.get('fan_mode'))

        fire_mqtt_message(self.hass, 'fan-state', 'high')
        self.hass.block_till_done()
        state = self.hass.states.get(ENTITY_CLIMATE)
        self.assertEqual('high', state.attributes.get('fan_mode'))

        fire_mqtt_message(self.hass, 'fan-state', 'bogus mode')
        self.hass.block_till_done()
        state = self.hass.states.get(ENTITY_CLIMATE)
        self.assertEqual('high', state.attributes.get('fan_mode'))
예제 #10
0
    def test_set_fan_mode_pessimistic(self):
        """Test setting of new fan mode in pessimistic mode."""
        config = copy.deepcopy(DEFAULT_CONFIG)
        config['climate']['fan_mode_state_topic'] = 'fan-state'
        assert setup_component(self.hass, climate.DOMAIN, config)

        state = self.hass.states.get(ENTITY_CLIMATE)
        self.assertEqual("low", state.attributes.get('fan_mode'))

        climate.set_fan_mode(self.hass, 'high', ENTITY_CLIMATE)
        self.hass.block_till_done()
        state = self.hass.states.get(ENTITY_CLIMATE)
        self.assertEqual("low", state.attributes.get('fan_mode'))

        fire_mqtt_message(self.hass, 'fan-state', 'high')
        self.hass.block_till_done()
        state = self.hass.states.get(ENTITY_CLIMATE)
        self.assertEqual('high', state.attributes.get('fan_mode'))

        fire_mqtt_message(self.hass, 'fan-state', 'bogus mode')
        self.hass.block_till_done()
        state = self.hass.states.get(ENTITY_CLIMATE)
        self.assertEqual('high', state.attributes.get('fan_mode'))