-
Notifications
You must be signed in to change notification settings - Fork 0
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
275 add co2 sensor support to smibhid #276
base: master
Are you sure you want to change the base?
Conversation
Added BME280 module for easier testing. |
Just tried some tests without any modules installed as I don't have any yet.
|
Not great at tinyweb/flask so have yet to really look at that, is a valid finding. But we could choose to add to a new issue to improve rather than adding complexity to this one given how big it has already grown. Any ideas how to modify the website.py file to achieve this? |
Personally I would suggest a layout more like this, grouping things better? You may disagree
|
R.e. the 404 thing looks like if you do the following a 404 error is returned correctly. I tested it with a broad try/except but the KeyError looks to be the exception that gets triggered. from http.webserver import HTTPException
...
...
...
class Modules():
def get(self, data, sensors, logger: uLogger) -> str:
logger.info("API request - sensors/modules")
try:
html = dumps(sensors.get_modules())
logger.info(f"Return value: {html}")
except KeyError:
raise HTTPException(404)
return html |
Add capability to add sensor modules on I2C that will poll on async loop and present their module information and readings on the API.
Fixed I2C not being defined at HID and main level to prevent incorrectly specifying different I2C parameters across the code.
Fixed updater crashing if the updates folder is not present.