Repository navigation
homie: type the Device injection point with MqttDeviceTransport - #19
Merged
Merged
Conversation
Follow-up to #14, on top of #12's MqttTransport base. Adds a Device-side structural type and mirrors #12's owned/injected client split onto Device, so "the SDK never starts or stops a client it did not build" is enforced by the types rather than a convention. - transport.py: MqttDeviceTransport(MqttTransport) adds is_connected + is_running (the members the device publish path reads); omits start/stop/publish_and_flush, which are owned-only. Exported from ebus_sdk. - Device.mqttc is retyped Optional[MqttDeviceTransport]; the SDK-built client is kept on a separate Device._owned_client (concrete MqttClient), and every owned-only call (start/stop/publish_and_flush, incl. Property.start_mqtt_client) routes through it. get_mqtt_client() returns the transport type. +4 tests (MqttDeviceTransport protocol + the _owned_client handle). Full suite and ruff green. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
This was referenced Aug 2, 2026
dcj
added a commit
that referenced
this pull request
Aug 2, 2026
… typing) Bumps __version__ to 0.16.0 and promotes the [Unreleased] CHANGELOG to [0.16.0]. Carries the bring-your-own-transport work accumulated since 0.15.0: the Device(mqttc=) producer seam (#14) with the will/refresh_tree wiring contract (#13), and the transport Protocol typing (MqttTransport / MqttControllerTransport #12, MqttDeviceTransport #19). README gains the BYO section with a neutral note on the shared-connection will limit. This is the ebus-sdk release the ebus-mqtt-client py.typed marker (electrification-bus/ebus-mqtt-client#9) is gated on. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
dcj
added a commit
that referenced
this pull request
Aug 2, 2026
… typing) (#21) Bumps __version__ to 0.16.0 and promotes the [Unreleased] CHANGELOG to [0.16.0]. Carries the bring-your-own-transport work accumulated since 0.15.0: the Device(mqttc=) producer seam (#14) with the will/refresh_tree wiring contract (#13), and the transport Protocol typing (MqttTransport / MqttControllerTransport #12, MqttDeviceTransport #19). README gains the BYO section with a neutral note on the shared-connection will limit. This is the ebus-sdk release the ebus-mqtt-client py.typed marker (electrification-bus/ebus-mqtt-client#9) is gated on. Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
This was referenced Aug 2, 2026
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.
Follow-up to #14, on top of #12's
MqttTransportbase. Types theDevicebring-your-own-transport injection point with a narrow structuralProtocol, mirroring the owned/injected split #12 did forController, so a downstream consumer injecting its own client type-checks and "the SDK never starts or stops a client it did not build" is enforced by the types rather than a convention.Why this matters now (not just polish)
ebus-mqtt-clientPR #9 (draft) shipspy.typed, gated onebus-sdkreleasing the transport Protocol widening. That gate now covers two injection points:Controller(mqttc=)(fixed by #12, merged) andDevice(mqttc=)(added in #14, still typedOptional[MqttClient]). Oncepy.typedships, any injection point still typedOptional[MqttClient]breaks with[arg-type]. This PR widens theDeviceside, so a 0.16.0 release with #12 + this fully unblocksebus-mqtt-client#9.What it does
transport.py:MqttDeviceTransport(MqttTransport)addsis_connected()+is_running(the members the device publish path reads); omitsstart/stop/publish_and_flush, which are owned-only. Re-exported fromebus_sdk. (Data memberis_runningmeansisinstance, notissubclass.)Device.mqttcis retypedOptional[MqttDeviceTransport]; the SDK-built client is kept on a separateDevice._owned_client(concreteMqttClient), and every owned-only call (start/stop/publish_and_flush, plusProperty.start_mqtt_client) routes through it.get_mqtt_client()returns the transport type.Tests / CI
+4 tests (the
MqttDeviceTransportprotocol + the_owned_clienthandle), 527 total. Grep-verified that no owned-only call still routes through the narrowedmqttc.ruff check+ruff format --checkclean; the 3.10-3.13 matrix runs on this PR.CHANGELOG
[Unreleased]gets theMqttDeviceTransportentry.🤖 Generated with Claude Code