Giter VIP home page Giter VIP logo

Comments (8)

peterneutron avatar peterneutron commented on July 30, 2024 1

@dcarrion87 This is all very strange and almost looks like either the BLE API is abandoned in favour of the Hub or the documentation is totally out of date regarding newer Bots. As it seems newer Bots can't be controlled anymore using just BLE and instead require the App or a Hub. See my issue here OpenWonderLabs/SwitchBotAPI-BLE#25 (comment)

from python-host.

mesigned avatar mesigned commented on July 30, 2024 1

I ran into the same issue using the switchbot_py3.py file. Interestingly using the switchbot_py2topy3.py file worked for me.
What I noticed was that the command used to e.g. turn on the switchbot looked like this:

> gatttool -t random -b XX:XX:XX:XX:XX:XX --char-write-req -a 0x0013 -n 570101
Characteristic value was written successfully

I spent quite some hours searching for a package that works, hopefully this information is of use to someone.
Switchbot running on firmware version 6.5

from python-host.

dcarrion87 avatar dcarrion87 commented on July 30, 2024

Not sure if this helps at all with troubleshooting:

# gatttool -t random -b XX:XX:XX:XX:XX:XX --characteristics
handle = 0x0002, char properties = 0x20, char value handle = 0x0003, uuid = 00002a05-0000-1000-8000-00805f9b34fb
handle = 0x0006, char properties = 0x02, char value handle = 0x0007, uuid = 00002a00-0000-1000-8000-00805f9b34fb
handle = 0x0008, char properties = 0x02, char value handle = 0x0009, uuid = 00002a01-0000-1000-8000-00805f9b34fb
handle = 0x000a, char properties = 0x02, char value handle = 0x000b, uuid = 00002a04-0000-1000-8000-00805f9b34fb
handle = 0x000c, char properties = 0x02, char value handle = 0x000d, uuid = 00002aa6-0000-1000-8000-00805f9b34fb
handle = 0x000f, char properties = 0x0c, char value handle = 0x0010, uuid = cba20002-224d-11e6-9fb8-0002a5d5c51b
handle = 0x0011, char properties = 0x10, char value handle = 0x0012, uuid = cba20003-224d-11e6-9fb8-0002a5d5c51b
# gatttool -t random -b XX:XX:XX:XX:XX:XX --char-write-req -a 0x0016 -n 570101
Characteristic Write Request failed: Invalid handle

# gatttool -t random -b XX:XX:XX:XX:XX:XX --char-write-req -a 0x0016 -n 570102
Characteristic Write Request failed: Invalid handle

from python-host.

BroZer8360 avatar BroZer8360 commented on July 30, 2024

Let's write in here @dcarrion87
Did you tried
sudo python2 switchbot.py <mac_adress> Bot Turn On
And what's the error message ?

Edit : <Mac_adress> is to be replaced by the mac adresse of your device, it's shown in the mobile app and is like this format : XX:XX:XX:XX:XX:XX with X from 0 to 9 and from A to F

from python-host.

dcarrion87 avatar dcarrion87 commented on July 30, 2024

@BroZer8360 I don't have python2 on this system no error message for the switchbot_py2topy3.py converted one but doubt it would show an error as it's just firing the command and not listening for a response. Nothing happening on the bot.

# sudo switchbot_py2topy3.py XX:XX:XX:XX:XX:XX Bot Turn On
Preparing to connect.
Connection successful.
Complete

Not showing mac address for identification reasons.

from python-host.

dcarrion87 avatar dcarrion87 commented on July 30, 2024

I was able to get this working with this project https://github.com/Danielhiversen/pySwitchbot

E.g.:

from switchbot import Switchbot
from bleak import BleakScanner
import asyncio

async def main():
  ble_device = await BleakScanner.find_device_by_address("MAC ADDRESS", timeout=20)
  device = Switchbot(ble_device)
  await device.turn_off()

if __name__ == "__main__":
  asyncio.run(main())

Looks like there's differences in how it handles.

from python-host.

allegewhd avatar allegewhd commented on July 30, 2024

same problem with fireware 6.3. OS is ubuntu 20.04

> gatttool -t random -b switch_bot_with_fireware_6.3_mac  --char-write-req -a 0x0016 -n 570101
Characteristic Write Request failed: Invalid handle

 > gatttool -t random -b switch_bot_with_fireware_4.9_mac  --char-write-req -a 0x0016 -n 570101
Characteristic value was written successfully

from python-host.

zedrdave avatar zedrdave commented on July 30, 2024

Based on replies on that other thread, does this seem to address the problem above?

from python-host.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.