Skip to content

Solves issue with deviceRefreshStatus method usage (#1217) #739

Solves issue with deviceRefreshStatus method usage (#1217)

Solves issue with deviceRefreshStatus method usage (#1217) #739

Triggered via push June 27, 2025 04:43
Status Success
Total duration 2m 45s
Artifacts
This run and associated checks have been archived and are scheduled for deletion. Learn more about checks retention

beta-release.yml

on: push
Matrix: build_and_test / build
build_and_test  /  collect_coverage_reports
3s
build_and_test / collect_coverage_reports
Discord Webhooks  /  github-releases-to-discord
3s
Discord Webhooks / github-releases-to-discord
pre-release  /  Create New Github Beta Pre Release
6s
pre-release / Create New Github Beta Pre Release
Fit to window
Zoom out
Zoom in

Annotations

1 warning and 1 notice
Discord Webhooks / github-releases-to-discord
embed field value must be shorter than 1024, got 2010 [`08a164e`](https://github.com/OpenWonderLabs/homebridge-switchbot/commit/08a164eedcb4cab1f357f359d0234170210ce2c2) Solves issue with deviceRefreshStatus method usage (#1217) ## :recycle: Current situation As reported in the ticket https://github.com/OpenWonderLabs/homebridge-switchbot/issues/1209#issue-3054148604 the update of the parameters of some sensors connected to hub 2 does not seem to work correctly. I extended the explanation in this comment in that thread: https://github.com/OpenWonderLabs/homebridge-switchbot/issues/1209#issuecomment-2953947681 To report the information here too: The problem seems to be that the response obtained from the status of a device is destructured by recovering only the body, thus losing the statusCode, subsequently the method that verifies the response from the status code returns false, not finding the data present in the variable `deviceStatus` ```ts const response = await this.deviceRefreshStatus() const deviceStatus: any = response.body // ... if (await this.successfulStatusCodes(deviceStatus)) { // This cant check the statusCode cause it's not present in the `response.body` but in the `response.statusCode` // ... ``` ## :bulb: Proposed solution Change the usage of data obtained from the `pushChangeRequest` and `deviceRefreshStatus` methods. ## :gear: Release Notes - Solves issue with status code check from API responses in some cases. ## :heavy_plus_sign: Additional Information *If applicable, provide additional context in this section.* ### Testing *Which tests were added? Which existing tests were adapted/changed? Which situations are covered, and what edge cases are missing?* ### Reviewer Nudging It is probably easier to review starting from the `src/device/device.ts` file and then review the other changes which are very similar to each other. -- I apologize if this is not the correct way to open a PR or if there are other inaccuracies. Thank you very much and good work 😄
publish / publish_npm
Published on NPM - 4.3.2-beta.1