-
Notifications
You must be signed in to change notification settings - Fork 1
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
Support additional Pimoroni Enviro products #2
Comments
I wasn't aware of these new devices, thanks for bringing them to my attention. I would be happy to include support for them in this plug-in. I'm not sure it could be so generically implemented that it would work with any future device without code modifications being needed, but as long as the documentation from Pimoroni is accurate it should be possible to include support for new devices without me having to buy them all! I would place an order for a Pico Enviro+ & Pico W (once it's back in stock) I imagine the plug-in could have an MQTT client that receives periodic updates from these devices, and keeps the last received values in memory, so that when HomeKit requests the values, these can be provided. |
I have the Enviro Indoor and the new Pico Enviro+ on hand myself; I don't have the others right now. The code from Pimoroni is pretty useful / straightforward in terms of output. Here's an example of an MQTT message from the Enviro Indoor:
By contrast, at the moment the plugin assumes that the Enviro "Classic" HAT is going to run the HTTP server code which is included in this repo. That provides a JSON message that looks something like this"
The Pimoroni
(obviously those two readings taken on different days! but what I have saved locally / handy) The only thing that isn't fully matching on the Pimoroni side of the fence is a consistent MQTT topic tree, but that could easily be done via a modification to the MQTT sample to match the new Enviro formats. I'm also observing just now that the Pimoroni code is using unwrapped integer values but the homebridge-enviroplus HTTP server wraps these as strings. This does introduce an additional protocol but at the moment I feel as though it's a good solution to the fact that the new Enviro devices are intended to go to sleep for periods of time to conserve battery (if deployed that way); you could also configure them to send to an HTTP server presented by the plugin, but MQTT feels like a nicer solution to me. |
A new version of the plug-in is available that now supports fetching the data from an MQTT broker. Be sure to read the README. Fetching data from a web server is no longer supported. I will also test it with a variety of other Pimoroni sensors, once I receive them. |
Per [the change I suggested to the Pico-based Enviro code](pimoroni/enviro#2), with this change, the MQTT messages will be published with the retain flag set, so that if a consumer is not subscribed, the most recent set of readings can still be read by a future subscriber later. This supports the [homebridge-enviroplus plugin](mhawkshaw/homebridge-enviroplus#2 (comment)) better, so that a publication is more likely to exist on the topic even if the Pi with Enviroplus / this example code is not running at the time. Additional update to consider would be to align the message data formats between this sample and the newer Enviro product line.
@andypiper a new version of the plug-in is available that supports multiple Enviro+ devices on different MQTT topics (but on same MQTT broker). In addition, there's a new plug-in available that supports the Enviro Indoor device (see https://github.com/mhawkshaw/homebridge-enviroindoor). |
Is your feature request related to a problem? Please describe:
Pimoroni have recently introduced additional Enviro products, specifically that work with the Raspberry Pi Pico W with the design principle of long battery life (with deep sleep intervals) that can be distributed indoors and outdoors. They support similar but not identical sensor data to the Enviro+ HAT.
It would be ideal if this plugin could support the new products.
Describe the solution you'd like:
The Enviro+ HAT has an example long-running web server that this plugin calls; the new Pico W-based products can send data to a web server, or to an MQTT broker, but are intentionally short-running / deep sleep processes, so this would require some re-engineering. One idea would be to have this plugin support MQTT and to understand multiple sensors and topics, so that a consistent interface could be used for both the Enviro+ and the new Pico-based products.
Describe alternatives you've considered:
At the moment there are no other Homebridge plugins to support Pimoroni Enviro that I’m aware of. I have considered homebridge-mqttthing but it seems to be relatively complicated to configure.
Additional context:
I’m not sure what the HomeKit implications might be of shifting to have this plugin subscribe to MQTT topics to present the data for room sensors. In addition, the different Enviro products have different types of sensor information, so the plugin would need to be aware of the different data available to pass to HomeKit.
The text was updated successfully, but these errors were encountered: