Hey,
I receive my meter reading via MQTT and want to display it in Home Assistant (HAS). Now I have the problem that my gas meter outputs “10350420” as m³, but in HAS is nothing to see.
MQTT Output:
{
"MBusData": {
"SlaveInformation": {
"Id": "33437569",
"Manufacturer": "ELS",
"Version": "129",
"ProductName": null,
"Medium": "Gas",
"AccessNumber": "20",
"Status": "00",
"Signature": "0000"
},
"DataRecord": {
"_id": "0",
"Function": "Instantaneous value",
"StorageNumber": "0",
"Unit": "Volume (m m^3)",
"Value": "10350420",
"Timestamp": "2023-04-29T09:45:12Z"
}
}
}
HAS Config:
- name: "Erdgas"
unique_id: mbusmeters.gas
state_topic: "mbusmeters/3343756993158103"
unit_of_measurement: "m³"
device_class: "GAS"
state_class: "total_increasing"
value_template: >
{%- for rec in value_json.MBusData.DataRecord -%}
{%- if (
( rec.Function == "Instantaneous value" )
and ( rec.StorageNumber == "0" )
) -%}
{{ rec.Value }}
{% endif -%}
{% endfor -%}