fix: consolidate controller statistics widgets

This commit is contained in:
2026-09-20 16:53:38 +03:00
parent e0404617d2
commit 7f49335847
3 changed files with 23 additions and 9 deletions
@@ -25,10 +25,18 @@ configuration.
- For current states across controllers, call `shd_get_home_live_state`, then
`shd_render_controller_live_state_widget`.
- For one presence, binary state or numeric sensor statistics, call
`shd_get_controller_state_statistics`, then
`shd_render_controller_statistics_widget`. The server result is authoritative
for counts, intervals, durations, percentages, medians and hourly buckets;
do not calculate them from raw history in the model.
`shd_get_controller_state_statistics` once for the exact canonical
controller/item/source series, then call
`shd_render_controller_statistics_widget` once with that final result. For a
request containing several explicitly named rooms/sensors or an all-together
request, resolve only matching requested measurements, call the data tool once per selected series, collect the complete
results with visible room/item labels into one `data.series` collection, and
call the render tool once for the collection. The server result is
authoritative for counts, intervals, durations, percentages, medians and
hourly buckets; do not calculate them from raw history in the model. Do not
enumerate every inventory match, render retries/intermediate results or an
unavailable optional source. Resolve controller and item IDs from
topology/inventory, not display names.
- For raw time-series history, call `shd_get_controller_source_history`, then
`shd_render_controller_history_widget`. Keep the detailed rows in the widget
after a successful render and use plain text only when the UI call is
@@ -24,7 +24,7 @@ readback. Do not invent fields, statuses, identifiers, routes or capabilities.
- Notifications, preferences or read state: use Notifications tools and the `shd-notifications` workflow.
- Inventory, stock, assets, procurement or stocktakes: use Inventory tools and the `shd-inventory` workflow.
- Agents, controllers, diagnostics, tunnels or network access: use Agents tools and the `shd-agents-operations` workflow.
- Controller devices, current states, presence/history or sensor statistics: use the controller-integrations source tools; in a UI-capable host call the matching controller render tool after the data tool and before the final response (`shd_render_controller_devices_widget`, `shd_render_controller_live_state_widget`, `shd_render_controller_history_widget` or `shd_render_controller_statistics_widget`).
- Controller devices, current states, presence/history or sensor statistics: use the controller-integrations source tools; in a UI-capable host call the matching controller render tool after the data tool and before the final response (`shd_render_controller_devices_widget`, `shd_render_controller_live_state_widget`, `shd_render_controller_history_widget` or `shd_render_controller_statistics_widget`). For one statistics series, render the final result once; for several explicitly requested series, collect them into one `data.series` collection and render one summary widget, not one widget per retry, metric field or inventory match.
- Status-page monitors, history, groups or incidents: use Status Page tools and the `shd-status-page` workflow.
- Realtime sessions, event cursors or historical activity: use Realtime tools and the `shd-realtime-activity` workflow.
- Terms documents, revisions, completeness or contract discussions: use Terms tools and the `shd-terms-contracts` workflow.