Mqtt state empty

Hi,

i’m working with Home Assisntant for quite a while now. I love it :slight_smile:

Now i came into a situation where i was even unable to find anything usefull on the net.

I have the following scenario:

I created an mqtt sensor for a very basic mqtt message:

- platform: mqtt
  state_topic: "my/topic"
  name: "Time to event"
  expire_after: 2400

The my/topic message will populate every 15 minutes and the payload is a plain string like “2 weeks” or “10 days”

The configuration itself works great. If the message gets send everything is displayed correctly. But after around 2 - 5 minutes the state of the sensor turns to empty. (not unavailable!)

What did i miss here? I have another mqtt sensor which sends floats only in the same way and this one is correct over the whole time.

Thanks for your help!

Tobias

Maybe try to add force_update ?
It could be 15min between updates is too much for HA

@koying i already tried that. What makes me wonder is that it works with the other sensor

Are your MQTT messages “retained” ?
All of mine are, so not sure what happens if they are not…

okay my fault just a stupid mistake while generating the data. I was always testing in bash and then scheduled it via cron. What i didn’t thought of is that in a cron env there is no “terminal”. The generation itself exec a command in docker so to do this instead of

docker exec -it container "echo hello"

it has to be (non interactive)

docker exec container "echo hello"

So totally not Home assistant related :slight_smile: