Templates and theirs syntax

I have a question regarding templates: Is there somewhere a newbie-suitable documentation about its syntax, etc.? You have a link for it?

I have the following problem: I have a tasmota sensor which yields via MQTT the following data:

{"Time":"2026-01-17T21:50:57","RfReceived":{"Sync":23168,"Low":924,"High":2434,"Data":"XXXXXX","RfKey":"None"}}

and I’m interested in the content of the Data-field. As I understood this should be extracted by a template like this:

{{value_json.RFReceived.Data}})

However this leads to an error in HA-Core:

Protokolldetails (FEHLER)

Logger: homeassistant.helpers.template
Quelle: helpers/template/__init__.py:640
Erstmals aufgetreten: 17. Januar 2026 um 21:50:58 (6 Vorkommnisse)
Zuletzt protokolliert: 17. Januar 2026 um 21:51:13

    Error parsing value: 'dict object' has no attribute 'RFReceived' (value: {"Time":"2026-01-17T21:50:57","RfReceived":{"Sync":23168,"Low":924,"High":2434,"Data":"XXXXXX","RfKey":"None"}}, template: {{value_json.RFReceived.Data}})

What the heck is wrong here? What must be corrected? I’m afraid I still have too little knowledge about templates and I would like to learn about it. Any help?

BR

Don

Please show where/how you are using the supplied template… we need the context to give advice.

As said. I have a tasmota device which returns the following in certain conditions:

{"Time":"2026-01-17T21:50:57","RfReceived":{"Sync":23168,"Low":924,"High":2434,"Data":"XXXXXX","RfKey":"None"}}

I’m specifically interested in the content of Data and I thought a template was suitable to extract it. The template cited here was one i came up with myself. Unfortunately it seems to be wrong, as it results in the logged error. So the question is, what would be correct way to grab the content of Data. I hope it became clear now.

BR

Don

Unfortunately, no.

What is clear is that you have an MQTT payload that you want to extract data from, but MQTT messages can be handled a lot of different ways in HA…

Are you using the Tasmota integration, or trying to set up a standalone MQTT Sensor, or using an automation or trigger-based template sensor with an MQTT trigger, or something else?

Hello Don-Pedro,

I have some of these in my config… Made them years ago.
I don’t template them, just push and pull them from MQTT directly.

It’s case sensitive:
{{ value_json.RfReceived.Data }}

I am completely confused with json notations, so I use a json formatter tool to expand the data. It makes it easier to visualize what’s going on.

{"Time":"2026-01-17T21:50:57","RfReceived":{"Sync":23168,"Low":924,"High":2434,"Data":"XXXXXX","RfKey":"None"}}

formats to

{
   "Time":"2026-01-17T21:50:57",
   "RfReceived":{
      "Sync":23168,
      "Low":924,
      "High":2434,
      "Data":"XXXXXX",
      "RfKey":"None"
   }
}

This is where I saw the case problem (RFR vs RfR).

Another tool that helps me a lot is developers tools → templates. Here you can experiment all you wish to find the proper use of a template.

First, I load the variable value_json into the template tool:

{% set value_json = {
   "Time":"2026-01-17T21:50:57",
   "RfReceived":{
      "Sync":23168,
      "Low":924,
      "High":2434,
      "Data":"XXXXXX",
      "RfKey":"None"
    }
  }
%}

Then test the template:
{{ value_json.RfReceived.Data }}

1 Like
Error parsing value: 'dict object' has no attribute 'RFReceived' (value: {"Time":"2026-01-17T21:50:57","RfReceived":{"Sync":23168,"Low":924,"High":2434,"Data":"XXXXXX","RfKey":"None"}}, template: {{value_json.RFReceived.Data}})
-----------------------------------------------------^^-------------------------------------------------^^

The answer was in the error message: just need to look really carefully!

Note that it’s safer to use bracket notation, so:

{{ value_json['RfReceived']['Data'] }}

That syntax is immune to issues with keys starting with digits, or reserved keywords like values.

1 Like

Yes, that was in fact the problem! After changing upper to lower case it suddenly started working. Oh man, an unrecognized case problem!