Skip to content

Fix the return value of SwitchBotOpenAPI.getDeviceStatus() method - #290

Merged
donavanbecker merged 1 commit into
OpenWonderLabs:beta-3.5.0from
kemuridama:fix_return_value_of_getDeviceStatus
Feb 6, 2025
Merged

donavanbecker merged 1 commit into
OpenWonderLabs:beta-3.5.0from
kemuridama:fix_return_value_of_getDeviceStatus

Conversation

@kemuridama

@kemuridama kemuridama commented Feb 3, 2025 •

Copy link
Copy Markdown

♻️ Current situation

Describe the current situation. Explain current problems, if there are any. Be as descriptive as possible (e.g., including examples or code snippets).

SwitchBotOpenAPI.getDeviceStatus() method returns an object like below:

{
  response: {
    statusCode: 100,
    body: {
      version: 'V2.9',
      battery: 41,
      lockState: 'locked',
      doorState: 'closed',
      calibrate: true,
      deviceId: 'XXXXXXXX',
      deviceType: 'XXXXXXXX',
      hubDeviceId: 'XXXXXXXX'
    },
    message: 'success'
  },
  statusCode: 200
}

But SwitchBotOpenAPI.getDeviceStatus() expects to return { response: deviceStatus, statusCode: deviceStatusRequest['statusCode'] } type.

💡 Proposed solution

Describe the proposed solution and changes. How does it affect the project? How does it affect the internal structure (e.g., refactorings)?

This line does not return deviceStatus type but deviceStatusRequest type. So this PR fix the internal type in the getDeviceStatus() method so that it returns an expected object.

⚙️ Release Notes

Provide a summary of the changes or features from a user's point of view. If there are breaking changes, provide migration guides using code examples of the affected features.

➕ 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

Where should the reviewer start? what is a good entry point?

@github-actions github-actions Bot added enhancement New feature or request latest labels Feb 3, 2025
@donavanbecker
donavanbecker changed the base branch from latest to beta-3.5.0 February 6, 2025 04:45
@donavanbecker
donavanbecker merged commit 5f77a35 into OpenWonderLabs:beta-3.5.0 Feb 6, 2025
donavanbecker pushed a commit that referenced this pull request Feb 6, 2025
…290)

## ♻️ Current situation

*Describe the current situation. Explain current problems, if there are
any. Be as descriptive as possible (e.g., including examples or code
snippets).*

`SwitchBotOpenAPI.getDeviceStatus()` method returns an object like
below:

```
{
  response: {
    statusCode: 100,
    body: {
      version: 'V2.9',
      battery: 41,
      lockState: 'locked',
      doorState: 'closed',
      calibrate: true,
      deviceId: 'XXXXXXXX',
      deviceType: 'XXXXXXXX',
      hubDeviceId: 'XXXXXXXX'
    },
    message: 'success'
  },
  statusCode: 200
}
```

But `SwitchBotOpenAPI.getDeviceStatus()` expects to return `{ response:
deviceStatus, statusCode: deviceStatusRequest['statusCode'] }` type.

## 💡 Proposed solution

*Describe the proposed solution and changes. How does it affect the
project? How does it affect the internal structure (e.g.,
refactorings)?*

[This
line](https://github.com/OpenWonderLabs/node-switchbot/blob/ca9e2255e7a50bdb709058c259f2581dc3ee7467/src/switchbot-openapi.ts#L201)
does not return `deviceStatus` type but `deviceStatusRequest` type. So
this PR fix the internal type in the `getDeviceStatus()` method so that
it returns an expected object.

## ⚙️ Release Notes

*Provide a summary of the changes or features from a user's point of
view. If there are breaking changes, provide migration guides using code
examples of the affected features.*

## ➕ 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

*Where should the reviewer start? what is a good entry point?*
@kemuridama
kemuridama deleted the fix_return_value_of_getDeviceStatus branch February 6, 2025 05:51
donavanbecker added a commit that referenced this pull request Mar 5, 2025
## [3.5.0](https://github.com/OpenWonderLabs/node-switchbot/releases/tag/v3.5.0) (2025-03-04)

### What's Changed
- Fix the return value of SwitchBotOpenAPI.getDeviceStatus() method [#290](#290), Thanks [@kemuridama](https://github.com/kemuridama)
- Fix circular dependencies
- Housekeeping and update dependencies

**Full Changelog**: v3.4.0...v3.5.0
@donavanbecker donavanbecker mentioned this pull request Mar 5, 2025
donavanbecker added a commit that referenced this pull request Mar 5, 2025
## [3.5.0](https://github.com/OpenWonderLabs/node-switchbot/releases/tag/v3.5.0) (2025-03-04)

### What's Changed
- Fix the return value of SwitchBotOpenAPI.getDeviceStatus() method [#290](#290), Thanks [@kemuridama](https://github.com/kemuridama)
- Fix circular dependencies
- Housekeeping and update dependencies

**Full Changelog**: v3.4.0...v3.5.0
donavanbecker added a commit that referenced this pull request Mar 5, 2025
- Fix the return value of SwitchBotOpenAPI.getDeviceStatus() method [#290](#290), Thanks [@kemuridama](https://github.com/kemuridama)
- Fix circular dependencies
- Housekeeping and update dependencies

**Full Changelog**: v3.4.0...v3.5.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request latest

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants