Skip to content

Scan and press fails with firmware v4.7 #13

@kyori19

Description

@kyori19

I recently bought a switchbot and tried to control with api and python.
But scanning and controlling the bot don't work.

Steps to reproduce

  • Scan

    from switchbot import Scanner
    s = Scanner()
    m = s.scan() # Push "Pair with Remote" in SwitchBot app

    Error:

    Can't init device hci0: Connection timed out (110)
    ERROR:pygatt.backends.gatttool.gatttool:Unexpected error when scanning: Invalid device: Network is down
    
    Traceback (most recent call last):
      File "/home/pi/.local/share/virtualenvs/switchbot-rpEz6xuZ/lib/python3.7/site-packages/pexpect/spawnbase.py", line 166, in read_nonblocking
        s = os.read(self.child_fd, size)
    OSError: [Errno 5] Input/output error
    

    I can get same error when I use flask api.

  • Press button (Interactive Only)

    b = Bot(mac = "xx:xx:xx:xx:xx:xx", id = 1, name = "Bedroom Light")
    b.press()

    Error:

    Can't init device hci0: Connection timed out (110)
    ERROR:pygatt.backends.gatttool.gatttool:Timed out connecting to CF:BF:8B:68:CB:8F after 5.0 seconds.
    ERROR:switchbot:pygatt: failed to connect to ble device
    Traceback (most recent call last):
      File "/home/pi/.local/share/virtualenvs/switchbot-rpEz6xuZ/lib/python3.7/site-packages/pygatt/backends/gatttool/gatttool.py", line 415, in connect
        self.sendline(cmd)
      File "/usr/lib/python3.7/contextlib.py", line 119, in __exit__
        next(self.gen)
      File "/home/pi/.local/share/virtualenvs/switchbot-rpEz6xuZ/lib/python3.7/site-packages/pygatt/backends/gatttool/gatttool.py", line 191, in event
        self.wait(event, timeout)
      File "/home/pi/.local/share/virtualenvs/switchbot-rpEz6xuZ/lib/python3.7/site-packages/pygatt/backends/gatttool/gatttool.py", line 157, in wait
          raise NotificationTimeout()
    pygatt.exceptions.NotificationTimeout: None
    

Environment

  • SwitchBot Bot Firmware v4.7
  • Raspberry Pi 3B+ Raspbian Buster Lite

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions