Comments (8)
@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.
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.
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.
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.
@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.
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.
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.
Based on replies on that other thread, does this seem to address the problem above?
from python-host.
Related Issues (20)
- UnicodeDecodeError on pip3 download gattlib HOT 4
- Curtain support? HOT 8
- RuntimeError: Characteristic value/descriptor operation failed: Invalid handle HOT 1
- Add Curtain "pause" HOT 2
- Add curtain info output HOT 1
- Can't send commands - curtain HOT 2
- MagicSwitchbot -> ConnectionError... why? HOT 1
- Add Curtain left and right commands (same as calibration) HOT 4
- Contact Sensor, Motion Sensor Support
- Contact Sensor: Going out counter and entry counter are not increased
- Password Support? HOT 5
- Connection Refused (111) HOT 1
- Curtain BLE - Support slider control mode single side
- The documentation for the set RGB on the color bulb is incorrect HOT 1
- battery level still not possible? HOT 1
- Attribute can't be read on Meter device with BLE open API
- Can't send "Press" to Bot HOT 10
- Get historic temperature data from SwitchBot Meter Plus
- Documentation is too old to be understandable and need some review HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from python-host.