Templating for data with a dot

I am scratching my head on the following: I have a SDS011 sensor on a Tasmota Wemos D1. This spits out the following throught MQTT:

{“Time”:“2019-02-10T08:29:38”,“BMP180”:{“Temperature”:19.4,“Pressure”:987.7},“SHT3X-0x45”:{“Temperature”:19.7,“Humidity”:46.8},“SDS0X1”:{“PM2.5”:1.6,“PM10”:4.6},“PressureUnit”:“hPa”,“TempUnit”:“C”}

I can extract the PM10 value through:
value_template: “{{ value_json[‘SDS0X1’].PM10 }}”

But the problem is that the PM2.5 value looks impossible to extract as value due to the dot.

Any thoughts on how I can get the PM2.5 value through a template?

Does this work?

value_template: "{{ value_json['SDS0X1']['PM2.5'] }}"
1 Like

That only results in ‘status unknown’…

How about:

value_template: "{{ value_json['SDS0X1'].['PM2.5'] }}"
1 Like

Apologies! Due to an error from my end (wrong topic) the previous suggestion didn’t work. After correcting it the right syntax is as you indicated: value_template: “{{ value_json[‘SDS0X1’][‘PM2.5’] }}”

Thanks for your help!

2 Likes

Glad to hear it. That square bracket syntax always confuses me so I wasn’t quite sure.

Hello Frank , can you add full SDS011 sensor yaml configuration? Thanks.