Difficulty adding custom defined MQTT Sensor - Configuration is fine, but sensors do NOT appear as entities/etc that I can display

I am having some difficulty adding custom defined MQTT Sensor.

This is Home Assistant Docker Container (Home Assistant Core ?) 2024.3.1 with Frontend 20240307.0 running under Podman (similar to Docker).

Configuration is fine, no errors reported, after tweaking it a bit.

Reloaded configuration, logs are fine, even restarted HomeAssistant.

No matter what I do, the sensors do NOT appear as entities/etc that I can display.
They are also NOT listed in States under Developer Tools.

configuration.yaml

# Loads default set of integrations. Do not remove.
default_config:

http:
#  ip_ban_enabled: true
#  login_attempts_threshold: 5
  use_x_forwarded_for: true
  trusted_proxies:
    # IP address of the proxy server
    - 192.168.0.0/16
    - 172.16.0.0/12
    - 10.0.0.0/8
    - 127.0.0.1
#    - localhost
#    - traefik
    - ::1
    - fe80::/64
    - fe00::/64
    - fd00::/64

mqtt: !include mqtt.yaml

#http:
#  ssl_certificate: /ssl/homeassistant.crt
#  ssl_key: /ssl/homeassistant.key

# Load frontend themes from the themes folder
frontend:
  themes: !include_dir_merge_named themes

automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml

mqtt.yaml

sensor:
  - name: "East Outdoor Humidity"
    device_class: "humidity"
    state_topic: "weather-station/east/loop"
    unit_of_measurement: "%"
    value_template: "{{ value_json.outHumidity | float | round(0) }}"
  - name: "East Outdoor Temperature"
    device_class: "temperature"
    state_topic: "weather-station/east/loop"
    unit_of_measurement: "°C"
    value_template: "{{ value_json.outTemperature | float | round(1) }}"
  - name: "East Outdoor Solar Radiation"
    device_class: "irradiance"
    state_topic: "weather-station/east/loop"
    unit_of_measurement: "W/m²"
    value_template: "{{ value_json.radiation_Wpm2 | float | round(0) }}"
  - name: "East Outdoor Wind Average Speed"
    device_class: "wind_speed"
    state_topic: "weather-station/east/loop"
    unit_of_measurement: "km/h"
    value_template: "{{ value_json.windSpeed_kph | float | round(1) }}"
  - name: "East Outdoor Wind Gust Speed"
    device_class: "wind_speed"
    state_topic: "weather-station/east/loop"
    unit_of_measurement: "km/h"
    value_template: "{{ value_json.windGust_kph | float | round(1) }}"

Where are these “sensors” (or “states”, “entities”, …) supposed to appear within HomeAssistant, so I can display them (e.g. as an entity, a history graph, …) ?

I read this but unfortunately it doesn’t clearly mention why entities/sensors/etc don’t show up

Do I need to add the “second” part of MQTT Sensor - Home Assistant so that these sensors are listed correctly ? Is this what is missing in my case ?

unique_id: "hp_1231232_ts_on"
device:
        name: "Heat pump"
        identifiers:
          - "hp_1231232"

Thank you for your help.

You need to restart home assistant when you use any integration configured in yaml for the first time. After that you can use reload.

I also restarted, it didn’t work either …

Indentation !
Move this whole block 2 spaces to the right, then reload manually created mqtt

Uhm … done … It was already like this when it was all part of configuration.yaml (before moving it to mqtt.yaml).

Reload: do you mean Developer Tools → YAML → Manually configured MQTT entities → Click ?

I also tried Developer Tools → YAML → All YAML configuration → Click

Nothing happens.

Where are these sensors supposed to shop up exactly ? Do I need to also specify the MQTT Broker maybe (although I already have 2 x ESPHome working, so I guess the MQTT Broker part is fine - Cannot manually add another device anyway).

You do have the mqtt integration set up, do you ?

afbeelding

and a broker. ESPHome does not use MQTT.

Yes, as I said, I am using 2 x ESPHome (with Syssi ESHome-JK-BMS code) and it works. But it doesn’t seem like I can manually add any (extra ?) device

image

Click on entities in the first screen, and search for them. There will be no device, just entities.

Nope, not there :upside_down_face:

That’s why I think there is something (maybee obvious to you all) that I’m not seeing …

Wait … maybe it’s there

I was trying to filter by “weather” (as that is part of the MQTT topic “path”) not by the entity name :sweat_smile:.

I guess yet another case of “The problem lies between the chair and the screen”. Sorry about that :disappointed_relieved:

2 Likes