-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add MQTT homeassistant sensors for air quality #13
base: master
Are you sure you want to change the base?
Add MQTT homeassistant sensors for air quality #13
Conversation
Thanks! Did a quick first pass just looking at code. I'll have to do a closer look running on device and testing it out. Specifically memory usage, and backwards compatibility with the web app. |
Blocking things to test: (I can help with this too)
Non-blocking things to figure out:
|
Keeping some notes here. If you connect the new web UI to an old bitclock FW version, you will see:
If you try to set the MQTT url: Other changes seem to work. So I think this is fine but would be nice to branch instead of error if it detects an old firmware version. But I'd need to reveal that somehow. |
If you update to new FW, and connect with new web UI, it initially doesn't work at all https://github.com/goat-hill/bitclock/tree/master/bitclock-fw#bluetooth-gatt-attributes Once you "Forget this device" and re-pair there are no errors. But something to think about communicating if people update. |
Annoyingly I think we're running out of memory when parsing the weather API now with cJSON. I bet we were close to the limit and this MQTT stuff pushed us over :(
I'll have to poke around for ways to reduce memory usage. |
Had to throw a ton of changes in here, mostly because the weather API is extremely expensive to the heap right now. It uses about 30kB via the cJSON library to parse the 17kB giant response from api.weather.gov. I made a bunch of other tweaks in my testing that leaves about 3kB worst case of extra headroom. Not great because a small weather.api.gov change could push things over the limit. Long term fix would be to use a streaming parser of JSON instead of a one-shot one. Those are harder to implement but way less memory intensive. https://components.espressif.com/components/espressif/jsmn instead of cJSON |
Adds support for homeassistant sensor discovery and state reporting via MQTT
mqtt://user:[email protected]
)Notes:
Relevant home assistant docs for MQTT based sensor discovery:
Happy thanksgiving 🦃