SolixBLE 4.0.0b2__tar.gz → 4.0.0b4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. {solixble-4.0.0b2 → solixble-4.0.0b4}/PKG-INFO +3 -1
  2. {solixble-4.0.0b2 → solixble-4.0.0b4}/README.md +1 -0
  3. {solixble-4.0.0b2 → solixble-4.0.0b4}/SolixBLE/__init__.py +15 -12
  4. {solixble-4.0.0b2 → solixble-4.0.0b4}/SolixBLE/const.py +8 -26
  5. {solixble-4.0.0b2 → solixble-4.0.0b4}/SolixBLE/device.py +268 -263
  6. {solixble-4.0.0b2 → solixble-4.0.0b4}/SolixBLE/devices/__init__.py +6 -4
  7. {solixble-4.0.0b2 → solixble-4.0.0b4}/SolixBLE/devices/f2000.py +154 -2
  8. {solixble-4.0.0b2 → solixble-4.0.0b4}/SolixBLE/devices/f2600.py +15 -150
  9. solixble-4.0.0b4/SolixBLE/devices/prime_charge_base_150w.py +209 -0
  10. {solixble-4.0.0b2 → solixble-4.0.0b4}/SolixBLE/devices/solarbank2.py +15 -3
  11. solixble-4.0.0b4/SolixBLE/prime_device.py +65 -0
  12. solixble-4.0.0b4/SolixBLE/protocols/__init__.py +36 -0
  13. solixble-4.0.0b4/SolixBLE/protocols/base.py +266 -0
  14. solixble-4.0.0b4/SolixBLE/protocols/ecdh.py +169 -0
  15. solixble-4.0.0b4/SolixBLE/protocols/outer.py +108 -0
  16. solixble-4.0.0b4/SolixBLE/protocols/session.py +223 -0
  17. {solixble-4.0.0b2 → solixble-4.0.0b4}/SolixBLE/states.py +97 -2
  18. solixble-4.0.0b4/SolixBLE/utilities.py +265 -0
  19. {solixble-4.0.0b2 → solixble-4.0.0b4}/SolixBLE.egg-info/PKG-INFO +3 -1
  20. {solixble-4.0.0b2 → solixble-4.0.0b4}/SolixBLE.egg-info/SOURCES.txt +8 -0
  21. {solixble-4.0.0b2 → solixble-4.0.0b4}/SolixBLE.egg-info/requires.txt +3 -0
  22. {solixble-4.0.0b2 → solixble-4.0.0b4}/pyproject.toml +3 -2
  23. {solixble-4.0.0b2 → solixble-4.0.0b4}/tests/test_commands.py +10 -12
  24. {solixble-4.0.0b2 → solixble-4.0.0b4}/tests/test_devices.py +38 -11
  25. solixble-4.0.0b4/tests/test_dynamic_negotiation.py +203 -0
  26. {solixble-4.0.0b2 → solixble-4.0.0b4}/tests/test_prime.py +52 -2
  27. solixble-4.0.0b4/tests/test_protocols.py +462 -0
  28. {solixble-4.0.0b2 → solixble-4.0.0b4}/tests/test_routing.py +20 -24
  29. solixble-4.0.0b4/tests/test_utilities.py +265 -0
  30. solixble-4.0.0b2/SolixBLE/prime_device.py +0 -375
  31. solixble-4.0.0b2/SolixBLE/utilities.py +0 -114
  32. solixble-4.0.0b2/tests/test_utilities.py +0 -49
  33. {solixble-4.0.0b2 → solixble-4.0.0b4}/LICENSE.txt +0 -0
  34. {solixble-4.0.0b2 → solixble-4.0.0b4}/SolixBLE/advertisement.py +0 -0
  35. {solixble-4.0.0b2 → solixble-4.0.0b4}/SolixBLE/constructs.py +0 -0
  36. {solixble-4.0.0b2 → solixble-4.0.0b4}/SolixBLE/devices/c1000.py +0 -0
  37. {solixble-4.0.0b2 → solixble-4.0.0b4}/SolixBLE/devices/c1000g2.py +0 -0
  38. {solixble-4.0.0b2 → solixble-4.0.0b4}/SolixBLE/devices/c300.py +0 -0
  39. {solixble-4.0.0b2 → solixble-4.0.0b4}/SolixBLE/devices/c300dc.py +0 -0
  40. {solixble-4.0.0b2 → solixble-4.0.0b4}/SolixBLE/devices/c800.py +0 -0
  41. {solixble-4.0.0b2 → solixble-4.0.0b4}/SolixBLE/devices/f3800.py +0 -0
  42. {solixble-4.0.0b2 → solixble-4.0.0b4}/SolixBLE/devices/generic.py +0 -0
  43. {solixble-4.0.0b2 → solixble-4.0.0b4}/SolixBLE/devices/maggo_3in1.py +0 -0
  44. {solixble-4.0.0b2 → solixble-4.0.0b4}/SolixBLE/devices/prime_charger_160w.py +0 -0
  45. {solixble-4.0.0b2 → solixble-4.0.0b4}/SolixBLE/devices/prime_charger_250w.py +0 -0
  46. {solixble-4.0.0b2 → solixble-4.0.0b4}/SolixBLE/devices/prime_power_bank_20k.py +0 -0
  47. {solixble-4.0.0b2 → solixble-4.0.0b4}/SolixBLE/devices/solarbank3.py +0 -0
  48. {solixble-4.0.0b2 → solixble-4.0.0b4}/SolixBLE/factory.py +0 -0
  49. {solixble-4.0.0b2 → solixble-4.0.0b4}/SolixBLE/transport.py +0 -0
  50. {solixble-4.0.0b2 → solixble-4.0.0b4}/SolixBLE.egg-info/dependency_links.txt +0 -0
  51. {solixble-4.0.0b2 → solixble-4.0.0b4}/SolixBLE.egg-info/top_level.txt +0 -0
  52. {solixble-4.0.0b2 → solixble-4.0.0b4}/setup.cfg +0 -0
  53. {solixble-4.0.0b2 → solixble-4.0.0b4}/tests/test_advertisement.py +0 -0
  54. {solixble-4.0.0b2 → solixble-4.0.0b4}/tests/test_connection.py +0 -0
  55. {solixble-4.0.0b2 → solixble-4.0.0b4}/tests/test_constructs.py +0 -0
  56. {solixble-4.0.0b2 → solixble-4.0.0b4}/tests/test_factory.py +0 -0
  57. {solixble-4.0.0b2 → solixble-4.0.0b4}/tests/test_transport.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: SolixBLE
