MQTT Json attribute value unavailable (smartmeter)

Hi everyone,

I am new to HA and want to integrate my SmartMeter (Running with Tasmota over MQTT).

First I read the documentation about MQTT Sensors and add the following config zu my configuration.yml. I was testing a lot of configurations and get it working without errors BUT the value is always “unavailable”.

mqtt:
  sensor:
    - name: "Stromzaehler Watt"
      unit_of_measurement: "W"
      device_class: power
      state_topic: "tasmota/stromzaehler/tele/SENSOR"
      json_attributes_topic: "{{value_json.SML.curr_w}}"
      force_update: true
      value_template: "{{value_json.SML.curr_w}}"
      availability:
        - topic: "tasmota/stromzaehler/tele/STATE"
      payload_available: "online"
      payload_not_available: "offline"
      unique_id: stromzaehler_current
      device:
        name: "Stromzaehler"
        identifiers:
          - "stromzaehler_1"
    
      

Now after some hours of testing, I don’t know how to fix this. I added some screenshots. I can see my values in the mqtt information and no error is thrown. Does anyone have an idea why my values are not set?

I tested, with and without json_attribute_topic, with and without force_update. I added a unique_id and a device, but nothing helped.

Thanks and Kind regards
Tobi

I couldn’t find a topic which helps me. If there is one, let me know.

Hello Tobi,

You probably need to see what values are in your MQTT Broker to know what you are doing.
Troubleshooting MQTT? MQTT-Explorer can help you be successful!
If you have Add-ons available, try adding this Add-on repository to your Add-on list. GitHub - GollumDom/addon-repository.

Hi @Sir_Goodenough,

thanks for your response. Yeah first I thought I justed miss something in my JSON. But I don’t get errors that the path is wrong or other errors in the protocol.

I don’t know why but after I removed the “availability” part it’s working. :see_no_evil:

My working config:

 - name: "Stromzaehler Watt"
      state_topic: "tasmota/stromzaehler/tele/SENSOR"
      value_template: "{{value_json.SML.curr_w}}"
      unique_id: stromzaehler_current
      device_class: power
      unit_of_measurement: "W"
      device:
        name: "Stromzaehler"
        identifiers:
          - "stromzaehler"

Thanks

Aaahh.
Usually the topic for availability is the LWT topic. It would not be the state topic, that holds your actual value. Means last will and testament. It tells everything when it dies.

1 Like