Skip to content
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

Switchbot Integration: Bug in 2024.2.0+with Setting Blinds Position #110160

Closed
MeCJay12 opened this issue Feb 10, 2024 · 3 comments
Closed

Switchbot Integration: Bug in 2024.2.0+with Setting Blinds Position #110160

MeCJay12 opened this issue Feb 10, 2024 · 3 comments

Comments

@MeCJay12
Copy link

The problem

Using the latest tag from Home Assistant pulled nightly, Home Assistant began throwing errors 2024/02/08 when trying to set the position of Switchbot blinds. The command is sent to the blinds and they do go to the position but the below error is throw and, if used in an automation, will halt the automation.

2024-02-09 22:15:54.661 ERROR (MainThread) [homeassistant.components.bluetooth.manager] Error in bluetooth callback
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/bluetooth/manager.py", line 109, in _discover_service_info
    callback(service_info, BluetoothChange.ADVERTISEMENT)
  File "/usr/src/homeassistant/homeassistant/components/switchbot/coordinator.py", line 113, in _async_handle_bluetooth_event
    self.device.update_from_advertisement(adv)
  File "/usr/local/lib/python3.12/site-packages/switchbot/devices/device.py", line 695, in update_from_advertisement
    super().update_from_advertisement(advertisement)
  File "/usr/local/lib/python3.12/site-packages/switchbot/devices/device.py", line 664, in update_from_advertisement
    self._set_advertisement_data(advertisement)
  File "/usr/local/lib/python3.12/site-packages/switchbot/devices/device.py", line 632, in _set_advertisement_data
    self._update_parsed_data(new_data)
  File "/usr/local/lib/python3.12/site-packages/switchbot/devices/device.py", line 611, in _update_parsed_data
    self._set_parsed_data(self._sb_adv_data, merged_data)
  File "/usr/local/lib/python3.12/site-packages/switchbot/devices/curtain.py", line 68, in _set_parsed_data
    new_position = data["position"]
                   ~~~~^^^^^^^^^^^^
KeyError: 'position'

What version of Home Assistant Core has the issue?

2024.2.1

What was the last working version of Home Assistant Core?

2024.1.6

What type of installation are you running?

Home Assistant Container

Integration causing the issue

Switchbot

Link to integration documentation on our website

https://www.home-assistant.io/integrations/switchbot

Diagnostics information

home-assistant_switchbot_2024-02-10T04-21-03.433Z.log

Example YAML snippet

alias: Blinds Open 8:30am
description: ""
trigger:
  - platform: time
    at: "08:30:00"
condition: []
action:
  - repeat:
      sequence:
        - device_id: 39045f9c6a9c2259108725ac101fca5b
          domain: cover
          entity_id: 017e10c348727cf458880a42a717ca57
          type: open_tilt
        - device_id: 895616a6ca18a3a887f33ac0789962d8
          domain: cover
          entity_id: 708616649ac6785eb2657f8d19943870
          type: open_tilt
        - device_id: 549840f52c01b9131e6a31ea4bcf6725
          domain: cover
          entity_id: f9c547e1bb64d336ff260821ddf89e83
          type: open_tilt
        - device_id: 37e49824b4a0b6128fadfa2377ad6306
          domain: cover
          entity_id: 9a2c639cea78df68f70cd949bcd8fc77
          type: open_tilt
        - device_id: 75c24d6d48f7d70e76d44453a1db8b4a
          domain: cover
          entity_id: c4d43c6409ab7d48d534d78f3c22ce31
          type: open_tilt
        - device_id: 703c999e66690453804dbc6c0d41b386
          domain: cover
          entity_id: 3368d8d555d4ea64d92bdfb343463ea8
          type: open_tilt
        - device_id: ce95a3b6cc70425ab383e521d3746787
          domain: cover
          entity_id: 12e078a02106f65b7604191e4a149fa7
          type: open_tilt
        - device_id: d62cfcc5c3e7a45051f7d5f3589771a6
          domain: cover
          entity_id: 18c6f543d2271a03fcf15d9ed5f57fad
          type: open_tilt
        - device_id: ce83dfb2ea60db444f1234c0bcca42c3
          domain: cover
          entity_id: 4ec0a201fc626e874a7a3ae203681e96
          type: open_tilt
        - device_id: 79487ccde2e6c6c2a07eedc31e3f602c
          domain: cover
          entity_id: 8299547d7a60f3629530b2c96dcad3a0
          type: open
      until:
        - condition: device
          device_id: 39045f9c6a9c2259108725ac101fca5b
          domain: cover
          entity_id: 017e10c348727cf458880a42a717ca57
          type: is_tilt_position
          below: 80
          above: 20
        - condition: device
          device_id: 895616a6ca18a3a887f33ac0789962d8
          domain: cover
          entity_id: 708616649ac6785eb2657f8d19943870
          type: is_tilt_position
          below: 80
          above: 20
        - condition: device
          device_id: 549840f52c01b9131e6a31ea4bcf6725
          domain: cover
          entity_id: f9c547e1bb64d336ff260821ddf89e83
          type: is_tilt_position
          below: 80
          above: 20
        - condition: device
          device_id: 37e49824b4a0b6128fadfa2377ad6306
          domain: cover
          entity_id: 9a2c639cea78df68f70cd949bcd8fc77
          type: is_tilt_position
          below: 80
          above: 20
        - condition: device
          device_id: 75c24d6d48f7d70e76d44453a1db8b4a
          domain: cover
          entity_id: c4d43c6409ab7d48d534d78f3c22ce31
          type: is_tilt_position
          below: 80
          above: 20
        - condition: device
          device_id: 703c999e66690453804dbc6c0d41b386
          domain: cover
          entity_id: 3368d8d555d4ea64d92bdfb343463ea8
          type: is_tilt_position
          below: 80
          above: 20
        - condition: device
          device_id: ce95a3b6cc70425ab383e521d3746787
          domain: cover
          entity_id: 12e078a02106f65b7604191e4a149fa7
          type: is_tilt_position
          below: 80
          above: 20
        - condition: device
          device_id: d62cfcc5c3e7a45051f7d5f3589771a6
          domain: cover
          entity_id: 18c6f543d2271a03fcf15d9ed5f57fad
          type: is_tilt_position
          below: 80
          above: 20
        - condition: device
          device_id: ce83dfb2ea60db444f1234c0bcca42c3
          domain: cover
          entity_id: 4ec0a201fc626e874a7a3ae203681e96
          type: is_tilt_position
          below: 80
          above: 20
        - condition: device
          device_id: 79487ccde2e6c6c2a07eedc31e3f602c
          domain: cover
          entity_id: 8299547d7a60f3629530b2c96dcad3a0
          type: is_open
mode: single

Anything in the logs that might be useful for us?

No response

Additional information

No response

@home-assistant
Copy link

Hey there @Danielhiversen, @RenierM26, @murtas, @Eloston, @dsypniewski, mind taking a look at this issue as it has been labeled with an integration (switchbot) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of switchbot can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Renames the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign switchbot Removes the current integration label and assignees on the issue, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


switchbot documentation
switchbot source
(message by IssueLinks)

@aarnaegg
Copy link

See #109947 and #109933.

@MeCJay12
Copy link
Author

You're right. Looks like a duplicate.

@MeCJay12 MeCJay12 closed this as not planned Won't fix, can't repro, duplicate, stale Feb 10, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Mar 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants