Skip to content

Commit 6034257

Browse files
authored
Additional functionality for Bot and Curtain, reliability improvements. (#30)
* Add_extended_options * Change get_basic_info to allow reuse for other device notification keys. * Update __init__.py * Fix subscribe to notifications flag. * Add curtain advanced page data. * Update __init__.py * Update __init__.py * Update __init__.py * Update __init__.py * Update __init__.py * Check response from SB after sending command. -Check response from SB after sending command. -Allow passive scanning. -Combine notification and send_command methods. * Add functions for setting SB mode, cleanup password function. -Add function to set SB mode (switch/toggle) with strength. -Add function to set SB long press duration. -Update get_basic_info to return strength setting. -Cleanup password function. (_commandkey) * interface = 0 in bluepy by default. Just matching to save a few seconds. -interface = 0 in bluepy by default. Just matching to save a few seconds in execution. -The press, turn_on, turn_off still executes despite bot mode. Just logging to inform user of state. * Error handling on get_basic_settings -Error handling on get_basic_settings. -Add CONNECT_LOCK for discovery. -Add Inverse to set switchbot mode. * Update __init__.py * Add hand up/down functions. -Add hand up/down functions. -Log debug messages when bot is in different mode. * If no notification message return 00 bytes. All notifications messages return a byte value or multiples of it. If 00 we know the command failed. Set 00 as default if no status returned for consistency. * Check if bluepy helper is started, wait if device busy. Check if bluepy helper is started, wait if device busy. *Logger warning and error is present just for testing* * Switchbot devices can't immediately accept another connection. Add sleep between commands. -Try with 0.5 seconds. Might need to increase to 1, 1.5 or 2. * Update __init__.py * Update __init__.py * Update __init__.py * Shorten and reduce duplicate code. * Refactor duplicate code to new functions. * List comprehension for filters on GetSwitchbotDevices * Call disconnect bluepy helper running. * bluepy does properly terminate helper. No point in checking. #Looks like there are some reponse states added to latest bluepy master branch. Could be the reason for connect failures on some conditions. Or the devices take a while to wake. * Update __init__.py * Revert "Update __init__.py" This reverts commit 097710d. * No need for .getScanData() as .getValue returns bytes data directly. * Optimizations and error proofing. * Update __init__.py * Found a fix for bluepy disconnect errors. * Add _stopHelper() when timeout condition. * Refine _connect method so that the library can handle all error conditions. Bluepy is raises non spesific exceptions on everything and some of them can be corrected. * Update __init__.py * Update __init__.py * Just handle disc as part of connection. (will fail if timeout is reached) * Cleanup. * 100 tests later...warning is pointless. * Sent commands to SB for 1 hour on 10 sec intervals without +99.9% success rate. * Fix typing errors.
1 parent d2fbabd commit 6034257

File tree

2 files changed

+495
-321
lines changed

2 files changed

+495
-321
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
name = 'PySwitchbot',
55
packages = ['switchbot'],
66
install_requires=['bluepy'],
7-
version = '0.12.0',
7+
version = '0.13.0',
88
description = 'A library to communicate with Switchbot',
99
author='Daniel Hjelseth Hoyer',
1010
url='https://github.com/Danielhiversen/pySwitchbot/',

0 commit comments

Comments
 (0)