daniloc / PicoW_HomeAssistant_Starter

Everything you need to get started with your own Intranet of Things, using the high-quality, low-cost Pico W as the backbone.
MIT License
198 stars 20 forks source link

HAMqtt::etDataPrefix() misses some cases (avty_t = online) #17

Open JacobChrist opened 11 months ago

JacobChrist commented 11 months ago

mqtt.setDataPrefix("plp") misses some cases. Here you can see I end up with an "aha" node which means that this is probably hardcoded somewhere (or set prior to changing the prefix). This is probably a bug in the AHA but I know you have forked this as well and I'm using your fork.

image

avty_t = online

JacobChrist commented 11 months ago

Figured out a work around. The mqtt.setDataPrefix() needs to be called before device.enableSharedAvailability() and device.enableLastWill(). Apparently the message gets buffered until the mqtt connection is made.

So I'm not really sure if this is an issue or just a call order requirement. This seems like a similar issue #13 in that the order in which you do things is important but but not clear by function naming. Maybe the best thing to so is to improve the example project so that its documented well in code.

daniloc commented 11 months ago

Do the a-h-a project a solid, check their issues, and if this isn't already in there, document this with them, will ya? The author has gone quiet for the last year but he's put quite a bit of work in over time. If he gets time to come back to it, it would help him to know where the foot guns are.