This repository was archived by the owner on Aug 7, 2024. It is now read-only.
Fixed a bug where specifying a MAC Address does not work #6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When instantiating the
Aranet4
client class, there is the option to specify amac_address
in the constructor. This means the class will connect to this address rather than running auto-disovery to find the aranet4 device.This currently doesn't work, because the
_client
property is never instantiated when specifying the address manually. You simply receive an error that says_client of None type does not have a method read_gatt_char()
.Digging into this, it looks like a simple fix. In the
_read_value()
method, simply always callself._discover()
regardless of ifself.address
is specified or not. The_discover()
method already has logic to check for the presence ofself.address
and will skip auto discovery accordingly. It then properly instantiates theBleakClient
and callsconnect()
.I've tested this and it works perfect for me.