-
-
Notifications
You must be signed in to change notification settings - Fork 138
Add new API endpoint via DeviceAuthenticator #987
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
base: dev
Are you sure you want to change the base?
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.
Pull Request Overview
This PR introduces an initial API endpoint for IoT control and updates the existing command infrastructure to support the new changes.
- Added a new constant PATH_API_IOT_CONTROL to define the new endpoint.
- Introduced CleanV3 and GetCleanInfoV3 command classes to use the new API endpoint.
- Updated the API request execution logic in command.py to include a new branch for the IoT control endpoint.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
deebot_client/const.py | Added new constant for the IoT control API endpoint. |
deebot_client/commands/json/clean.py | Added new command classes (CleanV3, GetCleanInfoV3) and updated CleanAreaV3 accordingly. |
deebot_client/commands/json/init.py | Updated exports to include the new CleanV3 and GetCleanInfoV3 commands. |
deebot_client/command.py | Updated API request logic to branch based on the new PATH_API_IOT_CONTROL endpoint. |
deebot_client/command.py
Outdated
headers=REQUEST_HEADERS, | ||
) | ||
|
||
elif self._api_path == PATH_API_IOT_CONTROL: |
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.
The branch for handling PATH_API_IOT_CONTROL contains placeholder values ('body = ...' and 'query_params = ...'). Please implement the actual payload and query parameters to ensure correct functionality.
Copilot uses AI. Check for mistakes.
This reverts commit eb3e1ea.
deebot_client/commands/json/error.py
Outdated
@@ -34,6 +38,12 @@ def _handle_body_data_dict( | |||
|
|||
error: int | None = 0 | |||
|
|||
if 505 in codes: |
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.
Why are you doing this??
Please add the error to the ERROR_CODES
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.
Added.
I'm not quite sure what the error means but the android app did this when pressing start:-
- send start mowing
- get error 505
- send remove error 505
- send resume
I've added an error to the codes list
deebot_client/commands/json/clean.py
Outdated
if ( | ||
state.state == State.DOCKED | ||
and self._args["act"] == CleanAction.RESUME.value | ||
): | ||
# if docked and resume, send resume... | ||
self._args = self._get_args(CleanAction.RESUME) | ||
elif ( | ||
state.state == State.DOCKED | ||
and self._args["act"] == CleanAction.START.value | ||
): | ||
self._args = self._get_args(CleanAction.START) |
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.
You are not changing the clean action in these two chases, so why have you added it here?
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.
I've removed this - it was to try fix an issue which you can replicate by:-
- click start
- click return to dock
- bot returns to dock
- click start, nothing happens
Reason: bot is docked but paused, so need to send resume or end the current job.
If bot finishes the job and returns to dock, it automatically ends current job and you can press start again.
I think we should get this PR merged for now as a base and other bugs can be fixed later.
I maybe found better solution, I need to test it next week |
"Calling api(%d/%d): %s", | ||
i + 1, | ||
MAX_RETRIES, | ||
logger_request_params, |
Check failure
Code scanning / CodeQL
Clear-text logging of sensitive information High
sensitive data (password)
_LOGGER.debug( | ||
"Error calling api %s, response=%s", logger_request_params, res | ||
"Success calling api %s, response=%s", | ||
logger_request_params, |
Check failure
Code scanning / CodeQL
Clear-text logging of sensitive information High
sensitive data (password)
return response_data | ||
|
||
_LOGGER.debug( | ||
"Error calling api %s, response=%s", logger_request_params, res |
Check failure
Code scanning / CodeQL
Clear-text logging of sensitive information High
sensitive data (password)
_LOGGER.debug("Timeout (%d) reached on path: %s", _TIMEOUT, url) | ||
raise ApiTimeoutError(path=url, timeout=_TIMEOUT) from ex | ||
except ClientResponseError as ex: | ||
_LOGGER.debug("Error: %s", logger_request_params, exc_info=True) |
Check failure
Code scanning / CodeQL
Clear-text logging of sensitive information High
sensitive data (password)
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev #987 +/- ##
==========================================
- Coverage 93.72% 93.10% -0.63%
==========================================
Files 131 131
Lines 5020 5060 +40
Branches 327 326 -1
==========================================
+ Hits 4705 4711 +6
- Misses 252 287 +35
+ Partials 63 62 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
23f1880
to
da7a42c
Compare
CodSpeed Performance ReportMerging #987 will not alter performanceComparing Summary
|
No description provided.