Stuck on ESPHome MQTT payload processing

Tags: #<Tag:0x00007f3273923888> #<Tag:0x00007f3273923770>

As simple as it might me I and struggling to find a way to get the payload message from the on_message: functions with ESPHome
All i want to do is subscribe to topic and receive a payload message that will be a valve from 0 to 255
then make it the value of a global int variable.

I have tried playing around with the lambda examples from
but had no luck with the get function returning errors.

src/main.cpp: In lambda function:
src/main.cpp:1278:11: error: ‘class esphome::Application’ has no member named ‘get_mqtt_client’
App.get_mqtt_client()->subscribe(“the/topic”, [=](const std::string &payload) {

If anyone has something that could help or an example I could learn from to do this, that would be amazing.
Thank you.