3
- Version: 4.0.0b2
3
+ Version: 4.0.0b4
4
4
  Summary: Python module for monitoring & controlling Bluetooth Anker Solix devices
5
5
  Author-email: Harvey Lelliott <harveylelliott@duck.com>
6
6
  License: MIT License
@@ -48,6 +48,7 @@ Requires-Dist: bleak-retry-connector
48
48
  Requires-Dist: construct
49
49
  Requires-Dist: tzdata
50
50
  Requires-Dist: tzlocal
51
+ Requires-Dist: typing-extensions; python_full_version < "3.12"
51
52
  Dynamic: license-file
52
53
 
53
54
  # SolixBLE
@@ -104,6 +105,7 @@ See the [support table](https://solixble.readthedocs.io/en/latest) in the docume
104
105
  - F3800
105
106
  - Solarbank 2
106
107
  - Solarbank 3
108
+ - Prime Charge Base 150w
107
109
  - Prime Charger 160w
108
110
  - Prime Charger 250w
109
111
  - Prime MagGo 3in1 (A25X7)
@@ -52,6 +52,7 @@ See the [support table](https://solixble.readthedocs.io/en/latest) in the docume
52
52
  - F3800
53
53
  - Solarbank 2
54
54
  - Solarbank 3
55
+ - Prime Charge Base 150w
55
56
  - Prime Charger 160w
56
57
  - Prime Charger 250w
57
58
  - Prime MagGo 3in1 (A25X7)
@@ -17,6 +17,7 @@ from .devices import (
17
17
  F3800,
18
18
  Generic,
19
19
  MagGo3in1,
20
+ PrimeChargeBase150w,
20
21
  PrimeCharger160w,
21
22
  PrimeCharger250w,
22
23
  PrimePowerBank20k,
@@ -34,11 +35,9 @@ from .states import (
34
35
  PortStatus,
35
36
  TemperatureUnit,
36
37
  )
37
- from .utilities import discover_devices
38
+ from .utilities import discover_devices, set_region
38
39
 
39
40
  __all__ = [
40
- "SolixBLEDevice",
41
- "PrimeDevice",
42
41
  "C300",
43
42
  "C300DC",
44
43
  "C800",
@@ -47,21 +46,25 @@ __all__ = [
47
46
  "F2000",
48
47
  "F2600",
49
48
  "F3800",
50
- "Solarbank2",
51
- "Solarbank3",
52
- "PrimeCharger160w",
53
- "PrimeCharger250w",
54
- "PrimePowerBank20k",
55
- "MagGo3in1",
56
- "Generic",
57
49
  "ChargingStatus",
58
50
  "ChargingStatusF3800",
59
51
  "DisplayTimeout",
52
+ "Generic",
60
53
  "LightStatus",
54
+ "MagGo3in1",
55
+ "PortOverload",
61
56
  "PortStatus",
57
+ "PrimeChargeBase150w",
58
+ "PrimeCharger160w",
59
+ "PrimeCharger250w",
60
+ "PrimeDevice",
61
+ "PrimePowerBank20k",
62
+ "Solarbank2",
63
+ "Solarbank3",
64
+ "SolixBLEDevice",
62
65
  "TemperatureUnit",
63
- "PortOverload",
64
- "discover_devices",
65
66
  "capability_from_advertisement",
66
67
  "device_class_from_advertisement",
68
+ "discover_devices",
69
+ "set_region",
67
70
  ]
@@ -71,32 +71,14 @@ TELEMETRY_PATTERN_A = "03010f"
71
71
  #: The pattern used in negotiation packets from Anker devices
72
72
  NEGOTIATION_PATTERN = "030001"
73
73
 
74
- #: Command used to initiate negotiations
75
- NEGOTIATION_COMMAND_0 = "ff0936000300010001a10442ad8c69a22462326463306231372d623735642d346162662d626136652d656337633939376332336537b9"
76
-
77
- #: Response to receiving 1st negotiation message
78
- NEGOTIATION_COMMAND_1 = "ff093d000300010003a10442ad8c69a22462326463306231372d623735642d346162662d626136652d656337633939376332336537a30120a40200f064"
79
-
80
- #: Response to receiving 2nd negotiation message
81
- NEGOTIATION_COMMAND_2 = "ff0936000300010029a10442ad8c69a22462326463306231372d623735642d346162662d626136652d65633763393937633233653791"
82
-
83
- #: Response to receiving 3rd negotiation message
84
- NEGOTIATION_COMMAND_3 = "ff0940000300010005a10442ad8c69a22462326463306231372d623735642d346162662d626136652d656337633939376332336537a30120a40200f0a50140fb"
85
-
86
- #: Response to receiving 4th negotiation message
87
- NEGOTIATION_COMMAND_4 = "ff094c000300010021a140060ea168f232aedb37fb2d120c49180329ac72ab5ec3eb8fd30a2f252dc5e151dabccd9b1dc1e288704ca760a0d8c918e5c94823a1f609a4bf07fb4c33ee219085"
88
-
89
- #: Response to receiving 5th negotiation message
90
- NEGOTIATION_COMMAND_5 = "ff095a000300014022580bc0532a53c739adf3da7b994a7b5f221bcc16bab6392c215cb4faaf41d9d58e2c81c016e474c78eed5569147cb74a1f22ca2b3fad2e209dbbcfbdaca352034a6c479f055f68581b5f1e22348809f526"
91
-
92
- #: The private key this program uses to perform the ECDH negotiation to
93
- #: get a shared secret which is then used as an AES key for encrypting
94
- #: communications between the program and the power station. Yes I know it
95
- #: is bad security practice to hardcode keys but its a freaking power station
96
- #: talking over Bluetooth with a range of like 10m... I don't care, the only
97
- #: reason this has to be done at all is because Anker power stations no longer
98
- #: support sending telemetry in plain text after the latest firmware update.
99
- PRIVATE_KEY = "7dfbea61cd95cee49c458ad7419e817f1ade9a66136de3c7d5787af1458e39f4"
74
+ #: Static AES-GCM key, nonce and additional authenticated data used on the
75
+ #: encrypted negotiation path before the ECDH shared secret exists.
76
+ NEGOTIATION_KEY = "b8ff7422955d4eb6d554a2c470280559"
77
+ NEGOTIATION_NONCE = "6ba3e3f2f3a60f2971ce5d1f"
78
+ NEGOTIATION_AAD = "3322110077665544bbaa9988ffeeddcc"
100
79
 
101
80
  # POSIX timezone to use if determining the system time zone fails
102
81
  FALLBACK_TZ = "GMT0BST,M3.5.0/1,M10.5.0"
82
+
83
+ #: Region to use if none is set and the host locale names no territory
84
+ DEFAULT_REGION = "GB"