Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions SolixBLE/const.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Constants for SolixBLE module.

Check failure on line 1 in SolixBLE/const.py

View workflow job for this annotation

GitHub Actions / ruff

ruff (CPY001)

SolixBLE/const.py:1:1: CPY001 Missing copyright notice at top of file

Check failure on line 1 in SolixBLE/const.py

View workflow job for this annotation

GitHub Actions / ruff

ruff (CPY001)

SolixBLE/const.py:1:1: CPY001 Missing copyright notice at top of file

.. moduleauthor:: Harvey Lelliott (flip-dots) <harveylelliott@duck.com>

Expand All @@ -10,7 +10,7 @@
#: GATT Service UUID for sending commands / negotiating.
UUID_COMMAND = "8c850002-0302-41c5-b46e-cf057c562025"

#: GATT Service UUID for identifying Solix/Prime devices (Tested on C300X, C1000, and Prime 160w Charger).

Check failure on line 13 in SolixBLE/const.py

View workflow job for this annotation

GitHub Actions / ruff

ruff (E501)

SolixBLE/const.py:13:89: E501 Line too long (106 > 88)

Check failure on line 13 in SolixBLE/const.py

View workflow job for this annotation

GitHub Actions / ruff

ruff (E501)

SolixBLE/const.py:13:89: E501 Line too long (106 > 88)
UUID_IDENTIFIER = "0000ff09-0000-1000-8000-00805f9b34fb"

#: Time to wait before re-connecting on an unexpected disconnect.
Expand Down Expand Up @@ -44,30 +44,30 @@
#: Bool value for unknown boolean attributes.
DEFAULT_METADATA_BOOL = None

#: The pattern used in telemetry packers from some Anker devices
TELEMETRY_PATTERN_A = "03010f"

#: The pattern used in negotiation packets from Anker devices
NEGOTIATION_PATTERN = "030001"

#: Command used to initiate negotiations
NEGOTIATION_COMMAND_0 = "ff0936000300010001a10442ad8c69a22462326463306231372d623735642d346162662d626136652d656337633939376332336537b9"

Check failure on line 54 in SolixBLE/const.py

View workflow job for this annotation

GitHub Actions / ruff

ruff (E501)

SolixBLE/const.py:54:89: E501 Line too long (134 > 88)

Check failure on line 54 in SolixBLE/const.py

View workflow job for this annotation

GitHub Actions / ruff

ruff (E501)

SolixBLE/const.py:54:89: E501 Line too long (134 > 88)

#: Response to receiving 1st negotiation message
NEGOTIATION_COMMAND_1 = "ff093d000300010003a10442ad8c69a22462326463306231372d623735642d346162662d626136652d656337633939376332336537a30120a40200f064"

Check failure on line 57 in SolixBLE/const.py

View workflow job for this annotation

GitHub Actions / ruff

ruff (E501)

SolixBLE/const.py:57:89: E501 Line too long (148 > 88)

Check failure on line 57 in SolixBLE/const.py

View workflow job for this annotation

GitHub Actions / ruff

ruff (E501)

SolixBLE/const.py:57:89: E501 Line too long (148 > 88)

#: Response to receiving 2nd negotiation message
NEGOTIATION_COMMAND_2 = "ff0936000300010029a10442ad8c69a22462326463306231372d623735642d346162662d626136652d65633763393937633233653791"

Check failure on line 60 in SolixBLE/const.py

View workflow job for this annotation

GitHub Actions / ruff

ruff (E501)

SolixBLE/const.py:60:89: E501 Line too long (134 > 88)

Check failure on line 60 in SolixBLE/const.py

View workflow job for this annotation

GitHub Actions / ruff

ruff (E501)

SolixBLE/const.py:60:89: E501 Line too long (134 > 88)

#: Response to receiving 3rd negotiation message
NEGOTIATION_COMMAND_3 = "ff0940000300010005a10443ad8c69a22462326463306231372d623735642d346162662d626136652d656337633939376332336537a30120a40200f0a50140fa"
NEGOTIATION_COMMAND_3 = "ff0940000300010005a10442ad8c69a22462326463306231372d623735642d346162662d626136652d656337633939376332336537a30120a40200f0a50140fb"

Check failure on line 63 in SolixBLE/const.py

View workflow job for this annotation

GitHub Actions / ruff

ruff (E501)

SolixBLE/const.py:63:89: E501 Line too long (154 > 88)

Check failure on line 63 in SolixBLE/const.py

View workflow job for this annotation

GitHub Actions / ruff

ruff (E501)

SolixBLE/const.py:63:89: E501 Line too long (154 > 88)

#: Response to receiving 4th negotiation message
NEGOTIATION_COMMAND_4 = "ff094c000300010021a140060ea168f232aedb37fb2d120c49180329ac72ab5ec3eb8fd30a2f252dc5e151dabccd9b1dc1e288704ca760a0d8c918e5c94823a1f609a4bf07fb4c33ee219085"

Check failure on line 66 in SolixBLE/const.py

View workflow job for this annotation

GitHub Actions / ruff

ruff (E501)

SolixBLE/const.py:66:89: E501 Line too long (178 > 88)

Check failure on line 66 in SolixBLE/const.py

View workflow job for this annotation

GitHub Actions / ruff

ruff (E501)

SolixBLE/const.py:66:89: E501 Line too long (178 > 88)

#: Response to receiving 5th negotiation message
NEGOTIATION_COMMAND_5 = "ff095a000300014022580bc0532a53c739adf3da7b994a7b5f221bcc16bab6392c215cb4faaf41d9d58e2c81c016e474c78eed5569147cb74a1f22ca2b3fad2e209dbbcfbdaca352034a6c479f055f68581b5f1e22348809f526"

#: The unix timestamp that is agreed upon in the negotiations. This is used
#: by Anker to protect against replay attacks as commands must contain the
#: current encrypted time.
BASE_TIMESTAMP = "42ad8c69"


#: The private key this program uses to perform the ECDH negotiation to
#: get a shared secret which is then used as an AES key for encrypting
#: communications between the program and the power station. Yes I know it
Expand All @@ -76,3 +76,6 @@
#: reason this has to be done at all is because Anker power stations no longer
#: support sending telemetry in plain text after the latest firmware update.
PRIVATE_KEY = "7dfbea61cd95cee49c458ad7419e817f1ade9a66136de3c7d5787af1458e39f4"

# POSIX timezone to use if determining the system time zone fails
FALLBACK_TZ = "GMT0BST,M3.5.0/1,M10.5.0"
Loading
Loading