Lovelace card does not display any values from MQTT client

Hi Friends!

I am trying to display readins from current sensors in HA.

Data are sent from from ESP8266 with Tasmota over MQTT to HA.

I can read the data in HA using MQTT listening:

{
    "SSerialReceived": {

        "I1": 0.07,
        "I2": 0.02,
        "I3": 0.01,
        "I4": 0.03
    }
}

Auto discovery did not wor so I created sensor entities manualy:

sensor:
  - platform: mqtt
    name: I1
    unique_id: "I1"
    state_topic: "tryskac/zatizeni/RESULT"
    unit_of_measurement: 'Amp' 
    value_template: "{{ value_json.I1 }}"
  - platform: mqtt
    name: I2
    unique_id: "I2"
    state_topic: "tryskac/zatizeni/RESULT"
    unit_of_measurement: 'Amp' 
    value_template: "{{ value_json.I2 }}"
  - platform: mqtt
    name: I3
    unique_id: "I3"
    state_topic: "tryskac/zatizeni/RESULT"
    unit_of_measurement: 'Amp' 
    value_template: "{{ value_json.I3 }}"
  - platform: mqtt
    name: I4
    unique_id: "I4"
    state_topic: "tryskac/zatizeni/RESULT"
    unit_of_measurement: 'Amp' 
    value_template: "{{ value_json.I4 }}"

Sensor entities have been created

I created lovelace sensor cards:

But no any values are displayed.

I am playing with it couple of days and became desperate.

Any idea what could be wrong?

Based on the structure of the received JSON payload, the current value should be extracted like this:

    value_template: "{{ value_json.SSerialReceived.I1 }}"

Here’s the proof:

2 Likes

Fantastic ! It works now! Many thanks for your help !

1 Like

Glad to hear it works now.

Please mark my previous post with the Solution tag. Only you, the author of this topic, can do that. It will automatically place a check-mark next to the topic’s title, thereby signaling to other users (who may have a similar question) that this topic has an accepted solution.

1 Like

all done. Your help is very appreciated !

1 Like