MQTT Message value issue

Hello,
I am stuck trying to extract a value from MQTT and placing in a sensor,I can do this for other MQTT messages but not this one, I have tried using value template as well but just not working.

The message in MQTT explorer is, House/Outside/Temperature with a Value of:
{
“OAT”: 11.645820617675781
}

My Sensor.yaml has the below entry:

  • platform: mqtt
    name: “OAT”
    state_topic: “House/Outside/Temperature”
    value_template: ‘{{ value.data.OAT }}’ # Outputting data from a topic.

The output I receive on my dashboard / button is this:
Unknown

Change this:

value_template: '{{ value.data.OAT }}'

To

value_template: '{{ value_json.OAT }}'

Also you have been a member of the forum for nearly a year. I should not have to remind you why it is important to format your post correctly.

Hi Tom,
That worked great thank you, I thought I have already done that but obviously not.
I now get a value of 11.976997375488281, how would I reduce the number of decimal places to something like 11.98 ?

Hi Tom,
Actually I just thought to add “| round(2)”

It all works just as needed, thanks for your assistance.

Hopefully this will be of assistance to others