SolixBLE 4.0.0b2__tar.gz → 4.0.0b3__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 (56) hide show
  1. {solixble-4.0.0b2 → solixble-4.0.0b3}/PKG-INFO +2 -1
  2. {solixble-4.0.0b2 → solixble-4.0.0b3}/SolixBLE/__init__.py +13 -12
  3. {solixble-4.0.0b2 → solixble-4.0.0b3}/SolixBLE/const.py +8 -26
  4. {solixble-4.0.0b2 → solixble-4.0.0b3}/SolixBLE/device.py +268 -263
  5. solixble-4.0.0b3/SolixBLE/prime_device.py +65 -0
  6. solixble-4.0.0b3/SolixBLE/protocols/__init__.py +36 -0
  7. solixble-4.0.0b3/SolixBLE/protocols/base.py +266 -0
  8. solixble-4.0.0b3/SolixBLE/protocols/ecdh.py +169 -0
  9. solixble-4.0.0b3/SolixBLE/protocols/outer.py +108 -0
  10. solixble-4.0.0b3/SolixBLE/protocols/session.py +223 -0
  11. solixble-4.0.0b3/SolixBLE/utilities.py +265 -0
  12. {solixble-4.0.0b2 → solixble-4.0.0b3}/SolixBLE.egg-info/PKG-INFO +2 -1
  13. {solixble-4.0.0b2 → solixble-4.0.0b3}/SolixBLE.egg-info/SOURCES.txt +7 -0
  14. {solixble-4.0.0b2 → solixble-4.0.0b3}/SolixBLE.egg-info/requires.txt +3 -0
  15. {solixble-4.0.0b2 → solixble-4.0.0b3}/pyproject.toml +3 -2
  16. {solixble-4.0.0b2 → solixble-4.0.0b3}/tests/test_commands.py +2 -12
  17. {solixble-4.0.0b2 → solixble-4.0.0b3}/tests/test_devices.py +9 -5
  18. solixble-4.0.0b3/tests/test_dynamic_negotiation.py +203 -0
  19. {solixble-4.0.0b2 → solixble-4.0.0b3}/tests/test_prime.py +52 -2
  20. solixble-4.0.0b3/tests/test_protocols.py +462 -0
  21. {solixble-4.0.0b2 → solixble-4.0.0b3}/tests/test_routing.py +20 -24
  22. solixble-4.0.0b3/tests/test_utilities.py +265 -0
  23. solixble-4.0.0b2/SolixBLE/prime_device.py +0 -375
  24. solixble-4.0.0b2/SolixBLE/utilities.py +0 -114
  25. solixble-4.0.0b2/tests/test_utilities.py +0 -49
  26. {solixble-4.0.0b2 → solixble-4.0.0b3}/LICENSE.txt +0 -0
  27. {solixble-4.0.0b2 → solixble-4.0.0b3}/README.md +0 -0
  28. {solixble-4.0.0b2 → solixble-4.0.0b3}/SolixBLE/advertisement.py +0 -0
  29. {solixble-4.0.0b2 → solixble-4.0.0b3}/SolixBLE/constructs.py +0 -0
  30. {solixble-4.0.0b2 → solixble-4.0.0b3}/SolixBLE/devices/__init__.py +0 -0
  31. {solixble-4.0.0b2 → solixble-4.0.0b3}/SolixBLE/devices/c1000.py +0 -0
  32. {solixble-4.0.0b2 → solixble-4.0.0b3}/SolixBLE/devices/c1000g2.py +0 -0
  33. {solixble-4.0.0b2 → solixble-4.0.0b3}/SolixBLE/devices/c300.py +0 -0
  34. {solixble-4.0.0b2 → solixble-4.0.0b3}/SolixBLE/devices/c300dc.py +0 -0
  35. {solixble-4.0.0b2 → solixble-4.0.0b3}/SolixBLE/devices/c800.py +0 -0
  36. {solixble-4.0.0b2 → solixble-4.0.0b3}/SolixBLE/devices/f2000.py +0 -0
  37. {solixble-4.0.0b2 → solixble-4.0.0b3}/SolixBLE/devices/f2600.py +0 -0
  38. {solixble-4.0.0b2 → solixble-4.0.0b3}/SolixBLE/devices/f3800.py +0 -0
  39. {solixble-4.0.0b2 → solixble-4.0.0b3}/SolixBLE/devices/generic.py +0 -0
  40. {solixble-4.0.0b2 → solixble-4.0.0b3}/SolixBLE/devices/maggo_3in1.py +0 -0
  41. {solixble-4.0.0b2 → solixble-4.0.0b3}/SolixBLE/devices/prime_charger_160w.py +0 -0
  42. {solixble-4.0.0b2 → solixble-4.0.0b3}/SolixBLE/devices/prime_charger_250w.py +0 -0
  43. {solixble-4.0.0b2 → solixble-4.0.0b3}/SolixBLE/devices/prime_power_bank_20k.py +0 -0
  44. {solixble-4.0.0b2 → solixble-4.0.0b3}/SolixBLE/devices/solarbank2.py +0 -0
  45. {solixble-4.0.0b2 → solixble-4.0.0b3}/SolixBLE/devices/solarbank3.py +0 -0
  46. {solixble-4.0.0b2 → solixble-4.0.0b3}/SolixBLE/factory.py +0 -0
  47. {solixble-4.0.0b2 → solixble-4.0.0b3}/SolixBLE/states.py +0 -0
  48. {solixble-4.0.0b2 → solixble-4.0.0b3}/SolixBLE/transport.py +0 -0
  49. {solixble-4.0.0b2 → solixble-4.0.0b3}/SolixBLE.egg-info/dependency_links.txt +0 -0
  50. {solixble-4.0.0b2 → solixble-4.0.0b3}/SolixBLE.egg-info/top_level.txt +0 -0
  51. {solixble-4.0.0b2 → solixble-4.0.0b3}/setup.cfg +0 -0
  52. {solixble-4.0.0b2 → solixble-4.0.0b3}/tests/test_advertisement.py +0 -0
  53. {solixble-4.0.0b2 → solixble-4.0.0b3}/tests/test_connection.py +0 -0
  54. {solixble-4.0.0b2 → solixble-4.0.0b3}/tests/test_constructs.py +0 -0
  55. {solixble-4.0.0b2 → solixble-4.0.0b3}/tests/test_factory.py +0 -0
  56. {solixble-4.0.0b2 → solixble-4.0.0b3}/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.0b3
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
@@ -34,11 +34,9 @@ from .states import (
34
34
  PortStatus,
35
35
  TemperatureUnit,
36
36
  )
37
- from .utilities import discover_devices
37
+ from .utilities import discover_devices, set_region
38
38
 
39
39
  __all__ = [
40
- "SolixBLEDevice",
41
- "PrimeDevice",
42
40
  "C300",
43
41
  "C300DC",
44
42
  "C800",
@@ -47,21 +45,24 @@ __all__ = [
47
45
  "F2000",
48
46
  "F2600",
49
47
  "F3800",
50
- "Solarbank2",
51
- "Solarbank3",
52
- "PrimeCharger160w",
53
- "PrimeCharger250w",
54
- "PrimePowerBank20k",
55
- "MagGo3in1",
56
- "Generic",
57
48
  "ChargingStatus",
58
49
  "ChargingStatusF3800",
59
50
  "DisplayTimeout",
51
+ "Generic",
60
52
  "LightStatus",
53
+ "MagGo3in1",
54
+ "PortOverload",
61
55
  "PortStatus",
56
+ "PrimeCharger160w",
57
+ "PrimeCharger250w",
58
+ "PrimeDevice",
59
+ "PrimePowerBank20k",
60
+ "Solarbank2",
61
+ "Solarbank3",
62
+ "SolixBLEDevice",
62
63
  "TemperatureUnit",
63
- "PortOverload",
64
- "discover_devices",
65
64
  "capability_from_advertisement",
66
65
  "device_class_from_advertisement",
66
+ "discover_devices",
67
+ "set_region",
67
68
  ]
@@ -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"