#How to pick out a message field from an object with a random name?
1 messages · Page 1 of 1 (latest)
can you show the payload in an MQTT topic? I'm assuming it's json?
{% set key = value_json.keys() | first %}
{{ value_json.get(key, {}).get('message', 'No Message') }}
making assumptions here though
the mqtt message looks like this
valetudo/basement_dreame_x40_ultra/ValetudoEvents/valetudo_events {"a561f288-0944-423c-b698-cce7d63b44ef":{"__class":"ErrorStateValetudoEvent","metaData":{},"id":"a561f288-0944-423c-b698-cce7d63b44ef","timestamp":"2026-01-05T11:00:17.440Z","processed":false,"message":"Mop Dock Clean Water Tank empty"}}
Yah what I posted should work
As a sensor
If you’re using an mqtt trigger, it’ll be different
I'm not sure what you're referring to exactly, I'm trying to this in node-red, not as a HA automation
Oh, good luck, it's pretty easy in HA. No idea how to access it in NR
Missed the Node-Red tag
I found a way, it's quite easy with JSONata:
$contains(*.*.message, "Clean Water Tank empty")