def test_state_attributes_current_position(self):
        self.hass.config.components = ['mqtt']
        assert _setup_component(self.hass, rollershutter.DOMAIN, {
            rollershutter.DOMAIN: {
                'platform': 'mqtt',
                'name': 'test',
                'state_topic': 'state-topic',
                'command_topic': 'command-topic',
                'payload_up': 'UP',
                'payload_down': 'DOWN',
                'payload_stop': 'STOP'
            }
        })

        state_attributes_dict = self.hass.states.get(
            'rollershutter.test').attributes
        self.assertFalse('current_position' in state_attributes_dict)

        fire_mqtt_message(self.hass, 'state-topic', '0')
        self.hass.pool.block_till_done()
        current_position = self.hass.states.get(
            'rollershutter.test').attributes['current_position']
        self.assertEqual(0, current_position)

        fire_mqtt_message(self.hass, 'state-topic', '50')
        self.hass.pool.block_till_done()
        current_position = self.hass.states.get(
            'rollershutter.test').attributes['current_position']
        self.assertEqual(50, current_position)

        fire_mqtt_message(self.hass, 'state-topic', '101')
        self.hass.pool.block_till_done()
        current_position = self.hass.states.get(
            'rollershutter.test').attributes['current_position']
        self.assertEqual(50, current_position)

        fire_mqtt_message(self.hass, 'state-topic', 'non-numeric')
        self.hass.pool.block_till_done()
        current_position = self.hass.states.get(
            'rollershutter.test').attributes['current_position']
        self.assertEqual(50, current_position)
Test the current position.
dataset/ETHPy150Open home-assistant/home-assistant/tests/components/rollershutter/test_mqtt.py/TestRollershutterMQTT.test_state_attributes_current_position