'Test the setting of the value via MQTT with JSON playload.'

def test_setting_sensor_value_via_mqtt_json_message(self):

    mock_component(self.hass, 'mqtt')
    assert setup_component(self.hass, sensor.DOMAIN, {sensor.DOMAIN: {'platform': 'mqtt', 'name': 'test', 'state_topic': 'test-topic', 'unit_of_measurement': 'fav    unit', 'value_template': '{{    value_json.val    }}'}})
    fire_mqtt_message(self.hass, 'test-topic', '{    "val":    "100"    }')
    self.hass.block_till_done()
    state = self.hass.states.get('sensor.test')
    self.assertEqual('100', state.state)
