Jade Lee
Jan 22

Possible to command "pull or push" using python github?


Hi, I want to press and pull the switch using python project with Raspberry pi

I wonder there is only command of "Press" in python script.

Can I implement "pull" command using python script?

Jan 22

Hi sure,

you can refer to the switchbot.py.

if act == "Turn On":

con.sendline('char-write-cmd ' + cmd_handle + ' 570101')

elif act == "Turn Off":

con.sendline('char-write-cmd ' + cmd_handle + ' 570102')

elif act == "Press":

con.sendline('char-write-cmd ' + cmd_handle + ' 570100')

Jade Lee
Jan 24

Hi, one more quiestion.

I need to use two switchbots with one Rpi 3.

The Rpi 3 has a bluetooth function also.

I wonder switchbot.py can select one of two switchbots and send a command.

is it possible??

Jan 25

Yes, but you need to do a minor modification. You can scan to know the MAC address of each bot then put it in your code. A Bot can be identified by its MAC address.

New Posts
  • jt
    10 hours ago

    Hi. Im hoping to buy a SwitchBot hub + and Meter so I can monitor the temperature in my mother's house from my home. As I'm new to this can I ask some questions: Question 1: If I set up the hub and meter in her house can I see the temperature graph from her meter on my iPhone from anywhere? Question 2: Could we see this on 2 iPhones at the same time ( from several miles away) Question 3: Will the SwitchBot hub + work well with the Huawei B315 router? Please let us know each answer
  • Darren Fields
    a day ago

    I am looking at getting a SwitchBot or two for my home, I currently have a SmartThings Hub, do I need to purchase a SwitchBot Hub to remotely control the SwitchBot or can I use my existing SmartThings Hub?
  • Mike Klodginski
    2 days ago

    It would be really great to add an indefinite 'long press' or 'hold down until off' as the last option on the long press timer. That way it would hold the button down until the switch is set to off instead of a timed interval.

About us

SwitchBot is your simple switch to a smart home. With easy set-up, we help you to create a comfortable home with innovative smart home products.

We believe a smart home should be simple and comfortable. With the mission of making your life simpler in the most accessible way, SwitchBot is dedicated to creating and crafting the most innovative smart home products for you.


Subscribe to our email, follow us on social media, so you could get the best smart home product updates as soon as we have one.

  • Facebook
  • Twitter
  • Instagram
  • YouTube
© 2019 By Wonderlabs, Inc.