Adding MQTT topic (a sensor) to HA dashboard

I’ve recently embarked in looking at HA. I have it added to Core and the MQTT integration is working and I can see some of my devices. All good.

I want to add one of my sensors that comes into NodeRed (I publish its data to a MQTT topic) onto a HA dashboard.

configuration.yaml includes the following:

  - platform: mqtt
    name: "GenBatt"
    state_topic: "myenergi/zappi/power"
    unit_of_measurement: "W"
    value_template: "{{ value_json['0_genbatt'] }}"

Reading on the web, I should be able to see this entity under Development Tools > States. It isn’t there. I’m assuming once it appears there, then the rest should be straight forward to add to a dashboard.

I’ve used the Developer Tools > Template utility to test my Json payload and that works.

set my_test_json =

The energy is {{ my_test_json['0_genbatt'] }}
The energy is 371

What am I missing? No errors being reported on HA - so believe the config file is correct.

Thank you.

Anyone got any thoughts on the above please?

Assuming you are seeing the information in the topic your publishing to via mqttexplorer, then you would likely have more luck asking about this in the home assistant forums. The templating/formatting can be very picky, and I don’t think anyone else here has had to implement anything in this manner yet. Congrats on being an oh-la pioneer :wink:

1 Like

Ok so it sounds like there’s nothing specific in the way that Core and HA re setup/installed to work together?

Very friendly over in the HA community… :slight_smile:
Appears the syntax has changed (I’m sure I tried this config too!).

Anyway, for anyone interested, the syntax is as below and I now can see it within the developer tools (states tab).

  - sensor:
      name: "GenBatt"
      state_topic: "myenergi/zappi/power"
      unit_of_measurement: "W"
      value_template: "{{ value_json['0_genbatt'] }}"

The only thing “special” about how they are setup is in the watchdog handling and the SSO integration. Markus did a really good job managing to tie everything together and monitor it without having to alter the core structure of the applications.

Aside from ensuring the normal support info for each instance is still valid, it also ensures (barring breaking changes) that you can run the update command to keep them current without having to wait for any CORE backed updates :slight_smile:

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.