Sensor state: '{"value": "OK"}'

Hi,

My rflink-mqtt gateway passes the correct values ​​but with “value” included in state. I’m probably doing something wrong with the template_value, but I can not figure this out. Can someone help me?

MQTT Log;
2019-02-14 17:43:09,901 - RFLinkGW.MQTTClient - publish - DEBUG - Sending:{‘method’: ‘publish’, ‘topic’: ‘Cresta/2601/READ/TEMP’, ‘family’: ‘Cresta’, ‘deviceId’: ‘2601’, ‘param’: ‘TEMP’, ‘payload’: ‘{“value”: 5.2}’, ‘qos’: 1, ‘timestamp’: 1550166188.9366376}

3245890

Show the sensor setting plz

sensor:

  • platform: mqtt
    name: “Temperatuur Serre”
    state_topic: “/rflink/Cresta/3F01/R/TEMP”
    unit_of_measurement: ‘°C’
    value_template: “{{ value_json }}”

The problem is a nested JSON.
Templating can’t handle nested JSON’s, that’s why you see a json as a value.
Best way to deal with this is to have the nested json as an attribute of you sensor.
With another template sensor you’re able to parse the json for the temperature.

Does {{ value_json["value"] }} not work in a value_template?

1 Like

Great!!! Thanks it worked :smiley: