span-panel-api-schema-1 1.4.0b1__tar.gz → 1.4.0b2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. {span_panel_api_schema_1-1.4.0b1 → span_panel_api_schema_1-1.4.0b2}/CHANGELOG.md +2 -0
  2. {span_panel_api_schema_1-1.4.0b1 → span_panel_api_schema_1-1.4.0b2}/PKG-INFO +1 -1
  3. {span_panel_api_schema_1-1.4.0b1 → span_panel_api_schema_1-1.4.0b2}/pyproject.toml +1 -1
  4. {span_panel_api_schema_1-1.4.0b1 → span_panel_api_schema_1-1.4.0b2}/src/span_panel_api_schema_1/panel.py +27 -23
  5. {span_panel_api_schema_1-1.4.0b1 → span_panel_api_schema_1-1.4.0b2}/src/span_panel_api_schema_1/snapshot.py +2 -2
  6. {span_panel_api_schema_1-1.4.0b1 → span_panel_api_schema_1-1.4.0b2}/.gitignore +0 -0
  7. {span_panel_api_schema_1-1.4.0b1 → span_panel_api_schema_1-1.4.0b2}/README.md +0 -0
  8. {span_panel_api_schema_1-1.4.0b1 → span_panel_api_schema_1-1.4.0b2}/spec/catalogs/breaker.json +0 -0
  9. {span_panel_api_schema_1-1.4.0b1 → span_panel_api_schema_1-1.4.0b2}/spec/catalogs/charge-limit.json +0 -0
  10. {span_panel_api_schema_1-1.4.0b1 → span_panel_api_schema_1-1.4.0b2}/spec/catalogs/connection.json +0 -0
  11. {span_panel_api_schema_1-1.4.0b1 → span_panel_api_schema_1-1.4.0b2}/spec/catalogs/door.json +0 -0
  12. {span_panel_api_schema_1-1.4.0b1 → span_panel_api_schema_1-1.4.0b2}/spec/catalogs/grid-forming.json +0 -0
  13. {span_panel_api_schema_1-1.4.0b1 → span_panel_api_schema_1-1.4.0b2}/spec/catalogs/grid.json +0 -0
  14. {span_panel_api_schema_1-1.4.0b1 → span_panel_api_schema_1-1.4.0b2}/spec/catalogs/info.json +0 -0
  15. {span_panel_api_schema_1-1.4.0b1 → span_panel_api_schema_1-1.4.0b2}/spec/catalogs/load-shed.json +0 -0
  16. {span_panel_api_schema_1-1.4.0b1 → span_panel_api_schema_1-1.4.0b2}/spec/catalogs/meter.json +0 -0
  17. {span_panel_api_schema_1-1.4.0b1 → span_panel_api_schema_1-1.4.0b2}/spec/catalogs/pcs.json +0 -0
  18. {span_panel_api_schema_1-1.4.0b1 → span_panel_api_schema_1-1.4.0b2}/spec/catalogs/power-flows.json +0 -0
  19. {span_panel_api_schema_1-1.4.0b1 → span_panel_api_schema_1-1.4.0b2}/spec/catalogs/shed-forecast.json +0 -0
  20. {span_panel_api_schema_1-1.4.0b1 → span_panel_api_schema_1-1.4.0b2}/spec/catalogs/shed.json +0 -0
  21. {span_panel_api_schema_1-1.4.0b1 → span_panel_api_schema_1-1.4.0b2}/spec/catalogs/soc.json +0 -0
  22. {span_panel_api_schema_1-1.4.0b1 → span_panel_api_schema_1-1.4.0b2}/spec/catalogs/status.json +0 -0
  23. {span_panel_api_schema_1-1.4.0b1 → span_panel_api_schema_1-1.4.0b2}/spec/catalogs/switch.json +0 -0
  24. {span_panel_api_schema_1-1.4.0b1 → span_panel_api_schema_1-1.4.0b2}/spec/registries/device-types.md +0 -0
  25. {span_panel_api_schema_1-1.4.0b1 → span_panel_api_schema_1-1.4.0b2}/src/span_panel_api_schema_1/__init__.py +0 -0
  26. {span_panel_api_schema_1-1.4.0b1 → span_panel_api_schema_1-1.4.0b2}/src/span_panel_api_schema_1/adapter.py +0 -0
  27. {span_panel_api_schema_1-1.4.0b1 → span_panel_api_schema_1-1.4.0b2}/src/span_panel_api_schema_1/adoption.py +0 -0
  28. {span_panel_api_schema_1-1.4.0b1 → span_panel_api_schema_1-1.4.0b2}/src/span_panel_api_schema_1/catalog.py +0 -0
  29. {span_panel_api_schema_1-1.4.0b1 → span_panel_api_schema_1-1.4.0b2}/src/span_panel_api_schema_1/charge_limit.py +0 -0
  30. {span_panel_api_schema_1-1.4.0b1 → span_panel_api_schema_1-1.4.0b2}/src/span_panel_api_schema_1/circuits.py +0 -0
  31. {span_panel_api_schema_1-1.4.0b1 → span_panel_api_schema_1-1.4.0b2}/src/span_panel_api_schema_1/const.py +0 -0
  32. {span_panel_api_schema_1-1.4.0b1 → span_panel_api_schema_1-1.4.0b2}/src/span_panel_api_schema_1/description.py +0 -0
  33. {span_panel_api_schema_1-1.4.0b1 → span_panel_api_schema_1-1.4.0b2}/src/span_panel_api_schema_1/devices.py +0 -0
  34. {span_panel_api_schema_1-1.4.0b1 → span_panel_api_schema_1-1.4.0b2}/src/span_panel_api_schema_1/extension.py +0 -0
  35. {span_panel_api_schema_1-1.4.0b1 → span_panel_api_schema_1-1.4.0b2}/src/span_panel_api_schema_1/field_metadata.py +0 -0
  36. {span_panel_api_schema_1-1.4.0b1 → span_panel_api_schema_1-1.4.0b2}/src/span_panel_api_schema_1/firmware.py +0 -0
  37. {span_panel_api_schema_1-1.4.0b1 → span_panel_api_schema_1-1.4.0b2}/src/span_panel_api_schema_1/py.typed +0 -0
  38. {span_panel_api_schema_1-1.4.0b1 → span_panel_api_schema_1-1.4.0b2}/src/span_panel_api_schema_1/reference/parent_child_tree.json +0 -0
  39. {span_panel_api_schema_1-1.4.0b1 → span_panel_api_schema_1-1.4.0b2}/src/span_panel_api_schema_1/spec_lock.json +0 -0
  40. {span_panel_api_schema_1-1.4.0b1 → span_panel_api_schema_1-1.4.0b2}/src/span_panel_api_schema_1/transport.py +0 -0
@@ -33,6 +33,8 @@ Requires `span-panel-api` **3.8.0 or newer**, whose snapshot fields accept the u
33
33
 
34
34
  - **A circuit whose shed priority is `UNKNOWN` is no longer reported as sheddable.**
35
35
  - **The grid-forming device name falls back to vendor and model instead of showing a device id.**
36
+ - **A panel with no MID reports `dsm_state` `DSM_ON_GRID` and `current_run_config` `PANEL_ON_GRID` whenever it is publishing**, where both dropped to `UNKNOWN` each time `power-flows/grid` read within 1 W of zero
37
+ ([#215](https://github.com/SpanPanel/span-panel-api/issues/215)).
36
38
 
37
39
  ## [1.2.2]
38
40
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: span-panel-api-schema-1
3
- Version: 1.4.0b1
3
+ Version: 1.4.0b2
4
4
  Summary: Parent/child schema (data-model-version 1.x) parser for span-panel-api
5
5
  Project-URL: Homepage, https://github.com/SpanPanel/span-panel-api
6
6
  Project-URL: Issues, https://github.com/SpanPanel/span-panel-api/issues
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "span-panel-api-schema-1"
3
- version = "1.4.0b1"
3
+ version = "1.4.0b2"
4
4
  description = "Parent/child schema (data-model-version 1.x) parser for span-panel-api"
5
5
  authors = [
6
6
  {name = "SpanPanel"}
@@ -623,11 +623,6 @@ def build_pcs(panel: DiscoveredDevice) -> SpanPcsSnapshot | None:
623
623
  )
624
624
 
625
625
 
626
- # Matches `schema_0`'s epsilon so the no-MID heuristic answers identically on the two
627
- # adapters — the tier exists precisely for panels where nothing authoritative is
628
- # published, and disagreeing about the threshold would make it schema-dependent.
629
- _GRID_POWER_EPSILON_W = 1.0
630
-
631
626
  ISLANDING_ON_GRID = "ON_GRID"
632
627
  ISLANDING_OFF_GRID = "OFF_GRID"
633
628
 
@@ -639,8 +634,8 @@ def resolve_islanding_state(mid: DiscoveredDevice | None, panel: DiscoveredDevic
639
634
  | --- | --- | --- |
640
635
  | 1 | `shed/asserted-islanding-state` is `ON_GRID` or `OFF_GRID` | asserted |
641
636
  | 2 | MID `$state` is `ready` and `islanding-state` present | sensed |
642
- | 3 | no MID at all | `power-flows/grid` heuristic |
643
- | 4 | none of the above | unknown |
637
+ | 3 | no MID at all | on-grid, by elimination |
638
+ | 4 | a MID that has not answered | unknown |
644
639
 
645
640
  **An assertion in force is the effective state, so it outranks the MID.** When the
646
641
  panel's link to the battery is not healthy (the battery's `status/communication-state`
@@ -651,12 +646,25 @@ def resolve_islanding_state(mid: DiscoveredDevice | None, panel: DiscoveredDevic
651
646
  different one. The assertion clears itself back to `NONE` once the battery link
652
647
  recovers, so the MID's answer returns without anything here having to expire it.
653
648
 
654
- **Tier 3 never answers `OFF_GRID`, and never asserts on-grid from a missing MID.** An
655
- earlier draft reasoned that no MID means no islanding authority means on-grid. That is
656
- wrong: a missing MID means *SPAN* is not the islanding authority, and says nothing
657
- about whether the site is islanded — a generator-fed island is the plain
658
- counterexample. Grid power flowing is positive evidence of being on-grid; its absence
659
- is not evidence of the opposite.
649
+ **No MID at all means on-grid, and tier 3 never answers `OFF_GRID`.** A commissioned
650
+ MID is what a SPAN panel islands with, so a panel without one cannot separate from
651
+ whatever feeds it, and what feeds it is what SPAN treats as the grid. This is the
652
+ elimination `resolve_dominant_power_source` makes, and the two now agree on every
653
+ tree. A panel that loses that feed loses power and stops publishing, so the answer
654
+ is withdrawn with the panel rather than left standing.
655
+
656
+ Tier 3 read `power-flows/grid` before, and answered on-grid only above 1 W, on the
657
+ reasoning that a missing MID says nothing about whether the site is islanded — a
658
+ generator-fed island being the counterexample. The threshold never defended that
659
+ case: a generator-fed panel carrying any load reads far above it and was reported
660
+ on-grid all the same. What it did was withdraw the answer each time the reading
661
+ touched zero, which a sub-panel with a small net draw does many times a day, and a
662
+ consumer saw each return as the grid coming back. How much power is flowing says
663
+ nothing about where it comes from, so the reading no longer takes part.
664
+
665
+ `mid is None` means no MID is declared, not that one has yet to be discovered: the
666
+ adapter builds no snapshot until every device the tree declares has described
667
+ itself. A MID that exists and has not answered is tier 4, and stays unknown.
660
668
  """
661
669
  asserted = text(panel, NODE_SHED, PROP_ASSERTED_ISLANDING_STATE)
662
670
  if asserted in (ISLANDING_ON_GRID, ISLANDING_OFF_GRID):
@@ -669,10 +677,7 @@ def resolve_islanding_state(mid: DiscoveredDevice | None, panel: DiscoveredDevic
669
677
  return sensed
670
678
  return None
671
679
 
672
- grid_power = number(panel, NODE_POWER_FLOWS, "grid")
673
- if grid_power is not None and abs(grid_power) > _GRID_POWER_EPSILON_W:
674
- return ISLANDING_ON_GRID
675
- return None
680
+ return ISLANDING_ON_GRID
676
681
 
677
682
 
678
683
  def resolve_dsm_state(islanding: str | None) -> str:
@@ -800,12 +805,11 @@ def resolve_dominant_power_source(
800
805
  A site genuinely running off-grid without storage is not a counterexample; it goes
801
806
  dark at sunset.
802
807
 
803
- This deliberately does **not** follow `resolve_islanding_state`, which refuses the
804
- same shortcut. The two answer different questions and the counterexample that defeats
805
- it there is the one that supports it here: a generator-fed island is islanded — so
806
- inferring on-grid from a missing MID would be wrong — while its grid-forming entity
807
- really is what SPAN calls the grid. Islanding is a safety fact about separation; this
808
- is a class of source.
808
+ `resolve_islanding_state` rests on the same elimination and answers on-grid for the
809
+ same trees. It refused the shortcut at first, on the grounds that a generator-fed
810
+ island is islanded, and read grid power instead — which reported that same island
811
+ on-grid whenever it carried load. A source with no MID interface is the grid as far
812
+ as SPAN can tell, and both fields now say so.
809
813
 
810
814
  It is also no worse than flat, which is the bar. Flat could not see an uninterfaced
811
815
  generator either and published `GRID` regardless; a panel upgrading to v1.0 keeps the
@@ -252,8 +252,8 @@ def build_snapshot(panel: DiscoveredDevice, children: list[DiscoveredDevice]) ->
252
252
  feedthrough_energy_produced_wh=fields.feedthrough_energy_produced_wh,
253
253
  # Read, not derived. Flat had to infer both from `dominant-power-source`
254
254
  # plus grid power because nothing stated them; v1.0 states them on the MID,
255
- # so the multi-signal heuristic is gone and only the no-MID tier remains a
256
- # heuristic. The user-visible value set is unchanged.
255
+ # so the multi-signal heuristic is gone, and a panel with no MID is on-grid
256
+ # by elimination. The user-visible value set is unchanged.
257
257
  dsm_state=resolve_dsm_state(islanding),
258
258
  current_run_config=resolve_run_config(roles.mid, islanding, device_types),
259
259
  door_state=fields.door_state,