Hey everyone,
i’ve been searching for a solution for quite some time now, but it seems i’m still lacking the unterstanding of how to solve my issue.
My Log show some errors when parsing values delivered by MQTT:
2025-01-01 20:49:01.469 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: 'value_json' is undefined when rendering '{{ (value_json.MBusData.DataRecord[1].Value) }}'
2025-01-01 20:49:01.472 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: 'value_json' is undefined when rendering '{{ (value_json.MBusData.DataRecord[1].Value) }}'
The MQTT Explorer shows the following values for my Watermeter:
{
"MBusData": {
"SlaveInformation": {
"Id": "123456789",
"Manufacturer": "GWF",
"Version": "60",
"ProductName": null,
"Medium": "Water",
"AccessNumber": "188",
"Status": "00",
"Signature": "0000"
},
"DataRecord": [
{
"_id": "0",
"Function": "Instantaneous value",
"StorageNumber": "0",
"Unit": "Fabrication number",
"Value": "123456789",
"Timestamp": "2024-12-13T19:48:33Z"
},
{
"_id": "1",
"Function": "Instantaneous value",
"StorageNumber": "0",
"Unit": "Volume (m m^3)",
"Value": "98202",
"Timestamp": "2024-12-13T19:48:33Z"
}
]
}
}
Json can be validated successful.
The configuration in my yaml is:
mqtt:
sensor:
- unique_id: mbusmeters.123456789
name: "Wasserzähler"
state_topic: "mbusmeters/123456789"
value_template: "{{ (value_json.MBusData.DataRecord[1].Value) }}"
unit_of_measurement: "l"
The sensor values are processed correctly and all values are stored and displayed in the frontend.
So it is “just” an logging issue, but still something i want to get rid off.
Can someone help with this or push me into the right direction?
Any help is appreciated.