'Test the controlling state via topic.'

def test_state_via_template(self):

    self.assertTrue(setup_component(self.hass, cover.DOMAIN, {cover.DOMAIN: {'platform': 'mqtt', 'name': 'test', 'state_topic': 'state-topic', 'command_topic': 'command-topic', 'qos': 0, 'value_template': '{{    (value    |    multiply(0.01))    |    int    }}'}}))
    state = self.hass.states.get('cover.test')
    self.assertEqual(STATE_UNKNOWN, state.state)
    fire_mqtt_message(self.hass, 'state-topic', '10000')
    self.hass.block_till_done()
    state = self.hass.states.get('cover.test')
    self.assertEqual(STATE_OPEN, state.state)
    fire_mqtt_message(self.hass, 'state-topic', '99')
    self.hass.block_till_done()
    state = self.hass.states.get('cover.test')
    self.assertEqual(STATE_CLOSED, state.state)
