Skip to content

Add_new_support_for_keypad_airpurifier#42

Merged
SeraphicRav merged 2 commits into
SeraphicCorp:mainfrom
XiaoLing-git:add_new_support_for_keypad_airpurifier
Mar 3, 2026
Merged

Add_new_support_for_keypad_airpurifier#42
SeraphicRav merged 2 commits into
SeraphicCorp:mainfrom
XiaoLing-git:add_new_support_for_keypad_airpurifier

Conversation

@XiaoLing-git
Copy link
Copy Markdown
Contributor

  1. Keypad status can only be viewed in device details; special handling is required.

  2. Add a decoding function for the keyboard.

  3. Add a new command for the air purifier.

@SeraphicRav SeraphicRav merged commit b2ba619 into SeraphicCorp:main Mar 3, 2026
7 checks passed
sarveshbathija added a commit to sarveshbathija/py-switchbot-api that referenced this pull request Apr 7, 2026
The SwitchBot Cloud API returns an empty body for IR remote devices
(the docstring on `get_status` already notes "No status for IR
devices"), so the unwrapped response dict has no `deviceType` key.

Since SeraphicCorp#42 introduced an unconditional `response["deviceType"]` lookup
to detect Keypad devices, every coordinator backing an IR remote (and
any other device whose status response omits `deviceType`) now raises
`KeyError: 'deviceType'`. In Home Assistant this surfaces as the
`switchbot_cloud` integration repeatedly failing to set up:

    File ".../switchbot_api/__init__.py", line 265, in get_status
        device_type = response["deviceType"]
    KeyError: 'deviceType'

Use `dict.get` so the missing-key case falls through to the existing
"return response as-is" path, matching the pre-SeraphicCorp#42 behavior for IR
remotes while preserving the new keypad special-casing.

Adds a regression test + fixture covering an empty status body.
SeraphicRav pushed a commit that referenced this pull request Apr 10, 2026
The SwitchBot Cloud API returns an empty body for IR remote devices
(the docstring on `get_status` already notes "No status for IR
devices"), so the unwrapped response dict has no `deviceType` key.

Since #42 introduced an unconditional `response["deviceType"]` lookup
to detect Keypad devices, every coordinator backing an IR remote (and
any other device whose status response omits `deviceType`) now raises
`KeyError: 'deviceType'`. In Home Assistant this surfaces as the
`switchbot_cloud` integration repeatedly failing to set up:

    File ".../switchbot_api/__init__.py", line 265, in get_status
        device_type = response["deviceType"]
    KeyError: 'deviceType'

Use `dict.get` so the missing-key case falls through to the existing
"return response as-is" path, matching the pre-#42 behavior for IR
remotes while preserving the new keypad special-casing.

Adds a regression test + fixture covering an empty status body.

Co-authored-by: sarveshbathija <589118+sarveshbathija@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants