Skip to content

Correct the VIC1 Heywood interconnector id and make interconnector entities deterministic - #49

Merged
purcell-lab merged 1 commit into
mainfrom
fix/interconnector-map-and-determinism
Sep 1, 2026
Merged

Correct the VIC1 Heywood interconnector id and make interconnector entities deterministic#49
purcell-lab merged 1 commit into
mainfrom
fix/interconnector-map-and-determinism

Conversation

@purcell-lab

Copy link
Copy Markdown
Owner

Fixes #46
Fixes #48
Addresses #47

Three defects in the same eight lines of interconnector setup, so they are fixed together rather than as three conflicting branches.

Heywood was mapped under an id AEMO does not publish (#46)

VIC1_INTERCONNECTORS listed SA1-VIC1. The PD7DAY file publishes Heywood as V-SA, which SA1_INTERCONNECTORS on the next line already used. Because the VIC1 id never matched a key in the parsed result, narrow_result() dropped it and VIC1 ended up with no Heywood sensor while SA1 had one. Corrected to V-SA.

The entity set changed from restart to restart (#48)

Interconnector entities were created only for ids present in the coordinator's data at the moment setup ran:

if ic_id in (live_ic_ids or region_ic_ids):

Three outcomes were reachable for the same install. A populated coordinator created only what that one fetch contained. An empty coordinator fell through the or and created the full static set. A partial fetch silently created neither an entity nor a log line for the interconnector it was missing.

That last case is the damaging one. A missing entity is not an unavailable entity: it drops out of dashboards, breaks templates and automations that reference it, and leaves no recorder history, with nothing logged to explain it. It also made entity counts useless as a release signal, since a count after one restart could not be compared with a count after another.

Entities now come from the static region map alone. PD7DayInterconnectorSensor.available already returns False when the coordinator holds no row for the id, so an interconnector with no data reports unavailable, which is the behaviour the rest of the integration follows for missing data.

NSW1 was missing Terranora on a live install (#47)

N-Q-MNSP1 is mapped to both QLD1 and NSW1 and was present in the data, with the QLD1 side reporting -164.043 MW, yet NSW1 carried no such entity. The cause was not established from the REST side, because a disabled registry entry is invisible to both /api/states and integration_entities() and the entity registry is WebSocket only.

Removing the live gate covers the case where the entity was never added. If it was instead disabled in the registry, that will not be fixed by code and the issue stays open. A DEBUG line now records what was created and which of those have no data in the current result, so the next restart distinguishes the two without guesswork:

PD7DAY NSW1 interconnector entities created=['N-Q-MNSP1', 'NSW1-QLD1', 'VIC1-NSW1'], of which without data in this result=[]

#47 is left open until a restart confirms which case it was.

Tests

Five added, 560 passing against a 555 baseline.

Upgrade effect

VIC1 users gain one sensor, Heywood. Regions whose interconnectors were absent from the fetch at setup time gain those entities in an unavailable state rather than having them missing. Nothing is renamed or removed, so there is no migration.

…nistic

VIC1_INTERCONNECTORS listed SA1-VIC1, which AEMO does not publish, so VIC1
never got a Heywood sensor while SA1 did. Corrected to V-SA.

Interconnector entities were gated on the contents of the fetch that happened
to be in hand at setup, so the entity set varied between restarts and an
interconnector missing from one file disappeared entirely rather than
reporting unavailable. Entities now come from the static region map, and a
DEBUG line records which of them have no data in the current result.

Fixes #46
Fixes #48
@purcell-lab
purcell-lab merged commit 91f4ee9 into main Sep 1, 2026
3 checks passed
@purcell-lab
purcell-lab deleted the fix/interconnector-map-and-determinism branch September 1, 2026 03:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant