More Home Assistant discovery problems - still a mystery to me

Whilst working on another project I’ve had to restart Home Assistant multiple times today I’m not sure if this is connected but at some time during all of this restarting, all three of my gateways went offline to Home Assistant.

I published {“disc”:true} to each of the gateways (eg homeassistant/433OOKtoMQTT/commands/MQTTtoSYS/config) and they all re-appeared back.

But, all of the sensors that I was using from each gateway are all showing as unavailable.
I can see that they are updating topics in mqtt explorer, but Home Assistant is just not seeing them.

I’m still not sure what’s going on at all, most frustrating :frowning:

I’m a bit worried about this, is this the topic you used ?

homeassistant first topic is used by the discovery, I would suggest using a different topic for the value publication, like home the default

If not you are mixing the messages for creating the devices with the messages containing the data.

Try to restart the gateways and check in the Devices panel if you see them.

Ok I’ll change one thing at a time and see what happens - yes I did at one point change from home to homeassistant, I will change it back.

Either changing the topic or restarting has brought back the sensors, except one. The pesky oil level monitor only transmits once every 30 minutes.

Interesting that you have a sensor transmitting every 30 minutes, you will need to have discovery activated while it transmits.
For this you can check when the sensor transmitted last time (with mqtt explorer for example), add 30 minutes, and activate auto discovery a few minutes before.

2 out of the 3 gateways are re-sending all of the sensors I am interested in, but the FSK build is still not. I have enabled discovery 5 or 6 times now and nothing appears. Each time this happens a re-flash seems to solve the problem. I can’t find the exact reproduction but I’m sure there’s something strange going on with the 1.7.0 Lilygo FSK build.

I will have another go to see if I can see anything on the serial port. Can I do this via usb or do I need to connect directly to the uart on the Tx Rx pins? I tried via usb last time and could not see any logging.

You can do by USB (115200 bps), you can also access to the gateway web portal to see the logs (Console)

Ah, thanks, From an earlier discussion we had I thought serial might have more info.

Should the FSK build report ookthreshold, I guess it’s not used?

/RFtoMQTT msg {“active”:3,“frequency”:433.92,“rssithreshold”:-92,“rssi”:-98,“avgrssi”:-101,“count”:367,“ookthreshold”:15}

I know there are multiple FSK transmitters around (all of them oil watchman senders), but none of them are being picked up. What could it be - it feels like there’s a key property not being initialised or something.

Something that re-flash resets.

Restarting Home Assistant definitely causes all of the gateways to disappear. Shouldn’t the auto discovery mqtt topics be persistent?

They are persistent, and when restarting HA they should still be here.
When you check the topic into homeassistant do they have a RETAIN flag?

Which MQTT broker are you using? Possibly a built in Home Assistant Add-on one, which also restarts when restarting Home Assistant.
If it also isn’t set to write its persistent messages to disk to be able to reload them after a restart, but only keeps them in RAM, that could well be the reason for them disappearing with every HA restart.

1 Like

Mosquitto, in a separate container. But, good point, because the last time I actually did have to restart the whole server. But that’s the first time I’ve restarted Mosquitto in weeks.

Very few topics appear to have retain. Here’s one that does: homeassistant/433OOKtoMQTT/LWT

Where is the 433OOKtoMQTT coming from, and any LWT messages should not actually be under the homeassistant topic, which is purely for discovery.

I have the feeling that some topics you might have reassigned are all muddled up. Did you change any of these and for any particular reason?

Did you create custom environments for building and uploading your gateways? Or did you possibly make some topics changes in the WebUI or my MQTT command?

433OOKtoMQTT is my name for the gateway. And yes it’s possible things are messed up. I had renamed the home/ topic to homeassistant/, but now I renamed it back to home/. I guess I could delete all the topics and start again, but, the only reason I changed things before was because things were not working as I expected…

I think that might be the best idea to start again, as even with renaming things back right now might still miss a small part here or there.

I would also suggest to give your gateway(s) a slightly different name, as any XXXtoMQTT sub topics are actually sub topics where the actual continuous device messages are under. Not that there is such an actual 433OOKtoMQTT message sub topic, but it can make things even more confusing.

When you start from scratch and refrain from touching and changing any topic related settings you should be fine with all discovery messages going under the pre-set default homeassistant topic and being retained, while all LWT messages will be under the home/gateway_name topic which also has the appropriate XXXtoMQTT sub topic containing all the device messages.

Thanks for the pointers, will clear everything down, start again and report back.

Things look like the are behaving now, thank you very much. It seems my choice of gateway names and base topic messed things up in many subtle ways. I’ll suggest adding some (more) notes to the docs once I’ve run it all for a while.

2 Likes