-
-
Notifications
You must be signed in to change notification settings - Fork 35k
Add SensorPush Cloud integration #134223
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 SensorPush Cloud integration #134223
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for putting in the effort and going for a second attempt at this! However, I see the libraries are not compliant yet as, sensorpush-api
's source code is not public and under an OSI approved license https://developers.home-assistant.io/docs/core/integration-quality-scale/rules/dependency-transparency
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
Thanks! The source code for the Python library is public (I'm the author), however you are correct that the license is not OSI approved. I could use some advice here if you don't mind. OpenAPI generated the original source, which I then modified to work with HA. The license information was generated based on information in the Swagger definition, which references SensorPush's EULA. What have other authors done in this case? |
I could only find the -ha lib on GitHub. The other one I could only find on PyPi but not in a repo. I guess most will publish to a repo and adapt the license there |
Huh, that's odd. You should be able to find both libraries on PyPI: I'll work on re-licensing sensorpush-api in the meantime. I suspect this is just an artifact of OpenAPI. |
Yes on PyPi. But that’s not a code repo (like GitHub). You'll need to put the code (+releases & CICD) there as well. |
Ah! That's strange, I'm not sure why the repository link is absent. I'll look into it. Everything is on GitHub and releases are managed by CI/CD: |
Hi @zweckj - I've corrected the license terms for |
I've sanded down a few more edges and made another pass at cleanup. The PR should be ready for review. Thanks in advance! |
I believe I've addressed all of the review feedback so far. The PR should be ready for another round. Thanks again for the detailed feedback - it is much appreciated! |
Rebased and made minor corrections to quality scale for documentation. |
Will do! |
Thanks again @zweckj! I've incorporated your suggestions, updated the branch, and put the PR up for review. |
except SensorPushCloudError: | ||
LOGGER.exception("Invalid authentication") | ||
errors["base"] = "invalid_auth" | ||
except Exception: # noqa: BLE001 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it shouldn't though as you have a LOGGER.exception
there
see https://docs.astral.sh/ruff/rules/blind-except/ at the bottom
@zweckj Requested changes have been incorporated into the documentation and this PR. Thanks again for the feedback! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, let's see if Joost has some final remarks
@joostlek No rush, I just want to keep the PR from going stale. |
@joostlek any chance this PR could make it into the feb release? Would be 🚀 |
Nope, it's a new feature. I wanted to look at it again this week, but the days before beta were too busy to find time |
I see. If it's of any help I've been running iterations of this code since last summer with 19 sensors. |
Any chance this could make it into the next release? |
Hey @joostlek - it looks like I need to update the documentation PR since this isn't being considered for 2025.02. Do you have an idea of which release I should target? Thanks again! |
Dw about that, we'll fix that if needed |
Sounds good. Thanks! |
Thanks @zweckj! I've rebased the branch and pulled in changes from the dev branch. Would it be possible to approve a workflow run for the PR? Thanks again! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Last things
except SensorPushCloudError: | ||
LOGGER.exception("Invalid authentication") | ||
errors["base"] = "invalid_auth" | ||
except Exception: # noqa: BLE001 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ruff indeed does not see that the logger is a logger, I already opened astral-sh/ruff#15473 for that
@joostlek Requested changes have been made. I was able to clean up authentication in the library. Thanks again for the detailed review feedback! |
@joostlek Circling back around - is there anything else I can do get this ready to go? |
@sstallion Be sure to send me a message on discord |
Will do. Thanks again! |
Proposed change
This PR adds cloud integration for SensorPush devices. It communicates with the publicly available Cloud API using the sensorpush-api and sensorpush-ha Python packages. Care was taken to ensure that presented devices appeared the same as those created by the existing SensorPush integration. A G1 WiFi Gateway is required to make use of the Cloud API.
Note
This PR is a re-submission of #121890, which fixes several issues reported by reviewers. I would like to send a heartfelt apology to @joostlek, @edenhaus, and @frenck - I was caught between dueling schedules and I wasn't able to do the work needed to get it over the finish line. I was finally able to put in the time over the holiday break to make requested changes in addition to improved unit tests, strict typing, async dependencies, and websession injection (whew!)
Type of change
Additional information
Checklist
ruff format homeassistant tests
)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest
.requirements_all.txt
.Updated by running
python3 -m script.gen_requirements_all
.To help with the load of incoming pull requests: