Custom MQTT Sensors not showing as entities

Hello everyone.
I have been strugling for hour with setting some custom sensors which I want to use for analytics. I have made a ESP32 sketch where I publish some data (as strings) on a few topics. I see that I can read those topics with my phone and also inside HA by subscribing, but I can’t find the entities for those sensors after modifying the YAML.

Here is my configuration

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

# 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
# sensor: !include_dir_merge_list sensor
mqtt: !include_dir_merge_named mqtt

And the included file mqtt/sensors.yaml:

sensor:
    - name: "Solar Batery Stored Energy"
      unique_id: "solar_batery_stored_energy"
      state_topic: "solar/bat_stored_energy"
      unit_of_measurement: "%"
      
    - name: "Solar Batery Temperature"
      unique_id: "solar_batery_temperature"
      state_topic: "solar/bat_temperature"
      unit_of_measurement: "°C"
      device_class: "temperature"
      
    - name: "Solar Photovoltaic Power"
      unique_id: "solar_photovoltaic_power"
      state_topic: "solar/pv_power"
      unit_of_measurement: "W"
      device_class: "power"

After setting this nothing appears as entity. Restarted a low of time and nothing, no errors in the log either. Incidentally, I can produce errors in the log by, for example, setting device_class as “powerasd” and it will trhow errors or warnings, meaning that it’s actually reading and parsing the files. Yet, nothing to be seen on the developers>states tab

Any hint on what’s missing? I never expected this to be complicated, but I have read a lot of post about this topic, with no avail.

Thanks

IIRC, the sensors will only first appear when a value is actually published on MQTT.

They are already publishing, and the broker is distributing the data to the subcriptors. It’s kind of annoying as I can’t really figure the source of the problem. The log indicates that the sensors are being read but no entity appears to be used in automations.

Quite folishly, I closed my computer. After opening and restarting the PC now I can see the entities. It seems it needs a browser refresh, but I don’t know how to replicate this. It took me 5 hours to luckily get the result I needed and now I can read all the topics of the MQTT brokers as expected since the begining.

Hi daniel-blackbeard,

If you add a new integration, HA requires a restart to get it loaded into memory. Happens with all integrations.

If one of the suggestions listed solves your problem, please consider clicking the solution button to close the thread. (even your own…)