📝 Document stream→device mapping in README #51
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "docs-stream-mapping"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Extends the Realtime streaming (optional) section of the README with a new
### Mapping streamed measurements to devicessubsection, capturing findings confirmed by a live 3-minutestream_measurementsspike against a gen4 account plus a rawget_devices()dump.Findings added
capacityId↔get_devices():Measurement.capacity_idis thecapacityIdstring atfeature.capacities[].capacity.capacityId; the same capacity object carriesdeviceId,nature,measureKind,phase, andproduction(bool) — route + sign with no separate map.SENSORcapacities (3-phase inverter →instances.0/1/2); instantaneous power is the sum of itsFLOWcapacities, not one instance. Each capacity has aphase(POSITIVE_1/2/3).value_float(FLOW, watts),value_bool(STATE, on/off);Measurement.valueis the raw string — prefer the typed field.co.{N}segment), not a fixed per-device poll....sensor.N.withdrawal.data/.injection.data) and battery (...battery_charge.data/.battery_discharge.data)capacityIds have no match inget_devices();GRID_METERandBATTERYreturn empty capacity lists — route viaget_site_time_seriesor ignore on the stream.STATEon...switch.N.data(parallel to...sensor.N.dataFLOW);CapacityChangedis also yielded for switch changes, keyed by the numeric capacityid(not thecapacityIdstring) — don't match it against the string route. Not observed during the spike (no manual toggle).Snippet
Adds a minimal, comment-free
capacityId → (deviceId, nature, production)route built fromget_devices(), reusing the nested-loop idiom already in the usage examples.Docs only — no code or behavior change.
Extend the 'Realtime streaming (optional)' section with a new 'Mapping streamed measurements to devices' subsection capturing findings from a live 3-minute stream_measurements spike + raw get_devices() dump: - capacityId ↔ get_devices(): Measurement.capacity_id is the capacity.capacityId string; the same object carries deviceId, nature, measureKind, phase, production (bool) for routing + sign. - Multi-instance/polyphase devices expose several SENSOR capacities; instantaneous power is the sum of FLOW capacities, not one instance. - Typed value fields: value_float (FLOW watts), value_bool (STATE); Measurement.value is the raw string — prefer the typed field. - Cadence: bursts roughly every ~15s grouped per connected object (the co.{N} segment), not a fixed per-device poll. - Unmappable capacityIds (grid withdrawal/injection, battery charge/discharge) have no get_devices() capacity; GRID_METER and BATTERY return empty capacity lists — route via get_site_time_series or ignore on the stream. - Switch state arrives as STATE on ...switch.N.data (parallel to ...sensor.N.data FLOW); CapacityChanged is also yielded for switch changes, keyed by the numeric capacity id (not the capacityId string). Adds a minimal capacityId → (deviceId, nature, production) route snippet built from get_devices().b7f63bcd88642e374eb2Document stream→device mapping in READMEto 📝 Document stream→device mapping in READMECorrections verified against a live Comwatt account: - capacityId format: grid/battery capacities keep the 'sensor.{j}' segment (…sensor.{j}.withdrawal.data etc.), not the bare '…instances.{i}.withdrawal.data' form the original parenthetical implied. These are ~24% of stream measurements. - get_devices() hides grid/battery: parents return empty 'features' AND 'capacities' (devices have no 'natures' list — identity is on 'deviceKind.code'); part-children WITHDRAWAL/INJECTION/BATTERY_CHARGE/BATTERY_DISCHARGE route via get_connected_objects(). - 'phase' is only on polyphase capacities, not every capacity. - value_float/value_bool are parsed from the raw string by value shape, not gated on measure_kind (in practice FLOW→value_float, STATE→value_bool, verified with zero overlap across 328 samples). - Split the two run-on bullets; drop 'the spike' internal jargon. - Finish the route snippet with a usage/print line.