Releases: grid-coordination/python-oa3-client
Releases · grid-coordination/python-oa3-client
v0.5.0
Added
- MQTT
on_connectcallback (OA3C-9j0).MQTTConnectionandMqttChannelnow accept anon_connect: Callable[[], None] | Noneconstructor parameter. The callback fires on every successful CONNACK — both the initial connect and every subsequent reconnect — and is plumbed through toebus_mqtt_client.MqttClient'son_connect_callback. Consumers that need to distinguish first-connect from reconnect must maintain their own counter in the callback body. Motivated by the openadr3-ven-hassOA3V-31n/OA3V-xdrreconnect work (commit20399d3): without this hook, MQTT consumers can't re-fetch topics or re-snapshot REST state on reconnect. - MQTT subscription-set management (OA3C-2hz).
MQTTConnectionnow tracks the current subscription set (exposed assubscribed_topics: set[str]) and adds two new methods:unsubscribe(topics)(cleans upebus_mqtt_clientrecovery bookkeeping so the topic stays unsubscribed across reconnects) andreplace_subscriptions(topics)(applies the minimal subscribe/unsubscribe diff against the current set). Mirrored onMqttChannelasunsubscribe_topics(topics)andreplace_topics(topics). Designed to compose with theon_connectcallback for reconnect-time topic refresh: re-fetch topics in the callback, then callreplace_topics(new)without bouncing the broker connection. VenClient.poll_eventsaccepts an explicit date window (OA3C-2q6). Newdate_start/date_endparameters (pendulum.DateTime | None). When unset, defaults to a sliding window ofnow - 1 daytonow + 4 daysin UTC. This is wider than the spec-permitted VTN default oftoday→tomorrow UTCand prevents the UTC-rollover gap that bitopenadr3-ven-hass0.2.x (OA3V-yny, commita06402c) — where locally-active events dropped out of the spec-default window after midnight UTC (e.g. after 5pm Pacific). Explicit values are converted to UTC and formatted as ISO 8601 withZsuffix.
Changed
- Breaking (security): MQTT TLS certificate verification is now on by default (OA3C-k5a). New
tls_verify: bool = Trueparameter onMQTTConnectionandMqttChannel. Previouslytls_insecure=Truewas hardcoded, silently shipping no-cert-verification against anymqtts://broker. Consumers using self-signed brokers (e.g. the URPX dev broker) must now explicitly passtls_verify=Falseto keep the previous behaviour. For production deployments with valid certificates this change is transparent and security-correct. VenClient.poll_eventsnow passesdateStart/dateEndquery params by default (see Added above). Previously calledevents()with onlyprogramID, inheriting whatever date window the VTN defaulted to. The new default window (now - 1dtonow + 4dUTC) is opinionated and is wider than the VTN-side default; consumers wanting different windowing should pass explicitdate_start/date_end. Consumers wanting no date filter at all can drop down to the underlyingclient.events(programID=...)(available viaBaseClient.__getattr__delegation).subscribe()is now idempotent on already-subscribed topics. Previously each call re-issued the subscription regardless. Behavioural change is benign for consumers that previously relied on the idempotent broker-side semantics; redundantebus_mqtt_client.subscribecalls are now suppressed.NotificationChannelProtocol gainedunsubscribe_topics(topics)andreplace_topics(topics).WebhookChannelimplements both as no-ops (HTTP webhooks are managed via VTN REST subscriptions, not channel-side).- Dependency floor raised:
openadr3>=0.4.0(OA3C-yrf).openadr30.4.0 fixes a payload-type case-mismatch bug wherePayload.typewas lowercased during coercion whileEventPayloadDescriptor.payload_type/ReportPayloadDescriptor.payload_typepassed the wire value through unchanged — see the openadr3 0.4.0 CHANGELOG. This repo's own source does not read.typeon coerced openadr3 entities (MQTT/webhook payloads are shuttled through asbytes/Any), so no in-repo code change was required. The bump is purely about the dep floor so transitive consumers (e.g.openadr3-ven-hass) pick up the case fix when they pin againstpython-oa3-client. - CI: pinned GitHub Actions runtimes updated past the Node.js 20 deprecation.
actions/checkoutv4.2.2 → v6.0.2,actions/setup-pythonv5.6.0 → v6.2.0. Both now run onnode24(OA3C-tlh).
v0.4.0
Added
- Documentation and tests for
pendulum.DateTimepropagation through MQTT and webhook channels (commit).