Sensor not available

- platform: bme280_ic2

    address: 0x76

    internal: true

    update_interval: 2s

    temperature:

      name: "Temperature"

      id: bme280_temperature

   on_value:

      - mqtt.publish:

          topic: /sensors/whatever/bmetemperature

          payload: id(bme280_temperature).state

What about this for a workaround. You make the bmp sensor internal then only publish on_value to mqtt. You would have to create the sensor in mqtt on Ha. Ignore my indentation errors as im typing on my phone.

Consider trying this first.

Thanks for posting your configuration in the other thread (Battery powered: How to read sensors on boot, send them once, and immediately enter deep sleep? - #10 by Spiro) - mine does not look too different… Thus I do not understand what’s the problem.
I’ll adopt this early deep sleep and possibly also powering the bme via a gpio, that is a neat addition, thanks!

I just did but still the same…

I cannot get this to work either :confused:

The values are send correctly to mqtt but the device always appears as “not available” afterwards.

eh wait, this is weird! As i reverted the changes I made with the manual mqtt.publish, the temperature sensor came back (I tested it only for that entity).
Seems like re-installing the sensors in HA might resolve this issue? Is there a way to trigger this somehow without actually deleting the entities?

edit: okay, I think I got it. I used “Clean MQTT” on the device and reinstalled it.
It seems like all entities still got the historic data but are now longer unavailable!

indeed, but it works again since I ran the Clean MQTT :man_shrugging:

Well… 2024.3.1 and the problem is back yet again. :frowning:

image

you can cleary see when I installed the update…

This time Clean MQTT did not help at all, however it also prints no topics there… just “connected to MQTT broker” and thats it.

In the log I see now several warnings like these:

[06:36:28][W][wifi:152]: Warning set: unspecified
[06:36:50][W][mqtt:152]: Warning set: unspecified
[06:36:50][W][wifi:165]: Warning cleared
[06:36:50][W][api:152]: Warning set: unspecified
[06:36:51][W][mqtt:165]: Warning cleared
[06:36:53][W][api:165]: Warning cleared

What are these? Are these related to the problem?

EDIT: what however helps is to comment out all sensors in the yml, install it, then add everything back in and install it again. Now, the sensors are back and do not show unavailable.

Now I’m lost… I fixed the issue caused by the esphome update by flashing a firmware without sensors and re-flashing it with the sensors again.
However, now the sensor turned into unavailable state without any updates of hacore, esphome or anything else… What the heck?

There must be a reason for the sensor to turn unavailable, does anyone has an idea what is happening?

Installing home assistant OS 12.2 fixed it: the sensor is now available again.

I now really have no clue why it works again :confused: Maybe all it needed was a full reboot? (I restarted HA several times in between, which would not fix it…)