Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 105701

MQTT json data parse specific value to sensor

$
0
0

@kslb wrote:

Hi,

I need help with configuring sensor which receive data from MQTT.

So, when I listen to MQTT broker:
image

I get data like this:

Sporočilo 0 prejeto v OilFox ob 8:32:
{
...
    "devices": [
        {
...
            "measurementIntervalInSeconds": 86400,
            "metering": {
                "value": 12,
                "fillingPercentage": 95,
                "liters": 1803,
                "currentOilHeight": 134,
                "serverDate": 1589813339698,
                "battery": 100
            },
...
            }
        }
    ]
}

So how to configure sensor that I read specific data (in my case “liters”) which need be readed as integer type…

  - platform: mqtt
    name: "Trenutni nivo olja"
    state_topic: "OilFox"
    value_template: '{{ value_json.devices[0].metering[0].liters | int }}'
    icon: mdi:hydraulic-oil-level
    unit_of_measurement: L

THANK YOU for help…

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 105701

Trending Articles