1Summary and key decisions
The platform is a set of containers that runs the same way on an on-premise server, a single VPS or any cloud. An on-site edge gateway reads BACnet data and streams it over MQTT. The data is normalised once, stored in PostgreSQL (business data) and ClickHouse (time-series), and served by a modular Core API to the twin, CMMS, energy and dashboard screens.
| # | Decision | Choice | Why |
|---|---|---|---|
| D1 | Architecture style | Modular monolith for business logic + separate stream workers | Small team, internal product first. Clear module boundaries, so modules can become services later. |
| D2 | Edge to platform | Edge gateway polls BACnet, publishes MQTT over TLS, outbound only | No inbound firewall ports; 72 h buffering; same for every hosting option. |
| D3 | Event bus | Apache Kafka (KRaft mode, no ZooKeeper) | Replay, back-pressure, many consumers; Apache 2.0; one node for small installs, a cluster for HA. |
| D4 | Databases | PostgreSQL for business data + ClickHouse for time-series | Both fully open source. PostgreSQL for transactions, outbox and sagas; ClickHouse for about 10× compression and fast roll-ups over billions of readings. |
| D5 | Data model | One canonical reading; points tagged with Brick classes | Modules never parse vendor formats; rules work on any building. |
| D6 | 3D | IFC / FBX converted to glTF / Fragments; Three.js + That Open Engine | Fast browser loading; open-source. |
| D7 | Identity | Keycloak (OIDC / SAML, MFA) | Works offline on-prem; federates with Azure AD / LDAP. |
| D8 | Deployment | Containers + Helm: Docker Compose or k3s on one VPS, RKE2 on-prem cluster, any managed Kubernetes | Only portable dependencies (PostgreSQL, S3 API, Kafka API, MQTT, OIDC). No cloud lock-in. |
| D9 | Tenancy | Single tenant now; tenant_id everywhere from day one | Ready to sell later without a redesign. |
| D10 | Publishing events | Transactional outbox + idempotent inbox (Wolverine) | No lost or phantom events when a pod or broker fails. |
| D11 | Multi-step processes | Orchestrated sagas with compensating actions (Wolverine) | Consistency across modules and workers without distributed transactions. |
| D12 | Backend platform | ASP.NET Core on .NET 10 LTS (C#); Python only for BACnet edge, analytics / ML and BIM conversion; React + TypeScript front ends | Best mix of performance, built-in outbox / saga support, long-term support and enterprise fit. See section 3. |
| D13 | Duplicate safety | Idempotency at every layer: stable message IDs, unique keys, inbox, Idempotency-Key on API writes | At-least-once delivery everywhere, effectively-once results. See section 8A. |
| D14 | Licensing | 100% open source, zero licence fees (OSI-approved licences only) | No lock-in or future licence costs, including if the product is sold. Proposed default; trade-offs per component in section 3 (OD-2). |
2Overall architecture
Data flows top to bottom. Controllers feed the edge gateway, the platform normalises every reading once, and all modules share the same data. Highlighted boxes are the parts we build ourselves.
2ASensor-to-dashboard data flow
This is the path one sensor reading takes, from the physical sensor to the live dashboard and the trend charts. The upper lanes run left to right on site and through ingestion; the lower lanes run back to the user. Once a value reaches the platform, it appears on screen within 5 seconds (p95).
Step by step
| # | Step | What happens | Where |
|---|---|---|---|
| 1 | Sensor | Measures a physical value (temperature, flow, kW, CO₂) and sends it to its controller over wiring or a field bus. | Building |
| 2 | Controller | Honeywell / JCI controller runs its own control loop and exposes the value as a BACnet object (e.g. analog-input:12). | Building |
| 3 | Read | Gateway reads the object with ReadPropertyMultiple on the point's interval, or receives a COV notification when it changes. | Edge gateway |
| 4 | Filter + buffer | Applies the deadband and heartbeat, timestamps in UTC, and writes the reading to the local SQLite buffer. If the uplink is down, readings wait (≥ 72 h) and are replayed in order. | Edge gateway |
| 5 | Publish | Batches readings, compresses them and publishes over MQTT 5 / TLS (QoS 1) on t/{tenant}/s/{site}/gw/{id}/data. | Edge gateway |
| 6 | Mosquitto broker | Checks the gateway's certificate and topic permissions, then accepts the batch. | Platform |
| 7 | raw.readings | Ingest bridge writes the batch, unchanged, to the raw.readings Kafka topic (also archived for 30 days). | Platform |
| 8 | Normaliser | Vendor adapter parses the batch; maps (gateway, device, object) to a point_id; converts units; sets quality; validates. Failures go to the dead-letter queue; unknown objects go to “discovered points”. | Platform (.NET worker) |
| 9 | canonical.readings | One canonical reading per message, keyed by point_id. | Platform |
| 10 | TS writer | Consumes canonical readings in batches and inserts them into ClickHouse, using the batch ID as the insert de-duplication token; the table also collapses duplicate (point, ts) rows (section 8A). | Platform (.NET worker) |
| 11 | Valkey | Updates the last value per point and publishes a change notice. | Platform |
| 12 | ClickHouse | Stores the raw reading in a compressed column store; the roll-up job keeps the 15-min, 1-h and 1-day tables current. | Platform |
| 13 | Live hub | SignalR hub sends the change to every browser subscribed to that point, floor or asset (at most one update per point per second). | Core API (ASP.NET Core) |
| 14 | Dashboard | React updates the widget value, colour state and 3D twin overlay without reloading the page. | Browser |
| 15 | Trend API | When a user opens a chart, the API picks raw, 15-min or hourly data depending on the time range. | Core API (ASP.NET Core) |
| 16 | Trend charts | ECharts draws history, period comparisons and min / max bands; export to CSV / PNG. | Browser |
canonical.readings topic (step 9) in parallel, so alarms appear on the dashboard through the same live hub. That path is described in section 10.3Technology stack and rationale
Recommended stack: ASP.NET Core on .NET 10 LTS for the platform, Python only where it is clearly the strongest tool, and React + TypeScript for the user interfaces. All components run in Linux containers without internet access, so the same build deploys on-premise, on a VPS or in any cloud.
C# / ASP.NET Core — the platform
Core API and all business modules, outbox / inbox / sagas, live updates (SignalR), jobs, and the high-volume stream workers (normaliser, TS writer, alarm and FDD engines).
Python — specialist services
BACnet edge gateway and simulator (bacpypes3), analytics and machine learning (baselines, forecasts, anomaly detection), and IFC / FBX conversion (IfcOpenShell).
TypeScript — user interfaces
One responsive React web app for every role: dashboards and the 3D twin on desktop, and a technician view for phones and tablets in the browser. No native mobile app.
Selection principles
- Reliability first: mature, widely used components with long-term support releases.
- Runs anywhere: only open protocols and portable dependencies; no cloud-specific services; works fully offline.
- Built-in patterns, not custom plumbing: outbox, sagas, retries, real-time push and scheduling come from proven libraries.
- Performance per server: handle tens of thousands of readings per second on modest hardware, which keeps on-premise costs low.
- Right tool per job, but few languages: two back-end languages (C#, Python) plus TypeScript for front ends.
- Licence-safe for resale: permissive licences (MIT / Apache / BSD) preferred; anything else flagged.
- Hiring and support: skills that are easy to find in India and Saudi Arabia, with strong enterprise adoption.
Why ASP.NET Core for the platform
| Criterion | ASP.NET Core (.NET 10) | NestJS (Node.js) | Spring Boot (Java) | FastAPI (Python) |
|---|---|---|---|---|
| Throughput / efficiency | Very high; compiled, async, low memory | Good; single-threaded event loop | Very high; heavier memory | Moderate |
| Outbox, inbox and sagas | Built in via Wolverine (MIT) | Custom code or smaller libraries | Axon / Eventuate (heavier, some commercial) | Mostly custom |
| Real-time push | SignalR built in, Valkey scale-out | Socket.IO | WebSocket / STOMP | Basic WebSocket |
| Type safety and maintainability | Strong static typing, mature tooling | Good (TypeScript) | Strong | Optional typing |
| Long-term support | LTS: 3 years per release from Microsoft | Node LTS; framework community-led | Commercial support available | Community |
| Enterprise fit (KSA / India) | Very common in government and enterprise IT | Common in start-ups | Very common in large enterprises | Common in data teams |
| Runs on Linux / Windows / containers | Yes, all | Yes | Yes | Yes |
| Analytics / ML | Limited (ML.NET) | Limited | Limited | Best |
Result: ASP.NET Core gives the best balance for the transactional core (CMMS, twin, alarms, sagas) and for high-volume data processing. Python stays for analytics, BACnet and IFC, where its libraries are the most mature. Spring Boot would also work, but needs more memory per service and has fewer free saga options.
Full stack
Every component is open source with no licence fee. Use Docker Engine (Apache-2.0), not Docker Desktop, which needs a paid subscription for larger organisations.
| Layer | Technology | Licence | Why this choice |
|---|---|---|---|
| Edge gateway | Python 3.12 · bacpypes3 · SQLite buffer · Docker | Python (PSF-2.0) · bacpypes3 (MIT) · SQLite (Public domain) · Docker Engine (Apache-2.0) | Most complete open-source BACnet stack (COV, ReadRange, routing); small footprint on industrial PCs |
| Device messaging | Eclipse Mosquitto (MQTT 5) | Mosquitto (EPL-2.0 / EDL-1.0) | Proven, lightweight broker; X.509 client certificates and topic ACLs; active / standby pair for HA (gateways buffer during fail-over) |
| Event bus | Apache Kafka (KRaft) · Kafbat UI | Apache Kafka (Apache-2.0) · Kafbat UI (Apache-2.0) | Industry standard; no ZooKeeper needed; replay and partitions for scale; one node or a cluster |
| Core API | ASP.NET Core 10 · Minimal APIs / controllers · EF Core 10 + Npgsql | ASP.NET Core (MIT) · EF Core (MIT) · Npgsql (PostgreSQL) | High performance, strong typing, first-class PostgreSQL support, LTS until Nov 2028 |
| Outbox / inbox / saga | Wolverine (MIT) with PostgreSQL persistence and Kafka transport | Wolverine (MIT) | Transactional outbox, inbox de-duplication, saga state, retries and scheduled timeouts built in |
| Real-time | SignalR + Valkey backplane | SignalR (MIT) · Valkey (BSD-3) | Built into ASP.NET Core; automatic fallback; scales across replicas |
| Jobs & timers | Quartz.NET (clustered, PostgreSQL store) | Quartz.NET (Apache-2.0) | PPM generation, SLA timers, escalations, scheduled reports; Apache licence |
| Stream workers | .NET Worker Services · Confluent.Kafka · ClickHouse.Client · UnitsNet | .NET (MIT) · Confluent.Kafka (Apache-2.0) · ClickHouse.Client (MIT) · UnitsNet (MIT-0) | Normaliser, TS writer (ClickHouse batch inserts), alarm, FDD and data-quality engines at high throughput |
| Analytics / ML | Python · pandas, statsmodels, scikit-learn, LightGBM · FastAPI (internal) | pandas, statsmodels, scikit-learn (BSD-3) · LightGBM (MIT) · FastAPI (MIT) | Best ecosystem for baselines, forecasting and anomaly detection |
| Cross-cutting .NET libraries | FluentValidation · Mapster · Polly · Serilog · OpenTelemetry · Scalar (API docs) | FluentValidation (Apache-2.0) · Mapster (MIT) · Polly (BSD-3) · Serilog (Apache-2.0) · OpenTelemetry (Apache-2.0) · Scalar (MIT) | Permissive licences; avoids libraries that moved to commercial licences |
| Business database | PostgreSQL 17 · Patroni · pgBackRest | PostgreSQL (PostgreSQL) · Patroni (MIT) · pgBackRest (MIT) | Twin, CMMS, outbox, sagas, audit; HA and point-in-time recovery |
| Time-series database | ClickHouse + ClickHouse Keeper | ClickHouse + Keeper (Apache-2.0) | Column store built for sensor data: about 10× compression, fast aggregates, TTL retention, native Parquet / S3 archives |
| Cache | Valkey 8 (Sentinel) | Valkey (BSD-3) | Linux Foundation fork, Redis-compatible; live values, SignalR backplane, rate limits |
| Object storage | SeaweedFS or any S3-compatible service | SeaweedFS (Apache-2.0) | S3 API on-premise; the same code works with any cloud S3 |
| BIM processing | Python · IfcOpenShell · web-ifc / Fragments · Assimp / ufbx | IfcOpenShell (LGPL-3.0) · web-ifc (MPL-2.0) · Fragments (MIT) · Assimp (BSD-3) · ufbx (MIT / Unlicense) | Most capable open IFC toolkit; FBX read without the proprietary Autodesk SDK; fast web formats for the 3D viewer |
| Web | React + TypeScript · Vite · MUI (RTL) · Apache ECharts · Three.js + That Open Engine · i18next | React (MIT) · TypeScript (Apache-2.0) · Vite (MIT) · MUI Core (MIT) · ECharts (Apache-2.0) · Three.js (MIT) · That Open Engine (MIT) · i18next (MIT) · html5-qrcode (Apache-2.0) | Largest UI ecosystem; strong 3D and charting; full Arabic RTL support |
| API contract | OpenAPI 3.1 → generated TypeScript clients (Kiota / NSwag) | OpenAPI spec (Apache-2.0) · Kiota (MIT) · NSwag (MIT) | Front ends stay in sync with the API automatically |
| Identity | Keycloak | Keycloak (Apache-2.0) | OIDC / SAML, MFA, Azure AD / LDAP; runs offline on-prem |
| Ingress | Traefik + cert-manager | Traefik (MIT) · cert-manager (Apache-2.0) | Automatic TLS, routing, rate limiting on any Kubernetes or Docker host |
| Reports | HTML templates → Playwright for .NET (PDF) · ClosedXML (Excel) | Playwright for .NET (Apache-2.0) · Chromium (BSD-3) · ClosedXML (MIT) | Same templates for screen and PDF; permissive licences |
| Testing | xUnit · Testcontainers · Playwright (E2E) · Locust (load) | xUnit (Apache-2.0) · Testcontainers (MIT) · Playwright (Apache-2.0) · Locust (MIT) | Real PostgreSQL / Kafka in tests; load tests against the simulator |
| Platform | Docker Compose · k3s · RKE2 · any managed Kubernetes · Helm · Argo CD | Docker Engine / Compose (Apache-2.0) · Kubernetes, k3s, RKE2, Helm, Argo CD (Apache-2.0) | One install method from a single VPS to a multi-node cluster |
| Observability | Prometheus · Alertmanager · VictoriaLogs · Jaeger · OpenTelemetry · Grafana OSS | Prometheus, Alertmanager, VictoriaLogs, Jaeger, OpenTelemetry (Apache-2.0) · Grafana OSS (AGPL-3.0, unmodified) | Open standards; .NET and Python both export OpenTelemetry natively |
| Security | OpenBao · Trivy · OWASP ZAP · Falco (optional) | OpenBao (MPL-2.0) · Trivy, OWASP ZAP, Falco (Apache-2.0) | Secrets, image scanning, DAST, runtime detection |
| Copilot (Phase 3) | Open-weight LLM served locally · pgvector · Semantic Kernel (.NET) | Semantic Kernel (MIT) · pgvector (PostgreSQL) · open-weight LLM (Apache-2.0 models only) | Data stays in-house; integrates with the .NET API and its permissions |
Open-source licence policy
- Allowed: permissive licences (MIT, Apache-2.0, BSD, PostgreSQL). Weak copyleft (LGPL, MPL, EPL) and copyleft (GPL, AGPL) only for tools used unmodified and run as separate services, so they place no obligations on our own code.
- Not allowed: source-available licences (BSL, SSPL, RSAL, Elastic, Timescale License), "open-core" paid tiers, proprietary SDKs, and libraries that have moved to commercial licences. This is why the design uses Apache Kafka instead of Redpanda, Mosquitto instead of EMQX, ClickHouse instead of TimescaleDB's licensed features, Valkey instead of Redis, SeaweedFS instead of MinIO, OpenBao instead of HashiCorp Vault, Assimp instead of the Autodesk FBX SDK, Locust instead of k6, and Wolverine / Mapster instead of MassTransit, MediatR and AutoMapper.
- Enforced in CI: a licence scan (OSS Review Toolkit) checks every NuGet, npm and Python dependency and container image; a disallowed licence fails the build. The approved-licence list and the component register below are reviewed every quarter.
- Running costs that remain (not licences): servers / VPS / cloud hosting, SMS messages and domain names. No app-store accounts are needed because there is no native mobile app.
Component licence register
| Area | Components | Licence | Type / use |
|---|---|---|---|
| Back end | ASP.NET Core, .NET, EF Core | MIT | Permissive |
| Back end | Wolverine (outbox, inbox, sagas) | MIT | Permissive |
| Back end | Npgsql · ClickHouse.Client · Confluent.Kafka client | PostgreSQL · MIT · Apache-2.0 | Permissive |
| Back end | Quartz.NET · FluentValidation · Mapster · Polly · Serilog · UnitsNet · ClosedXML · Scalar | Apache-2.0 / MIT / BSD | Permissive |
| Python | Python, bacpypes3, FastAPI, pandas, statsmodels, scikit-learn, LightGBM | PSF / MIT / BSD | Permissive |
| BIM | IfcOpenShell | LGPL-3.0 | Weak copyleft: used unmodified in a separate worker |
| BIM | Assimp · ufbx · That Open Engine · web-ifc · Three.js | BSD-3 · MIT · MIT · MPL-2.0 · MIT | Permissive / weak copyleft (unmodified) |
| Data | PostgreSQL · Patroni · pgBackRest · pgvector | PostgreSQL · MIT · MIT · PostgreSQL | Permissive |
| Data | ClickHouse + ClickHouse Keeper | Apache-2.0 | Permissive |
| Messaging | Apache Kafka · Kafbat UI | Apache-2.0 | Permissive |
| Messaging | Eclipse Mosquitto | EPL-2.0 / EDL-1.0 | Weak copyleft: used unmodified |
| Data | Valkey | BSD-3-Clause | Permissive |
| Data | SeaweedFS | Apache-2.0 | Permissive |
| Security | Keycloak | Apache-2.0 | Permissive |
| Security | OpenBao (secrets) | MPL-2.0 | Weak copyleft: used unmodified |
| Security | Trivy · OWASP ZAP · gitleaks · cosign · Falco · Semgrep CE | Apache-2.0 / MIT / LGPL-2.1 | Permissive / weak copyleft (tools) |
| Security | Wazuh (optional SIEM) | GPL-2.0 | Copyleft: separate tool, unmodified |
| Platform | Kubernetes · k3s · RKE2 · Helm · Argo CD · Argo Rollouts · Traefik · cert-manager | Apache-2.0 / MIT | Permissive |
| Observability | Prometheus · Alertmanager · VictoriaLogs · Jaeger · OpenTelemetry | Apache-2.0 | Permissive |
| Observability | Grafana OSS (dashboards) | AGPL-3.0 | Copyleft: separate ops tool, unmodified (alternative: Perses, Apache-2.0) |
| Front end | React · Vite · MUI Core · Apache ECharts · i18next · MapLibre GL · html5-qrcode | MIT / Apache-2.0 / BSD-3 | Permissive (MUI Core only, not the paid MUI X Pro / Premium) |
| Testing | xUnit · Testcontainers · Pact · Locust · Chaos Mesh · Playwright | Apache-2.0 / MIT | Permissive |
| Features | OpenFeature · flagd | Apache-2.0 | Permissive |
| AI (Phase 3) | Semantic Kernel · open-weight LLM | MIT · Apache-2.0 models only | Permissive |
Open source vs licensed software: how to decide
Each component can be either free open source or licensed (commercial). Neither is always better. The comparison below sets out the trade-offs so the team can decide component by component.
Open source: advantages
- No licence fees, now or as sites, users and servers grow
- Product can be sold without paying royalties or OEM fees per client
- No vendor lock-in; runs on-prem, VPS, any cloud and offline
- Full source code: security audits, fixes and customisation are possible
- Large communities and widely available skills
Open source: disadvantages
- No guaranteed support SLA unless a support contract is bought
- Our team owns installation, upgrades, tuning and security patching
- Some enterprise features (admin consoles, geo-replication, advanced grids) are missing or need building
- Licence-change risk: some projects have moved to restrictive licences (prefer foundation-governed projects)
- Some clients' procurement teams prefer a named vendor to hold accountable
Licensed: advantages
- Vendor support with SLAs and a single party accountable
- Enterprise features ready: management UIs, replication, audit, compliance reports
- Faster delivery for some features (advanced grids, BIM viewing, reporting designers)
- Certifications and hardened builds that help in audits
- Training and certified partners available
Licensed: disadvantages
- Recurring costs per core, node, user or GB that grow with every building
- Selling the product needs redistribution / OEM licences, adding cost to every client
- Vendor lock-in, price increases and roadmap dependence
- Licence audits and compliance tracking
- Some products are cloud-only or need online activation, which conflicts with air-gapped on-prem installs
Decision criteria
| Question | Points to open source when… | Points to licensed when… |
|---|---|---|
| Will we sell the product? | Yes: avoids per-client licence costs and redistribution limits | Internal only and a vendor allows the use case at a fair price |
| Team skills | Team can run Linux, Kubernetes, PostgreSQL, Kafka | Small team without platform / DevOps experience |
| Support expectations | Internal SLA is acceptable, or a support contract can be added | Client contract requires a vendor-backed SLA for that component |
| Deployment | On-prem, air-gapped, VPS or multi-cloud | A single cloud with that vendor's managed service |
| Time to market | Feature is simple or the open-source tool is mature | A licensed component saves months (e.g. advanced data grid) |
| Budget model | Prefer spending on people and hardware, not licences | Prefer predictable subscriptions over building in-house expertise |
Component-by-component comparison
| Component | Open-source option | Licensed alternative | Open source: + / − | Licensed: + / − | Recommendation |
|---|---|---|---|---|---|
| Event bus | Apache Kafka | Confluent Platform; Redpanda Enterprise | + Free; industry standard; huge skills pool − You run upgrades and tuning; admin UI is basic | + Vendor support; management UI, tiered storage, connectors − Per-core / node subscription; lock-in to vendor tooling | Open source; buy Kafka support only if the team lacks experience |
| MQTT broker | Eclipse Mosquitto | EMQX Enterprise; HiveMQ Enterprise | + Free; very stable and light; easy to run − No built-in clustering (active / standby only); basic dashboard | + Clustering to millions of devices; rule engine; web console; support − Per-connection / node pricing; licence needed per client if resold | Open source (a few hundred gateways do not need clustering) |
| Time-series database | ClickHouse | TimescaleDB licensed features / cloud; InfluxDB Enterprise | + Free; excellent compression and speed; scales out − Second database to operate; SQL dialect differs from PostgreSQL | + Single PostgreSQL engine (Timescale); vendor support; managed cloud − Licence limits on resale / hosting (Timescale License); subscription | Open source (ClickHouse) |
| Business database | PostgreSQL | Microsoft SQL Server; Oracle | + Free; mature; strong .NET support; no core limits − Support from community or a third party | + Familiar to many enterprise DBAs; vendor support; built-in tooling − Per-core licences grow with every site; resale needs licences per client | Open source; optional commercial PostgreSQL support |
| Cache | Valkey | Redis Enterprise / Redis Software | + Free; Redis-compatible; Linux Foundation governance − Newer brand; no vendor SLA | + Active-active geo replication; support; modules − Subscription; Redis's own licence changed in 2024 | Open source |
| Object storage | SeaweedFS (or any cloud S3) | MinIO AIStor; NetApp / Dell object storage | + Free; S3 API; light − Smaller community; fewer enterprise features (e.g. object lock varies) | + Mature UI, object lock, support, appliances − Capacity-based pricing; hardware lock-in for appliances | Open source on-prem; provider S3 in cloud |
| Secrets management | OpenBao | HashiCorp Vault Enterprise; cloud KMS / Key Vault | + Free; Vault-compatible API; Linux Foundation − Younger project; community support | + Support, HSM integration, replication, namespaces − Expensive enterprise tiers; cloud KMS ties you to one cloud | Open source; use cloud KMS where already in a cloud |
| Messaging / sagas library | Wolverine | NServiceBus; MassTransit v9 | + Free (MIT); outbox, inbox, sagas built in − Smaller vendor; community support | + Very mature; commercial support; monitoring tools (ServicePulse) − Per-endpoint / per-core licences; resale costs | Open source; NServiceBus if the team wants a support contract |
| Identity / SSO | Keycloak | Microsoft Entra ID; Auth0 / Okta | + Free; runs offline on-prem; full SSO / MFA − You host, patch and back it up | + Fully managed; strong security features; easy social / enterprise logins − Per-user monthly pricing; cloud only (no air-gapped install) | Open source; federate to the client's Entra ID / AD when they have one |
| BMS gateway | Python bacpypes3 gateway | Tridium Niagara (JACE / Supervisor); commercial BACnet stacks | + Free; full control; small hardware − We build and maintain the BACnet logic | + Proven with Honeywell / JCI; drivers for many protocols; integrator ecosystem − Licence per device / point count; annual maintenance; vendor tooling | Open source gateway; consider Niagara only if the site already has it |
| 3D / BIM viewer | Three.js + That Open Engine + IfcOpenShell | Autodesk Platform Services (APS) Viewer; xeokit commercial | + Free; works offline; full control of UI − More development effort for large models | + Very fast on huge models; Revit support; less dev work − Pay-per-use cloud APIs (no offline); or commercial licence per product | Open source; revisit if very large models perform poorly |
| UI components | MUI Core + Apache ECharts | MUI X Pro / Premium; DevExpress; Telerik; Syncfusion; Highcharts | + Free; large ecosystem − Advanced data grid (Excel-like grouping, pivot) must be built or simplified | + Ready-made advanced grids, schedulers, Gantt; faster delivery − Per-developer licences; renewals for updates | Open source; buy a grid licence only if CMMS screens need pivot / Excel-like grids |
| Reports / PDF | HTML templates + Playwright | Telerik Reporting; SSRS; Crystal Reports | + Free; same templates on screen and PDF − Report designer for business users not included | + Visual designer for non-developers; many export formats − Per-developer / server licences; extra runtime | Open source |
| Kubernetes platform | k3s / RKE2 | Red Hat OpenShift; SUSE Rancher Prime | + Free; light; runs on one VPS − Self-support; we design the operations | + Hardened, certified, support, built-in CI / registry − Per-core subscriptions; heavier footprint | Open source; managed K8s in cloud |
| Monitoring | Prometheus, VictoriaLogs, Jaeger, Grafana OSS | Datadog; Dynatrace; Grafana Enterprise / Cloud | + Free; runs on-prem and offline − Setup and dashboards are our work | + Fast setup, AI alerting, support − Per-host / per-GB pricing grows quickly; SaaS sends data off-site | Open source |
| SIEM | Wazuh or the client's SIEM | Splunk; Microsoft Sentinel; IBM QRadar | + Free; good detection rules − Needs tuning and a security team to watch it | + Mature analytics, SOC tooling, compliance reports − Ingest-based pricing is expensive | Forward to the client's existing SIEM; Wazuh otherwise |
| Feature flags | OpenFeature + flagd | LaunchDarkly | + Free; self-hosted − Basic UI | + Rich UI, experiments, audit − Per-seat / MAU pricing; SaaS | Open source |
Overall recommendation: use open source for the whole platform (lowest cost, no lock-in, safe to sell), and add paid support contracts only for the components where the team wants a vendor safety net: typically PostgreSQL, Kafka and Keycloak. Consider buying a licence in only two cases: an advanced data grid if the CMMS screens need Excel-like features, and Tridium Niagara if a site already runs it.
4Edge gateway and BACnet ingestion
One gateway per building (or BACnet segment) reads Honeywell and JCI controllers and streams readings to the platform. It needs no inbound access and keeps working alone if the uplink drops.
Collection frequency (configurable per point)
| Data class | Default | Allowed range | Method |
|---|---|---|---|
| Critical analog (supply/return temps, pressures) | 15 s | 5 s – 5 min | RPM poll or COV |
| Normal analog (zone temps, valve positions) | 60 s | 15 s – 15 min | RPM poll |
| Binary status / alarms | On change + 5 min heartbeat | — | COV, event notification |
| Energy meters | 60 s (kW), 15 min (kWh) | 15 s – 60 min | RPM poll |
| Indoor air quality | 5 min | 1 – 15 min | RPM poll |
| Setpoints / configuration | 15 min | 1 – 60 min | RPM poll |
Live values reach the dashboard within 5 s (p95) of arriving at the platform. 15-minute and hourly roll-ups for the current period refresh every minute.
Topics and message format
MQTT topics: t/{tenant}/s/{site}/gw/{gateway}/{data|events|health|config|cmd}
{
"gw": "GW-RUH-01", "profile": "jci", "batch_id": "01JDX4Q8V7K2",
"sent_at": "2026-11-30T10:15:00.120Z",
"readings": [
{ "dev": 3001, "obj": "analog-input:12", "name": "AHU-01.SAT",
"pv": 13.8, "units": 62, "sf": [0,0,0,0], "ts": "2026-11-30T10:15:00.020Z" }
]
}
Hardware (proposed)
Fanless industrial PC or VM · 4 cores · 8 GB RAM · 256 GB SSD · 2 NICs (OT VLAN + uplink) · NTP time sync.
Redundancy
Optional active/standby pair for critical sites; standby takes over if heartbeats stop for 60 s.
Remote updates
Signed container images; automatic rollback if health checks fail after an update.
5Normalisation pipeline
Every reading passes through one normaliser before any module sees it. Raw batches arrive in each vendor's shape and leave as canonical readings keyed by point_id. Anything that can't be parsed or mapped is held, never dropped.
Topics
| Topic | Key | Retention |
|---|---|---|
raw.readings | gateway | 7 d |
canonical.readings | point_id | 7 d |
dlq.readings | gateway | 30 d |
discovered.points | gateway | 30 d |
gateway.health | gateway | 7 d |
alarm.events | asset | 30 d |
domain.events | aggregate | 30 d |
Canonical reading
{
"tenant_id": "t-internal",
"point_id": "pt_8f2c1a",
"ts": "2026-11-30T10:15:00.020Z",
"value": 13.8, "unit": "degC",
"quality": "good",
"source": { "vendor": "jci", "gateway": "GW-RUH-01",
"device": 3001, "object": "analog-input:12" },
"flags": [], "mapping_version": 14,
"received_at": "2026-11-30T10:15:00.410Z"
}
Adapter plug-in interface (C#)
public interface IVendorAdapter
{
string Profile { get; } // "honeywell", "jci", ...
IReadOnlyList<RawRecord> Parse(ReadOnlySpan<byte> batch, GatewayMeta meta);
Quality GetQuality(RawRecord record);
string SourceUnit(RawRecord record);
}
Idempotent: a reading is unique on (point_id, ts); ClickHouse insert de-duplication (batch ID) plus a table keyed on point and timestamp mean replays never duplicate data (section 8A). Re-processing: after a mapping fix, raw batches for any time range can be replayed with the new mapping_version.
6Data storage and data model
PostgreSQL holds the twin, CMMS, configuration, outbox and sagas, split into a schema per module. Time-series readings live in ClickHouse, a column store built for sensor data. Files live in S3-compatible storage. Every table carries tenant_id: enforced by row-level security in PostgreSQL and by tenant-scoped queries and partitions in ClickHouse.
| Schema | Main tables | Owner |
|---|---|---|
twin | location, position, asset, asset_install, point, point_binding, device, gateway, bim_model, bim_element, document | Twin |
ts (ClickHouse) | readings, readings_text, rollup_15m / rollup_1h / rollup_1d | Pipeline |
alarm | alarm_rule, alarm, alarm_event, fdd_rule, fault | Alarms & FDD |
cmms | work_order, wo_task, wo_log, ppm_plan, ppm_schedule, part, stock, stock_move, team, technician, sla_policy, service_request | CMMS |
energy | meter, tariff, baseline_model, target, enpi_value, recommendation, savings | Energy |
ops | outbox, inbox, saga_instance, saga_step | Platform |
audit / cfg | audit_log (append-only), tenant, site_setting, retention_policy, notification_rule | Admin |
Key tables (main columns)
| Table | Main columns | Keys and indexes |
|---|---|---|
twin.location | id, tenant_id, parent_id, path (ltree), type, code, name, area_m2, capacity, bim_guid | PK id; GiST on path; unique (tenant_id, code) |
twin.position | id, tenant_id, location_id, asset_code, asset_class (Brick), criticality, status, bim_element_id | Unique (tenant_id, asset_code) |
twin.asset | id, tenant_id, make, model, serial_no, install_date, warranty_end, attributes jsonb | Unique (tenant_id, make, serial_no) |
twin.asset_install | id, position_id, asset_id, from_ts, to_ts, work_order_id | Exclusion constraint: one active install per position |
twin.point | id, point_key (int), tenant_id, position_id, brick_class, unit, kind, interval_s, deadband, min, max, gateway_id, bacnet_device, bacnet_object | Unique (gateway_id, bacnet_device, bacnet_object) |
ts.readings (ClickHouse) | tenant_id, point_key, ts, value, quality, flags, batch_id | ReplacingMergeTree, ORDER BY (tenant_id, point_key, ts); monthly partitions; TTL retention |
alarm.alarm | id, tenant_id, rule_id, point_id, position_id, severity, priority, state, first_seen, last_seen, count, acked_by, acked_at | Partial unique (rule_id, point_id) where state is active |
cmms.work_order | id, tenant_id, number, type, priority, status, position_id, fault_id, ppm_plan_id, due_date, sla_due, assignee_id, row_version | Unique (tenant_id, number); partial unique (fault_id) where open; unique (ppm_plan_id, due_date) |
ops.idempotency / Wolverine envelopes / saga tables | See sections 8 and 8A | — |
Every table also has created_at, created_by, updated_at, updated_by and a row_version for optimistic locking. Deletes of business records are soft deletes (deleted_at), purged by the retention job.
Asset codes when equipment is modified, replaced or added
Position
The functional location with the permanent asset code, e.g. RUH-B1-L03-AHU-01. BACnet points and BIM elements bind here.
Asset
The physical, serialised unit: make, model, serial, warranty, its own maintenance history.
Asset install
Which asset sat in which position, from / to dates, and the work order that made the change.
| Event | What the system does |
|---|---|
| Replaced like-for-like | Close the old install record, open a new one with the new serial. Asset code, points, BIM link and trends continue unchanged. |
| Modified (new motor, firmware) | Asset updated with a version entry in its history; position unchanged. |
| Newly installed | New position created (code from the site naming rule, editable), linked to the BIM element and to points found by BACnet discovery. |
| Controller replaced (new BACnet IDs) | Admin re-binds the discovered points to the same position; history stays on the position. |
| Removed | Position decommissioned; data kept under the retention policy. |
These changes are triggered by closing a Replacement / Installation work order, which runs the Asset Change saga (section 8).
Time-series storage (ClickHouse)
- Raw readings in
ts.readings, ordered by tenant, point and time, partitioned by month and compressed column by column (typically around 10× smaller than row storage). - Roll-ups (15 min, 1 h, 1 day: avg, min, max, last, count, meter deltas) are written by a roll-up job every minute. It recomputes the recent buckets from de-duplicated raw data and overwrites them, so re-running it is always safe.
- Retention uses ClickHouse TTL per table; before a partition expires it is exported to Parquet in object storage.
- Small pilots can run ClickHouse on the same server as PostgreSQL; larger sites add replicas and shards (section 15).
Retention and archival (defaults, configurable per tenant)
| Data class | Online | Archive |
|---|---|---|
| Raw readings (full resolution) | 13 months (columnar compression) | Monthly Parquet in object storage, 7 years |
| 15-min aggregates | 3 years | In the Parquet archive |
| Hourly / daily aggregates | 7 years | — |
| Raw gateway payloads | — | 30 days |
| Alarms, faults, events | 3 years | Parquet, 7 years |
| Assets, work orders, CMMS history | Life of asset + 7 years | — |
| Audit log | 7 years, append-only | — |
Archived data can be brought back on demand: pick a date range and ClickHouse queries the Parquet files in object storage directly, or loads them into a temporary table. Legal hold stops deletion.
7Module design
The Core API is one deployable ASP.NET Core application made of independent modules (one .NET project per module). Each module owns its schema and talks to others only through service interfaces and events, never through another module's tables, so any module can be split into its own service later.
Twin Phase 1
- Locations, positions, assets, points, BIM links, documents
- Location tree with PostgreSQL
ltree - Brick classes on points
- Publishes: AssetInstalled, PointBound, ModelImported
Live Phase 1
- Last value per point in Valkey
- WebSocket subscriptions per floor / asset
- Changes only, max 1 update/point/s
- Trend queries from aggregates
Alarms & FDD Phase 1
- Threshold, rate-of-change, BACnet native alarms
- FDD rules on time windows
- Priority, ack, shelve, escalate
- Publishes: AlarmRaised, FaultDetected
CMMS Phase 1
- Work order state machine with SLA timers
- PPM: calendar, run-hours, condition triggers
- Spares, stock, teams, contractors, requests
- Technician view for phones / tablets (browser)
Energy Phase 1
- Meters, virtual meters, tariffs
- Baselines, EnPIs, EUI, SEUs, targets
- Recommendations and savings tracking
- Forecasts (Phase 2)
Portfolio Phase 1
- Cross-building KPIs and league tables
- Read models refreshed from events
- Drill-down in ≤ 3 clicks
Reports & Notifications Phase 1
- HTML templates → PDF / Excel
- Routing by event, severity, location, role
- Email, SMS, in-app; on-call schedules
Admin & Integration Phase 1
- Sites, gateways, adapters, mappings
- Retention, users, roles
- Integration health dashboard
Sustainability · Wellbeing · Space Phase 2
- Scope 1/2/3, ESG reports, certifications
- Comfort indices, IAQ alarms
- Occupancy and utilisation
Module interactions
| Module | Publishes | Consumes |
|---|---|---|
| Twin | AssetInstalled, PointBound, ModelImported | discovered.points, BimConverted |
| Alarms & FDD | AlarmRaised / Acked / Cleared, FaultDetected | canonical.readings, gateway.health |
| CMMS | WorkOrderCreated / Assigned / Closed, PartsReserved | FaultDetected, AlarmRaised, AssetInstalled |
| Energy | RecommendationIssued, OverconsumptionDetected | reading aggregates |
| Notifications | NotificationSent | AlarmRaised, WorkOrder*, ReportGenerated |
| Copilot Phase 3 | — | All read APIs (respects user permissions) |
API conventions
- REST under
/api/v1, OpenAPI 3.1, a generated TypeScript client for the web app and for integrations. - Cursor pagination, filter by location subtree,
ETagoptimistic locking,Idempotency-Keyon every write. - WebSocket channels:
points:{ids},alarms:{location},workorders:{team}. - Integration API: OAuth2 client credentials with scoped tokens; signed (HMAC) webhooks with retry and back-off.
8Reliable messaging: Outbox, Inbox and Saga
Every business change and the event announcing it are saved in one database transaction (outbox). Every consumer records what it has processed (inbox), so duplicates are ignored. Processes that span several modules or workers run as orchestrated sagas with a compensating action for each step.
Transactional outbox (Wolverine)
domain.events on Kafka// Close a work order: state change + event are committed together
public static async Task Handle(CloseWorkOrder cmd, CmmsDbContext db,
IDbContextOutbox<CmmsDbContext> outbox)
{
var wo = await db.WorkOrders.FindAsync(cmd.WorkOrderId);
wo.Close(cmd.ClosedBy, cmd.Notes);
await outbox.PublishAsync(new WorkOrderClosed(wo.Id, wo.PositionId, wo.Type));
await outbox.SaveChangesAndFlushMessagesAsync(); // one transaction
}
- Storage: Wolverine keeps outgoing and incoming envelopes in PostgreSQL tables in the
opsschema, next to the business data. - Inbox: every consumer de-duplicates by message ID, so redeliveries and replays are processed once.
- Ordering: events are keyed by aggregate ID, so all events for one work order or asset stay in order.
- Retries: exponential back-off, then a dead-letter queue with an admin alert.
- Used between modules inside the monolith too, so boundaries are already event-based when a module is split out.
Saga orchestration (Wolverine sagas)
Each long-running process is a Wolverine Saga class whose state is saved in PostgreSQL. It sends commands through the outbox, reacts to reply events, schedules timeout messages, and runs compensations in reverse order if a step fails. Saga state survives restarts and is visible on an admin screen.
public class FaultToWorkOrderSaga : Saga
{
public Guid Id { get; set; } // = fault id
public Guid? WorkOrderId { get; set; }
public bool PartsReserved { get; set; }
public static (FaultToWorkOrderSaga, CreateWorkOrder) Start(FaultDetected e) => ...
public ReserveParts Handle(WorkOrderCreated e) => ...
public AssignTechnician Handle(PartsReserved e) => ...
public PutOnHold Handle(PartsUnavailable e) => ... // compensation path
public CancelWorkOrder Handle(FaultCleared e) => ... // compensation path
public void Handle(TechnicianAssigned e) => MarkCompleted();
}
Saga 1 — Fault to work order
Saga 2 — Asset change (replace / install)
Compensation: if point re-binding or PPM update fails, the twin change is reverted and the WO goes back to Completed – needs review.
Other sagas
| Saga | Steps | Compensation |
|---|---|---|
| BIM import | Upload → convert (BIM worker) → extract elements → admin review → commit to twin | Delete converted files and staged records; keep the previous model version live |
| PPM generation | Generate WOs for the window → reserve parts → schedule technicians | Remove generated WOs for the failed batch, release parts |
| Tenant export | Snapshot → export tables / Parquet / files → package → signed download link | Delete partial packages |
| BMS write-back Phase 3 | Approve → send command to gateway → WriteProperty → verify read-back → monitor | Relinquish the command (restore previous value) if verify fails or the effect is out of limits |
8AIdempotency
Every message in the platform is delivered at least once: networks drop acknowledgements, gateways replay their buffers, Kafka redelivers after a restart, and users double-click. Every receiver is therefore idempotent, so processing the same thing twice has the same effect as processing it once. At-least-once delivery plus idempotent receivers gives effectively-once results end to end.
Rule 1: Every message has a stable ID
Batch ID, event ID, command ID or a natural key, chosen by the sender and never regenerated on retry.
Rule 2: The receiver remembers
A unique constraint, an inbox table or a stored response records what was already done, in the same transaction as the work.
Rule 3: Retries are safe by design
Duplicates are ignored or return the original result; they never create a second record, alarm, work order or notification.
Idempotency at each layer
| Layer | Where duplicates come from | Idempotency key | Mechanism |
|---|---|---|---|
| Edge gateway → broker | MQTT QoS 1 resends; buffer replay after an outage | batch_id (ULID) + per-gateway sequence number | Gateway keeps the same batch_id on every resend; it deletes a batch from its buffer only after the broker acknowledges it |
| Ingest bridge → Kafka | Producer retries after a timeout | Kafka producer ID + sequence | Idempotent producer (enable.idempotence=true, acks=all); a short-lived cache of recent batch_ids drops repeated batches |
| Normaliser | Kafka redelivery after a crash or rebalance | (point_id, ts) | Pure, deterministic transformation: the same input always gives the same canonical reading; offsets are committed after publishing |
| TS writer → ClickHouse | Redelivered or replayed readings | batch_id + (point_key, ts) | Insert de-duplication token = batch ID drops repeated batches; ReplacingMergeTree collapses any remaining duplicate rows; queries read de-duplicated values |
| Valkey last value | Late or out-of-order readings | Reading timestamp | Atomic script updates the value only if the new ts is newer than the stored one |
| Live hub → browser | Reconnects, repeated pushes | (point_id, ts) | Client keeps the latest timestamp per point and ignores older or equal updates |
| Alarm engine | Same condition seen in several readings or after a restart | (rule_id, point_id) while active | Partial unique index: only one active alarm per rule and point; repeats update the existing alarm's last-seen time and count |
| Module events (Wolverine) | Outbox resend, Kafka redelivery | Message ID (envelope) | Inbox: each consumer records processed message IDs in the same transaction as its work |
| Sagas | Repeated or late reply events | Saga ID + step | Saga state checks the current step; a reply for a step already completed is ignored |
| Fault → work order | Same fault detected again | fault_id | Unique partial index: only one open work order per fault; a repeat attaches to the open one |
| PPM generation | Job retried or run twice | (ppm_plan_id, due_date) | Unique constraint on generated work orders |
| Notifications | Event redelivered, escalation re-run | (event_id, recipient, channel) | Unique key in the notification log; checked before sending to the email / SMS provider, which also receives the key where supported |
| Scheduled reports | Scheduler retry | (schedule_id, period) | Unique key; a repeat returns the existing report file |
| REST API writes | Double-clicks, client and proxy retries | Idempotency-Key header (client UUID) | Stored with a hash of the request and the response for 24 h; a repeat returns the stored response (details below) |
| Technician web view | Form re-submitted after a weak phone connection | Idempotency-Key per form submission + client-generated record UUIDs | A repeat submission returns the original result; photo uploads are keyed by UUID, so a retry never creates a second copy |
| BIM import | Same file uploaded again | SHA-256 of the file | Hash match offers to reuse the existing converted model instead of re-processing |
| BMS write-back (Phase 3) | Command retried | command_id | Gateway remembers executed command IDs for 24 h and never writes the same command twice |
REST API: Idempotency-Key
Idempotency-Key: <uuid>ops.idempotency-- ops.idempotency
CREATE TABLE ops.idempotency (
tenant_id uuid NOT NULL,
user_id uuid NOT NULL,
key uuid NOT NULL,
endpoint text NOT NULL,
request_hash bytea NOT NULL, -- SHA-256 of method + path + body
status text NOT NULL, -- in_progress | completed
response_code int,
response_body jsonb,
created_at timestamptz NOT NULL DEFAULT now(),
PRIMARY KEY (tenant_id, user_id, key)
); -- rows older than 24 h are purged nightly
// ASP.NET Core endpoint filter applied to all POST / PUT / PATCH / DELETE
app.MapGroup("/api/v1")
.AddEndpointFilter<IdempotencyFilter>() // looks up / stores ops.idempotency
.RequireAuthorization();
-- Readings in ClickHouse: idempotent by design
CREATE TABLE ts.readings (
tenant_id LowCardinality(String), point_key UInt32,
ts DateTime64(3, 'UTC'), value Float64, quality UInt8, flags UInt16, batch_id String
) ENGINE = ReplacingMergeTree
PARTITION BY toYYYYMM(ts)
ORDER BY (tenant_id, point_key, ts)
TTL toDateTime(ts) + INTERVAL 13 MONTH -- exported to Parquet before expiry
SETTINGS non_replicated_deduplication_window = 1000;
-- TS writer: INSERT ... SETTINGS insert_deduplication_token = '<batch_id>'
9BIM pipeline — IFC, FBX and manual
IFC and FBX files (with all MEP components) are imported to build the twin. Each format is a separate import plug-in, so Revit, Navisworks, glTF, OBJ or COBie can be added later.
| Topic | IFC | FBX |
|---|---|---|
| Floors & spaces | IfcBuildingStorey, IfcSpace | Node hierarchy / layer names, or manual |
| MEP types | IFC classes + property sets | Name rules (e.g. AHU-* → Air Handling Unit) or companion list |
| Properties | Property sets | FBX user properties or companion Excel / CSV |
| Stable ID | IFC GlobalId | Object name + hash of hierarchy path |
Manual route: create or edit floors, spaces and assets in the app, bulk import from Excel / CSV, and link assets by clicking objects in the 3D view. Re-import of an updated model shows a diff and keeps all asset, point and work order links. Original files are versioned in object storage.
10Alarms, fault detection and work orders
Alarms come from four sources, are scored by severity and asset criticality, routed to the right people, and escalate automatically if nobody acknowledges them.
BACnet native
Event notifications from Honeywell / JCI controllers.
Threshold
High/low limits, rate of change, deviation from setpoint, with delay and deadband.
FDD
Diagnostic rules over time windows (e.g. simultaneous heating & cooling, stuck valve, short cycling).
Data & comms
Stale or flat-lining sensors, device / gateway offline, data gaps, DLQ spikes.
Priority matrix (severity × asset criticality)
| Severity ↓ / Criticality → | A (critical) | B (important) | C (normal) |
|---|---|---|---|
| Critical | P1 | P1 | P2 |
| Major | P1 | P2 | P3 |
| Minor | P2 | P3 | P4 |
| Info | P4 | P4 | P4 |
Alarm lifecycle and escalation (defaults, configurable)
Flood suppression: if a gateway or device goes offline, its child point alarms are suppressed and one "communication lost" alarm is raised instead. Shelving hides an alarm for a set time with a reason, and is audited.
Sensor faults, abnormal readings, communication failures, data loss
| Check | Rule (default) | Result |
|---|---|---|
| Stale value | No reading for 3× the expected interval | Point marked stale, data alarm |
| Flat-line | Analog value unchanged for 6 h while equipment runs | Suspect sensor fault |
| Out of range | Outside physical limits for its Brick class (e.g. zone temp < 5 °C or > 50 °C) | Quality = bad, value excluded from KPIs |
| Spike | Rate of change above the class limit, or robust z-score > 5 | Quality = suspect |
| Drift | Gap vs a redundant or related sensor grows over days | FDD fault: calibration needed |
| Device offline | BACnet device fails 3 polls in a row | Comms alarm, child alarms suppressed |
| Gateway offline | No heartbeat for 90 s | P1/P2 comms alarm; data back-filled on return |
| Data gaps | Missing intervals in aggregates | Back-fill from gateway buffer or controller Trend Logs; gaps shown on charts |
11Energy analytics
Energy data is correlated with weather, occupancy and equipment state through the twin, then turned into KPIs, gaps and ranked recommendations.
Examples of EnPIs
kWh/m², kWh/occupant, chiller kW/TR, plant COP, after-hours baseload %, peak kW.
Recommendation example
"Reset AHU-03 supply-air setpoint 12 → 14 °C during low load: est. 4,200 kWh / month." Tracked until savings are verified (IPMVP option B/C).
Forecasting (Phase 2)
Day-ahead and month-ahead per building / floor with LightGBM on weather forecast, calendar and occupancy features; peak-demand alerts.
12Web front end (desktop, tablet and phone)
Web app (React + TypeScript)
- Role-based home dashboards with drag-and-drop widgets (ECharts)
- 3D twin: Three.js + That Open Engine; colour overlays for alarms, temperature, CO₂, occupancy
- Asset card: live values, trends, alarms, WOs, documents, BIM position
- English / Arabic with full RTL; dark and light themes
- Code-split by module; 3D loads progressively per floor
Technician view (same web app, phone / tablet browser)
- Responsive layout designed for phones and tablets; no app to install
- My work orders, checklists, photos (camera upload), signatures, notes
- QR / barcode scan through the browser camera to open an asset
- Large touch targets, works over site Wi-Fi or mobile data
- Alerts by SMS / email and in-app notifications; links open the right work order
13Deploy anywhere: on-premise, VPS or any cloud
The same container images and Helm charts install on an on-premise server, a single VPS, or any cloud (AWS, Azure, Google, Oracle, STC Cloud and others). Hybrid works too: gateways on site, platform in the cloud.
Profile S — single server / VPS
- Docker Compose or single-node k3s
- 8–16 vCPU, 32–64 GB RAM, 1 TB SSD (pilot / up to ~20k points)
- All components on one machine; nightly off-site backup
- Target 99.5% uptime
Profile M — on-prem HA cluster
- RKE2 / k3s, 3 control + 3–5 worker nodes
- Patroni PostgreSQL (3), ClickHouse (2 replicas + 3 Keeper), Kafka (3), Mosquitto (active / standby), Valkey Sentinel
- Second site or cloud for DR
- Target 99.9% uptime
Profile L — any cloud
- Any managed Kubernetes (EKS, AKS, GKE, OKE, …)
- Self-managed ClickHouse and PostgreSQL in-cluster (or the provider's managed PostgreSQL)
- Provider S3 for object storage
- Multi-zone; target 99.9%+
Portability rules
- Only open protocols and APIs: PostgreSQL, S3, Kafka, MQTT, OIDC, OpenTelemetry. No provider-only services in the code path.
- All configuration through environment variables and Helm values; secrets in OpenBao or Kubernetes secrets.
- Fully offline install supported (air-gapped image bundle for on-prem).
- Data residency set per tenant: for Saudi clients, the platform and backups must be hosted in-Kingdom.
14Security
Defence in depth: OT and IT networks are separated, every connection is encrypted and authenticated, and every action is logged.
OT zone (building)
- Honeywell / JCI controllers
- Edge gateway (read-only BACnet by default)
- No inbound connections allowed
outbound 8883 only
Platform zone
- DMZ: Traefik ingress + WAF, Mosquitto
- App namespace: Core API, workers
- Data namespace: PostgreSQL, Valkey, S3 (no public access)
HTTPS 443
Users
- Corporate LAN / VPN
- Phones / tablets via browser over TLS
- SSO + MFA (Keycloak)
| Area | Controls |
|---|---|
| Encryption in transit | TLS 1.2+ everywhere (MQTT, HTTPS, database, internal service mesh optional); mTLS with X.509 certificates for gateways |
| Encryption at rest | AES-256 disk / volume encryption; PostgreSQL and S3 encryption; encrypted backups; keys in OpenBao or the cloud KMS |
| Identity & access | SSO, MFA, role-based access scoped to portfolio / site / building; least privilege; session timeouts; service accounts with scoped tokens |
| Application | OWASP ASVS L2; input validation; rate limiting; CSP headers; dependency and image scanning (Trivy) in CI; DAST (ZAP) before release |
| OT safety | IEC 62443 zones and conduits; BACnet read-only by default; write-back only on allow-listed points with limits and automatic relinquish; BACnet/SC where supported |
| Monitoring | Central audit log (append-only); security alerts from logs and Falco; failed login and privilege-change alerts |
| Testing | Annual third-party penetration test; vulnerability scans every month; critical patches within 7 days |
Incident response
Personal-data breaches are reported to the regulator as required by the applicable law (for Saudi Arabia, PDPL: within 72 hours of becoming aware). Notification times are defaults to be confirmed in the support agreement. The full data breach response plan is in section 14A.
14AInformation security and data breach management
Security is run as a managed programme aligned with ISO/IEC 27001, IEC 62443, NCA ECC / CCC and the Saudi PDPL. This section covers governance, data classification and privacy, threats and their mitigations, hardening, key management, monitoring, ransomware protection, and the full data breach response plan.
1. Governance and ownership
| Role | Responsibility |
|---|---|
| Security owner (CISO or delegate) | Owns the security policy, risk register, exceptions and the incident response plan; reviews them every year |
| Data protection officer (DPO) | Personal data inventory, privacy impact assessments, data subject requests, regulator notifications under PDPL |
| Platform / DevOps lead | Hardening, patching, backups, secrets, monitoring and on-call |
| Product / engineering lead | Secure development lifecycle, threat models, fixing vulnerabilities within the SLA |
| Client contact | Receives breach and incident notifications; approves OT access and write-back points |
2. Data classification and handling
| Class | Examples in this platform | Handling rules |
|---|---|---|
| Internal | BMS telemetry, aggregates, dashboards, energy KPIs | Encrypted in transit and at rest; role-based access by site; normal retention |
| Confidential | Asset register, CMMS history, BIM models, floor plans, network and point lists, reports | As above + export logged and limited to authorised roles; watermarked PDF exports; no public sharing links |
| Personal (PDPL) | User and technician names, emails, phone numbers, work logs, photos, signatures, occupant feedback | As above + minimised, purpose-limited, retention-limited; access audited; subject to data subject rights; never used for unrelated purposes |
| Restricted | Passwords, keys, certificates, tokens, backups, audit logs, BMS write-back permissions | Stored only in OpenBao / KMS or encrypted backups; never in code, logs or tickets; access by named administrators with MFA; every access logged |
3. Personal data and privacy (PDPL)
- Inventory: a register of every personal data field, its purpose, legal basis, retention and where it is stored.
- Minimisation: occupancy and space utilisation use counts only, never named individuals; technician location is not tracked.
- Privacy impact assessment before Phase 2 (Space Utilization, Wellbeing feedback) and before any access-control integration.
- Data subject rights: access, correction and deletion requests handled through a documented admin workflow; work-order history is kept but personal fields are anonymised on deletion.
- Location of data: personal data stays in the client's chosen region (in-Kingdom for Saudi clients); no transfer abroad without a lawful basis.
- Logs: application logs never contain personal data, tokens or payload secrets (automatic masking in Serilog).
4. Threats and mitigations
| Threat | Example | Mitigation |
|---|---|---|
| Spoofed gateway or device | Attacker sends fake readings | mTLS with per-gateway X.509 certificates, topic ACLs per gateway, certificate revocation |
| Tampered data | Readings altered in transit | TLS, signed batches, range and plausibility checks, anomaly alarms |
| Unsafe BMS control | Malicious setpoint change | Read-only by default; Phase 3 write-back only on allow-listed points, with limits, approval and automatic relinquish; fire / life-safety never writable |
| Broken access control | User sees another site's data (IDOR) | Authorisation on every request by tenant and location; PostgreSQL row-level security as a second layer; automated access-control tests |
| Account takeover | Phished password | SSO + MFA (mandatory for admins), lockout, risk-based login alerts, short sessions |
| Injection and web attacks | SQL injection, XSS | Parameterised queries (EF Core), output encoding, strict Content-Security-Policy, WAF rules, SAST and DAST in CI |
| Ransomware | Servers encrypted, backups deleted | Immutable backups (S3 Object Lock where the storage supports it, or an append-only backup server), separate backup credentials, offline copy, monthly restore test |
| Insider misuse | Bulk export of the asset register | Least privilege, export logging and alerts, quarterly access reviews, tamper-evident audit log |
| Supply chain | Compromised library or image | Pinned versions, dependency and image scanning, SBOM, signed images (cosign), private registry |
| Denial of service | Flood of requests or messages | Rate limits per user / gateway, MQTT quotas, provider DDoS protection or upstream firewall, autoscaling |
5. Secure development lifecycle
| Vulnerability severity | Fix deadline |
|---|---|
| Critical | 7 days (actively exploited: 48 hours or a temporary mitigation) |
| High | 30 days |
| Medium | 90 days |
| Low | Next planned release |
6. Identity, privileged access and keys
Identity and privileged access
- MFA mandatory for administrators and remote access
- Just-in-time admin rights with expiry; two named break-glass accounts, sealed and monitored
- Joiner / mover / leaver synced from the corporate directory; quarterly access reviews
- Service accounts per component, least privilege, no shared accounts
- Vendor (Honeywell / JCI) remote access only through approved, time-limited, logged sessions
Keys, secrets and certificates
- All secrets in OpenBao; dynamic, short-lived database credentials
- TLS certificates renewed automatically (cert-manager, 90 days)
- Gateway certificates valid 1 year, rotated automatically, revocable
- API keys and integration tokens scoped and rotated every 90 days
- Encryption keys in OpenBao / KMS; optional client-managed keys (BYOK) or HSM
7. Hardening
Platform
- CIS benchmarks for OS, Kubernetes and PostgreSQL
- Kubernetes network policies: deny by default, allow only required flows
- Optional service mesh (mTLS between services)
- No public access to databases, Valkey, Kafka or object storage
- Admin access only via bastion / VPN with MFA; outbound traffic restricted
- Containers run as non-root, read-only file systems where possible
Edge gateway
- Secure boot and full-disk encryption (TPM-backed)
- No inbound ports; SSH disabled or key-only over the management VPN
- Only signed updates accepted; automatic rollback on failure
- BACnet read-only by default; separate NICs for OT and uplink
- Installed in a locked cabinet; enclosure tamper alarm where available
8. Security monitoring and audit
- Audit log: every login, permission change, configuration change, export, work-order action and control command; tamper-evident (hash-chained entries, copied to write-once (append-only) storage); kept 7 years.
- Security logs from ingress, Keycloak, Kubernetes, gateways and databases are centralised (VictoriaLogs) and forwarded to a SIEM: the client's own SIEM via syslog, or open-source Wazuh.
- Detection rules (examples): repeated failed logins, MFA disabled, new admin created, large or unusual export, access from a new country, gateway certificate errors, unexpected BACnet write attempts, disabled audit logging, backup deletion attempts.
- Security alerts page the on-call engineer and the security owner around the clock.
9. Data breach response plan
A data breach is any accidental or unlawful loss, disclosure, alteration or access to Confidential, Personal or Restricted data. The plan follows six phases, with a breach register kept for every event, including near-misses.
Notification matrix (defaults, confirm in contracts)
| Who | When | What |
|---|---|---|
| Security owner and management | Immediately on detection | Initial facts, severity, containment actions |
| Affected client | Within 4 hours of confirming a high-severity breach; 24 hours for others | What happened, data involved, actions taken, contact person; updates every 24 h until closed |
| Regulator (Saudi Arabia: SDAIA under PDPL) | Within 72 hours of becoming aware, for personal data breaches | Nature of the breach, categories and number of people affected, likely consequences, measures taken |
| NCA and other authorities | As required by NCA ECC and applicable law | Per the authority's reporting format |
| Affected individuals | Without undue delay where there is a high risk to them | Plain-language description, what they should do, contact point |
- Evidence preservation: snapshots of affected systems, logs locked in object storage, chain-of-custody record before any clean-up.
- Ready-made templates for client, regulator and individual notifications, in English and Arabic.
- Post-incident report within 5 working days: timeline, root cause, impact, corrective actions with owners and dates.
- Exercises: a breach tabletop exercise every year and after any major incident; results feed the risk register.
10. Third parties, continuity and compliance
| Area | Control | Standard alignment |
|---|---|---|
| Suppliers and vendors | Security assessment before onboarding; contracts include confidentiality, breach notification and data residency clauses | ISO 27001 supplier controls, NCA ECC |
| Open-source components | Licence and vulnerability tracking through the SBOM | ISO 27001, secure development |
| Business continuity | RPO ≤ 15 min, RTO ≤ 4 h, immutable backups, DR site option, yearly DR test (section 15) | ISO 22301 principles, NCA ECC resilience |
| OT security | Zones and conduits, read-only default, gateway hardening | IEC 62443 |
| Privacy | Inventory, minimisation, DPIA, subject rights, breach notification | Saudi PDPL |
| Cloud hosting | In-Kingdom region, provider certifications reviewed | NCA CCC, CST regulations |
| Staff | Security awareness training at onboarding and yearly; confidentiality agreements | ISO 27001 people controls |
15Scalability, availability, backup and disaster recovery
The platform starts small and grows in stages without a rewrite. Each stage only adds capacity or splits out a module; data formats and APIs stay the same.
Stage 1 · Pilot
1 server / VPS, 1–2 buildings, ≤ 20k points
- Compose or k3s
- Modular monolith
Stage 2 · Campus
HA cluster, ≤ 10 buildings, ≤ 200k points
- 3-node DB, bus, broker
- Workers scale on partitions
Stage 3 · Portfolio
≤ 100 buildings, ≤ 2M points
- Split hot modules (Live, Alarms, CMMS) into services
- DB read replicas; more Kafka partitions
Stage 4 · Commercial SaaS
Many tenants
- Shard by tenant / region
- Per-tenant clusters for large clients
| Component | How it scales | Redundancy |
|---|---|---|
| Edge gateways | Add gateways per building / segment | Optional active / standby pair |
| Mosquitto | Add brokers and assign gateway groups to them | Active / standby pair per broker |
| Apache Kafka | More partitions and brokers | 3 brokers, replication factor 3 |
| Stream workers | Horizontal pod autoscaling on consumer lag | ≥ 2 replicas each |
| Core API | Stateless replicas behind ingress; split modules later | ≥ 2 replicas |
| PostgreSQL | Vertical, then read replicas, then split by tenant | Patroni: 1 primary + 2 replicas, automatic failover |
| ClickHouse | Add shards (by tenant / site); replicas for read load | 2 replicas per shard + 3 ClickHouse Keeper nodes |
| Valkey | Larger instance, then Valkey Cluster | Sentinel (3) |
| Object storage | Add SeaweedFS volume servers / provider S3 | Erasure coding or provider replication |
Backup and recovery (defaults)
| What | How often | Kept |
|---|---|---|
| PostgreSQL | Continuous WAL archiving + daily differential + weekly full (pgBackRest) | 35 days point-in-time; monthly fulls 12 months |
| Object storage | Versioning + nightly replication to a second location | 35 days of versions |
| Configuration | Git (Helm values, rules, templates); Keycloak export daily | Full history |
| Edge gateways | Config pulled from platform; buffer covers 72 h outages | — |
≤ 15 min
RPO (data loss)
≤ 4 h
RTO (restore time)
99.5% / 99.9%
Uptime: single server / HA
Monthly
Restore test
Observability and DevOps
- Metrics (Prometheus), logs (VictoriaLogs), traces (OpenTelemetry → Jaeger), dashboards in Grafana OSS, alert routing in Alertmanager. A trace ID flows from gateway batch to dashboard update.
- CI: lint, unit and contract tests, image build, Trivy scan, SBOM. CD: Argo CD GitOps with automatic rollback on failed health checks.
- Environments: dev → test (with simulator) → staging → production. Database migrations are versioned and backward-compatible.
15AProduction readiness
This section covers what it takes to run the platform safely in production: contracts and versioning, resilience patterns, configuration, release and migration practices, service levels and alerting, runbooks, capacity, testing, onboarding, gateway fleet management, and a go-live checklist.
1. API and event contracts
| Area | Rule |
|---|---|
| REST versioning | Version in the path (/api/v1). Additive changes only within a version; breaking changes need /v2 with the old version kept for at least 12 months. Deprecations announced with a Sunset header |
| Error format | RFC 9457 Problem Details (type, title, status, detail, traceId) on every error; validation errors list each field |
| Event schemas | Every event has a name, version, ID, timestamp, tenant and trace ID. Schemas (JSON Schema) are kept in a schema registry in Git; consumers must ignore unknown fields; breaking changes publish a new event version alongside the old one |
| Contract tests | Consumer-driven contract tests (Pact) between front ends and the API, and between producers and consumers of events, run in CI |
| Pagination and limits | Cursor pagination; maximum page size 500; trend queries limited to 10,000 points per series (the API picks a coarser aggregate automatically) |
| Rate limits | Per user and per integration client (default 600 requests/min; exports 10/hour); 429 responses with Retry-After |
Main endpoint groups: /locations, /positions, /assets, /points, /readings (trend queries), /alarms, /faults, /work-orders, /ppm-plans, /parts, /energy, /reports, /bim-models, /gateways, /admin, /exports.
2. Resilience and error handling
| Pattern | Where | Default |
|---|---|---|
| Timeouts | Every outbound call (DB, Valkey, Kafka, HTTP, SMTP, SMS) | DB 5 s, HTTP 10 s, report rendering 120 s |
| Retries with back-off and jitter | Transient failures only (Polly / Wolverine policies) | 3 retries: 0.5 s, 2 s, 8 s; then dead-letter |
| Circuit breaker | External services (SMS gateway, email, weather API, ERP) | Open after 50% failures in 30 s; half-open after 60 s |
| Bulkheads | Separate worker pools for live data, reports and BIM conversion | A slow report never delays alarms |
| Back-pressure | Kafka consumers, SignalR, gateway uplink | Consumer lag alerts; live updates throttled to 1 per point per second; gateway buffers when the broker is slow |
| Graceful degradation | Dashboard and API | If Valkey is down, read last values from the database; if analytics is down, dashboards still show live data and alarms |
| Dead-letter handling | All topics and Wolverine queues | Admin screen to inspect, fix and replay; alert when a DLQ grows |
| Health checks | Every service | /health/live and /health/ready (checks DB, Kafka, Valkey); used by Kubernetes and load balancers |
| Graceful shutdown | Every service | Stop taking work, finish in-flight messages, commit offsets, then exit (30 s) |
3. Configuration, secrets and feature flags
- Configuration through environment variables and Helm values per environment, validated at start-up (the service refuses to start on invalid settings).
- Tenant and site settings (intervals, retention, escalation timers, naming rules) live in the database with an admin UI and audit history.
- Secrets only from OpenBao (or Kubernetes secrets on the smallest installs), never in Git or images.
- Feature flags (OpenFeature with a self-hosted provider such as Flagd or Unleash) to release modules per site, run pilots, and switch off a feature without redeploying. Phase 2 / 3 modules ship behind flags.
4. Environments, releases and database migrations
- Release strategy: rolling updates by default; canary releases (10% → 50% → 100%) for API and workers on the HA profile, with automatic rollback on error-rate or latency alarms (Argo Rollouts).
- Database migrations: EF Core migrations, run as a separate job before the release. Always expand → migrate → contract: add new columns or tables first, deploy code that uses both, back-fill, then remove the old ones in a later release. No migration locks a large table; large-table changes (PostgreSQL and ClickHouse) are tested on a production-sized copy.
- Versioning: semantic versions for the platform, the gateway image and the Helm chart; every release has release notes and a rollback plan.
- Change control: production changes through pull requests and GitOps only, with approval; emergency changes are reviewed afterwards.
- Maintenance windows agreed per client for anything that may cause downtime (normally none on the HA profile).
5. Service levels and alerting
| Service level indicator | Objective (SLO) | Alert when |
|---|---|---|
| API availability (successful requests) | 99.9% monthly (HA profile) | Error budget burn rate > 2× over 1 h |
| API latency (p95, excluding exports) | < 500 ms | > 1 s for 10 min |
| Data freshness (platform arrival → dashboard, p95) | < 5 s | > 15 s for 5 min |
| Gateway connectivity | 99.5% of gateways online | Any gateway offline > 90 s |
| Ingestion lag (Kafka consumer lag) | < 10 s | > 60 s for 5 min |
| Alarm notification delay | < 30 s from condition to notification | > 60 s |
| Dead-letter queue | Empty or shrinking | > 100 messages or growing for 15 min |
| Backups | Daily backup succeeds; WAL archive lag < 5 min | Any failure |
| Certificates | Valid | Any certificate expiring within 14 days |
Alerts go to an on-call rota (Alertmanager routing to email, SMS and chat) with severity-based paging. Standard dashboards: platform overview, ingestion pipeline, gateways, database, API, business KPIs (alarms open, work orders overdue).
6. Runbooks
Each alert links to a runbook with checks, fixes and escalation. Runbooks written before go-live:
Data path
- Gateway offline
- Ingestion lag growing
- DLQ growing / mapping errors
- Missing data and back-fill
Platform
- Database failover and replica rebuild
- Disk or storage nearly full
- Kafka broker down
- Certificate renewal failure
Recovery and security
- Point-in-time database restore
- Full DR to a second site
- Suspected breach (links to 14A)
- Rotate compromised credentials
7. Capacity and sizing (starting points)
| Component | Profile S (single server, ≤ 20k points) | Profile M (HA cluster, ≤ 200k points) |
|---|---|---|
| Core API | 1 replica, 1 vCPU, 1 GB | 3 replicas, 2 vCPU, 2 GB each |
| Stream workers (.NET) | 1 of each, 0.5 vCPU, 512 MB | 2–6 of each (autoscaled), 1 vCPU, 1 GB |
| Analytics / BIM workers (Python) | 1 each, 1 vCPU, 2 GB | 2 each, 2 vCPU, 4 GB |
| PostgreSQL | 2 vCPU, 8 GB, 200 GB SSD | 3 nodes, 4 vCPU, 16 GB, 500 GB each |
| ClickHouse | 4 vCPU, 16 GB, 500 GB SSD | 2 replicas, 8 vCPU, 64 GB, 2 TB NVMe each + 3 small Keeper nodes |
| Apache Kafka | 1 node, 2 vCPU, 4 GB | 3 nodes, 4 vCPU, 8 GB, 500 GB each |
| Mosquitto / Valkey / SeaweedFS / Keycloak | Shared: 2 vCPU, 6 GB total | 2–3 nodes each |
Sizes are estimates to be confirmed by load tests with the simulator: target sustained 50,000 readings/s on Profile M with p95 freshness under 5 s, and 2× headroom.
8. Testing strategy
| Level | What | Tools |
|---|---|---|
| Unit | Domain logic, rules, adapters, unit conversion | xUnit, pytest |
| Integration | Real PostgreSQL, Kafka, Valkey in containers; outbox, sagas, idempotency (each handler run twice) | Testcontainers |
| Contract | API ↔ front ends; event producers ↔ consumers | Pact, JSON Schema |
| End-to-end | Key user journeys on desktop and phone-sized browsers against the simulator | Playwright |
| Performance | Ingestion throughput, API latency, dashboard load with many users | Locust, simulator back-fill |
| Resilience | Kill pods, drop the network, fail the DB primary, cut the gateway uplink | Chaos Mesh (staging) |
| Security | SAST, DAST, dependency scans, yearly pen test | See 14A |
| User acceptance | Pilot site sign-off against BRD requirements | Test scripts per requirement ID |
9. Building onboarding
An onboarding checklist and a data-quality report (points mapped, points live, stale points, unit errors) must reach agreed thresholds (e.g. ≥ 98% of points live and mapped) before a building goes live.
10. Gateway fleet management
- Gateway registry with location, serial, image version, certificate expiry, last heartbeat and buffer depth.
- Zero-touch provisioning: a one-time enrolment token issues the gateway's certificate; tokens expire after 24 h.
- Staged updates: one pilot gateway, then 10%, then all, with automatic rollback.
- Remote diagnostics (logs, BACnet scan results) over the outbound connection, never via inbound access.
11. Time, language and accessibility
- All timestamps stored in UTC; displayed in each site's time zone (Asia/Riyadh for Saudi sites); gateways synced by NTP with clock-skew alarms.
- Daily and monthly energy figures use the site's local calendar day and month; reports can show Gregorian and Hijri dates.
- English and Arabic with full RTL layout; numbers, dates and units formatted per locale; all text in resource files.
- WCAG 2.1 AA: keyboard navigation, contrast, screen-reader labels; colour is never the only signal for alarm state.
12. Go-live checklist
| Area | Must be true before production |
|---|---|
| Security | Pen test done, no open critical / high findings; MFA on for admins; secrets in OpenBao; audit log on and tamper-evident |
| Reliability | HA tested (DB failover, pod loss, gateway outage with back-fill); idempotency tests passing |
| Backups | Backups running and a full restore tested within the RTO |
| Observability | Dashboards, SLO alerts and on-call rota live; every alert linked to a runbook |
| Performance | Load test at 2× the expected pilot volume within SLOs |
| Data | Onboarding data-quality thresholds met; retention and archive jobs scheduled |
| Privacy | Personal data register complete; DPIA done where needed; notification templates ready |
| Operations | Support process, SLA, escalation contacts and maintenance windows agreed with the client |
| Documentation | Admin guide, user guides (English / Arabic), API docs, runbooks, architecture records |
| Sign-off | UAT signed against BRD requirement IDs by the business owner |
16Mock data simulator
Until real sites are connected, a simulator acts as a network of BACnet devices shaped like Honeywell and Johnson Controls controllers. The gateway discovers and polls it exactly like real equipment.
Building model
YAML file: floors, zones, chillers, AHUs, FCUs, pumps, VAVs, lighting circuits, meters, IAQ sensors. Can be generated from an imported IFC / FBX model.
Physics-lite behaviour
Occupancy and weather profiles drive loads; setpoint tracking; sub-meters sum to main meters; realistic noise.
Fault & data injection
Stuck valve, simultaneous heating and cooling, sensor drift, meter spike, device offline, malformed or late data, all on demand.
Built with Python + bacpypes3 (virtual BACnet devices) and a scenario API. Back-fill mode generates 12+ months of history in minutes. Every simulated reading is tagged source = simulated.
17Build order (Phase 1) and open decisions
Open design decisions
| # | Decision needed | Proposed default |
|---|---|---|
| OD-1 | Team skills: C# + Python back end, TypeScript front end | Confirm team mix; the edge gateway can move to .NET later if BACnet library tests pass |
| OD-2 | Open source or licensed, per component | Proposed default: open source everywhere, with optional paid support for PostgreSQL, Kafka and Keycloak; decide per component using the comparison in section 3 |
| OD-3 | Pilot hosting profile: S (single server) or M (HA cluster)? | Profile S for pilot, M for production |
| OD-4 | Gateway hardware vendor and whether a redundant pair is needed | Single gateway for pilot |
| OD-5 | Real Honeywell / JCI point lists (EDE) and sample IFC / FBX files | Needed before M2 / M3 finish |
18Client questions — how the design answers them
The 20 standard due-diligence questions, answered from this design. Green lines show what can be configured per client or per site.
How is data captured from the sensors and sent to the dashboard?
Sensors connect to Honeywell / JCI controllers. An on-site edge gateway reads the controllers over BACnet (polling + change-of-value), buffers locally, and sends encrypted batches over MQTT to the platform. The platform normalises each reading, stores it, and pushes live changes to the dashboard over WebSocket.
How often is data collected, processed and updated on the dashboard?
Defaults: critical points every 15 s, normal analog every 60 s, status changes immediately (COV), meters 60 s / 15 min, IAQ 5 min. Processing is streaming; live values appear within 5 s of arrival, and roll-ups refresh every minute.
How long is data retained, and what is the archival policy?
Raw readings 13 months online, then monthly Parquet archives for 7 years; 15-min aggregates 3 years; hourly / daily 7 years; audit log 7 years; CMMS history for the asset's life + 7 years. Archives can be restored on demand; legal hold stops deletion.
How is a modified, replaced or new component mapped to an existing asset code?
The asset code belongs to the position (functional location), not the physical unit. A replacement closes the old install record and opens a new one under the same code, so sensors, BIM links and trends carry on. New components get a new position and code. This runs through a work order and the Asset Change saga.
How are sensor faults, abnormal readings, communication failures and data loss detected?
Automatic checks for stale, flat-lining, out-of-range, spiking and drifting sensors; device offline after 3 failed polls; gateway offline after 90 s without a heartbeat; gap detection with automatic back-fill; failed messages held in a dead-letter queue.
Which communication protocols are used?
Sensors ↔ controllers: vendor field buses / BACnet MS/TP. Controllers ↔ gateway: BACnet/IP and MS/TP (via routers). Gateway ↔ platform: MQTT 5 over TLS. Platform ↔ users: HTTPS and WebSocket. Other systems: Modbus TCP, MQTT, REST through adapters.
What happens if the internet, gateway or server goes offline?
Building systems keep running: controllers run their own control. Internet or platform down: the gateway buffers ≥ 72 h and back-fills when the link returns; users on site can still check the BMS head-end. Gateway down: controllers keep their own trend logs, which are back-filled; an optional standby gateway takes over. On-prem installs need no internet at all.
How is unauthorised access, cyberattack and data breach prevented?
Separate OT and IT zones, outbound-only gateways, mTLS device certificates, SSO with MFA, role-based access by site, encryption everywhere, WAF and rate limiting, secrets in OpenBao, image and dependency scanning, audit log, monthly scans and an annual penetration test.
What is the incident response procedure, and how soon is the client notified?
Detect → triage (1 h) → contain and preserve evidence → assess impact → notify → recover and review. Client notified of high-severity incidents within 4 hours of confirmation; regulator notified as the law requires (PDPL: 72 h); root-cause report within 5 working days.
Where is it hosted, and on what infrastructure?
Anywhere the client chooses: on-premise server, a single VPS, any public cloud, or hybrid (gateways on site, platform in the cloud). Same containers and Helm charts everywhere; data residency set per client (in-Kingdom for Saudi clients).
Is data encrypted in transit and at rest?
Yes. TLS 1.2+ for every connection (mTLS for gateways); AES-256 encryption for disks, database, object storage and backups; keys held in OpenBao or the cloud KMS.
How often are backups taken, and how are restore and DR handled?
Continuous database log archiving plus daily and weekly backups (35 days point-in-time); object storage versioned and replicated nightly; configuration in Git. RPO ≤ 15 min, RTO ≤ 4 h; restore tested monthly; optional standby site.
What uptime is expected, and what redundancy exists?
99.5% on a single server, 99.9% on an HA cluster. Redundant database (1 primary + 2 replicas with automatic failover), 3-broker event bus, 2+ MQTT brokers, Valkey Sentinel, 2+ replicas of every service, optional gateway pair.
How are alarms generated, prioritised, notified, acknowledged and escalated?
Four sources (BACnet native, threshold, FDD, data / comms). Priority P1–P4 from severity × asset criticality. Notifications by email, SMS and in-app via on-call rules. Acknowledged in the web app on desktop or phone. Unacknowledged P1 alarms escalate to the supervisor after 10 min and the facility manager after 30 min. Flood suppression and audited shelving.
Can it integrate with HVAC, lighting, fire alarm, access control and energy monitoring?
Yes. HVAC and lighting through BACnet (or KNX / DALI via BACnet gateways); energy meters through BACnet, Modbus or M-Bus; access control and people counters through vendor APIs; fire alarm panels read-only through a BACnet / Modbus interface (life-safety is never controlled). New systems are added as adapter plug-ins.
Who maintains it, how are updates handled, and what are the support SLAs?
Monthly patch releases, quarterly feature releases, critical security patches within 7 days; updates through GitOps with automatic rollback. Gateway software updates as signed images; controller firmware stays with Honeywell / JCI and is coordinated with them. Proposed SLA: P1 response 1 h / restore 4 h; P2 4 h / 1 business day; P3 1 business day / 5 days; P4 next release.
Who owns the data, and can the client export everything at any time?
The client owns all its data. A self-service Tenant Export (run as a saga) produces a complete package at any time: time-series in Parquet / CSV, twin, CMMS and configuration in JSON / CSV, original BIM files and documents, plus the full API.
How are data, configuration and asset mappings migrated if the platform or provider changes?
Everything uses open formats and standards: Brick / Haystack tags, documented schemas, BACnet point-to-asset mapping exported as CSV, IFC models, Parquet history. The export package plus a documented exit plan lets another platform import it; our own import tools accept the same package for migrating in.
Which certifications, audits and compliance standards apply?
Designed to align with ISO/IEC 27001, IEC 62443 (OT security), NCA ECC and CCC, Saudi PDPL, OWASP ASVS L2, and to support ISO 50001 energy management. Annual penetration test and monthly vulnerability scans. Formal certification (e.g. ISO 27001, SOC 2) is planned if the product is sold externally.
How is data from different systems correlated and turned into insights, reports and recommendations?
The twin links every point to its asset, system and space, with Brick meaning (e.g. "supply air temperature of AHU-01 serving Floor 3"). Readings are time-aligned into 15-min aggregates and joined with weather, occupancy and tariffs. FDD rules, energy baselines and KPIs run on that model, producing faults, ranked recommendations with estimated savings, and scheduled reports.