Skip to content

Commit 5cc8c72

Browse files
author
Olaf Fricke
committed
Refactored 'match case' to 'if elif' to support python 3.9
1 parent 1f4829a commit 5cc8c72

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

custom_components/ble_monitor/ble_parser/get_beacon_key.py

+8-9
Original file line numberDiff line numberDiff line change
@@ -107,15 +107,14 @@ async def get_beacon_key(mac, product_id):
107107
# (use 'python service_explorer.py --address <MAC> --service fe95' to dump the 'Xiaomi Inc.' service)
108108
for service in client.services:
109109
for char in service.characteristics:
110-
match char.description:
111-
case 'token':
112-
HANDLE_AUTH = char.handle
113-
case 'Version':
114-
HANDLE_FIRMWARE_VERSION = char.handle
115-
case 'Authentication':
116-
HANDLE_AUTH_INIT = char.handle
117-
case 'beacon_key':
118-
HANDLE_BEACON_KEY = char.handle
110+
if (char.description == 'token'):
111+
HANDLE_AUTH = char.handle
112+
elif (char.description == 'Version'):
113+
HANDLE_FIRMWARE_VERSION = char.handle
114+
elif (char.description == 'Authentication'):
115+
HANDLE_AUTH_INIT = char.handle
116+
elif (char.description == 'beacon_key'):
117+
HANDLE_BEACON_KEY = char.handle
119118

120119
# An asyncio future object is needed for callback handling
121120
future = asyncio.get_event_loop().create_future()

0 commit comments

Comments
 (0)