Repository navigation
List an unsupported device found by IP in the dbus inventory - #35
Open
drHouse-gif wants to merge 1 commit into
Open
drHouse-gif wants to merge 1 commit into
drHouse-gif wants to merge 1 commit into
Conversation
A probe that finds a reachable device with no component the driver handles returns ProbeStatus.UNSUPPORTED, and the handler stores the device info with the comment "so we can list the unsupported device details". The device is then never listed. The inventory is keyed by serial, and promote_serial is only set on the REACHABLE path. An endpoint added as a bare IP still has serial None when the probe comes back UNSUPPORTED, so there is no key to register it under and _add_device is never reached, even though the mac is right there in result.info. Set promote_serial on the UNSUPPORTED path too, which is all it takes for the stored details to reach dbus as /Devices/<serial>/... with /Supported = 0. Devices discovered over mDNS already have a serial parsed from the hostname and were unaffected. tests/test_probe_status.py pins the classification outcomes that are reachable from the outside: a reachable device is listed and supported; an unsupported one is listed with /Supported = 0 and keeps its model; an unreachable one gets /Reachable = 0 and recovers; a frozen device is not reclassified as unsupported, which matters because UNSUPPORTED stops the retries for good; the transitions both ways via /Refresh; and that a device without a usable mac is never registered as /Devices/unknown. The mock gains --extra-components, to emulate a device that answers RPC but exposes only components the driver has no handler for, and --break-mac for the no-identity case. Neither was expressible before.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
One commit on
master(d8cb65d, v2.21).discovery.py+6,mock/mock_shelly_server.py+16/-2, one new test file.The problem
When a probe finds a reachable device that exposes no component the driver handles, the
UNSUPPORTEDbranch stores its details with an explicit comment saying why:Those details then never reach dbus. The inventory is keyed by serial, and
promote_serialisset only on the
REACHABLEpath, so an endpoint entered as a bare IP still hasserial = Nonewhen the probe comes back
UNSUPPORTED. There is no key to register it under,_add_deviceisnever reached, and the device is not listed at all - even though its mac is sitting right there
in
result.info.Devices discovered over mDNS are unaffected: the serial is parsed from the hostname, so they
are already promoted and do get listed with
/Supported = 0.The visible effect is that a user who types in the IP of a device the driver cannot use gets
nothing back - no entry, no model, no indication the address was even reached. On a GX the
reason is not in the log either: v2.21 moved
"Failed to get device info"fromlogger.errorto
logger.debug.The change
Six lines. Promote on the
UNSUPPORTEDpath too, which is all it takes for the details storedimmediately above to reach dbus as
/Devices/<serial>/...with/Supported = 0:Nothing else changes:
stop_connect()still ends the retries,supportedis still set False.Tests
tests/test_probe_status.py, 7 tests, pinning the outcomes a mock can produce so a laterchange cannot silently reclassify a device:
/Supported = 0, and keeps its model/Reachable = 0and recoversUNSUPPORTEDstops the retries for good/Refreshguards the change itself, since promoting on the
UNSUPPORTEDpath means the promotion nowruns for a device the driver could not use
tests/test_probe_status.pyThe three that fail are the unsupported-device test and the two transition tests that depend on
the device being listed at all.
The mock gains
--extra-components, to emulate a device that answers RPC but exposes onlycomponents the driver has no handler for, and
--break-macfor the no-identity case. Neitherwas expressible before.
Full suite: 82 passed, 4 xfailed, 1 failed on aioshelly 12.0.0, against a pristine v2.21
baseline of 75 passed, 4 xfailed, 1 failed. The one failure,
test_timeouts.py::test_freeze_longer_than_reconnect_loop, is pre-existing: it fails onunmodified v2.21 with aioshelly 12.0.0, the version the Venus OS recipe pins and a GX actually
runs, and it passes on 14.1.0, which CI installs unpinned.
Interaction with the other proposed change
#34 adds a neighbouring branch to the same
if/elifchain.discovery.pymerges cleanlybetween the two. They overlap by one line in
mock/mock_shelly_server.py, where both add a constructor argument at the end of the sameparameter list; keep both lines. Neither change depends on the other.