Beispiel #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'))
Beispiel #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'))
Beispiel #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'))
Beispiel #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'))
    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'))
Beispiel #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'))
    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'))
Beispiel #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'))
    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'))
Beispiel #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'))