Till & Frånkoppling
This application contains a large number of conditions and flow variants.
For this reason, the documentation here focuses on system architecture and integration boundaries. Detailed business flow behavior is intentionally not described, as it changes frequently and is managed operationally.
Documentation of exact flows is owned by the business side and is maintained using the flow management tooling available in the portal, which serves as the primary source of truth for flow definitions.
Till- och frånkoppling supports the move-in and move-out process for electricity delivery in premises.
When a customer moves out, they provide a move-out date. If no new customer takes over the facility, electricity is automatically disconnected at day boundary (midnight) to avoid unbilled consumption.
Before moving in, the customer receives an SMS with a link where they can approve terms and self-connect the facility (activate electricity).
The solution is orchestration-heavy and integrates with metering/control systems, customer systems, and communication channels.
Purpose and scope
Section titled “Purpose and scope”What this application does
Section titled “What this application does”- Orchestrates move-out flows and determines whether a disconnect is required
- Performs automated disconnect at day boundary when no successor exists
- Orchestrates move-in flows and enables customer self-connect via SMS + approval
- Controls meters (connect/disconnect) via Gateware integration
- Updates service/status information in BFUS
- Creates cases and history records in Lime CRM
- Supports scheduled/queued execution via ScheduleAPI
- Provides an operational portal for managing rules/conditions and flow execution
Out of scope
Section titled “Out of scope”- Physical meter infrastructure
- Gateware, BFUS, Lime operation as systems
- BankID integration beyond planned/coming functionality
High-level architecture
Section titled “High-level architecture”The solution is centered around MeterControlAPI, which orchestrates business flows and coordinates integrations.
Key components:
- MeterControlAPI (core orchestrator)
- Integration services for Gateware, Lime, BFUS, (future BankID)
- NotificationAPI + TellusTalk for SMS delivery
- CustomerFormulaAPI + frontend for customer approval/self-connect
- ScheduleAPI for planned execution and day-boundary actions
- Management portal (Static Web Apps) for operational control and rule management
Conceptual component view
Section titled “Conceptual component view”flowchart LR subgraph Users["Users"] OpsUser["Operations user"] end subgraph Cloud["Cloud"] Portal["Till-/frånkopplingsportal<br/>(Azure Static Web App)"] Edge["Front Door + API Management"] KC["Keycloak<br/>(Identity)"] end subgraph Core["Core"] Meter["MeterControlAPI<br/>(orchestrator)"] end subgraph Metering["Metering & control"] IGW["IntegrationGatewareAPI"] Gateware["Gateware"] MeterHW["Meters"] end subgraph CustomerSystems["Customer & service systems"] IBFUS["IntegrationBFUS"] IBiz["IntegrationBusinessAPI"] BFUSapi["BFUS<br/>(REST API)"] BFUSdb["BFUS<br/>(DB views)"] end subgraph CRM["CRM / case management"] ILime["IntegrationLimeAPI"] Lime["Lime CRM<br/>(REST API)"] end subgraph Identity["Identity (planned)"] IBankID["IntegrationBankID"] BankID["BankID<br/>(REST API)"] end subgraph Comms["Customer communication"] Notif["NotificationAPI"] Tellus["TellusTalk<br/>(SMS)"] end subgraph CustomerUX["Customer interaction"] FormulaAPI["CustomerFormulaAPI"] UX["Frontend<br/>(self-connect link)"] end subgraph Orchestration["Orchestration"] Sched["ScheduleAPI"] end %% Portal flow OpsUser --> Portal --> Edge --> Meter Edge <-.-> KC %% Core links Meter <--> IGW IGW <--> Gateware <--> MeterHW Meter <--> ILime ILime <--> Lime Meter <--> IBFUS IBFUS <--> BFUSapi Meter <--> IBiz IBiz <--> BFUSdb Meter --> Notif --> Tellus Meter <--> FormulaAPI --> UX Meter <--> Sched %% Planned Meter <--> IBankID IBankID <--> BankID
Main flows
Section titled “Main flows”Move-out: automatic disconnect (very short)
Section titled “Move-out: automatic disconnect (very short)”- Customer provides a move-out date
- MeterControlAPI evaluates whether a successor customer exists for the facility
- If no successor exists, a disconnect is scheduled for day boundary via ScheduleAPI
- At execution time, MeterControlAPI initiates disconnect via Gateware integration
- Status is updated in BFUS and history/case information is recorded in Lime (where applicable)
Move-in: customer self-connect (very short)
Section titled “Move-in: customer self-connect (very short)”- Customer receives an SMS containing a link to the self-connect flow
- Customer opens the link and approves terms in the frontend
- CustomerFormulaAPI confirms approval back to MeterControlAPI
- MeterControlAPI initiates connect via Gateware integration
- Status is updated in BFUS and history/case information is recorded in Lime (where applicable)
Management portal
Section titled “Management portal”An operational web portal is provided for managing flows and rules/conditions used in connect/disconnect automation.
The portal allows:
- Editing conditions and rule configuration for flows
- Starting flows manually
- Viewing ongoing flows
- Deactivating/cancelling flows when needed
The portal is hosted in Azure Static Web Apps and uses the shared platform edge (Front Door + API Management + Keycloak) to access on-prem backend services.
Platform integration
Section titled “Platform integration”Till- och frånkoppling follows standard platform patterns:
- Backend services hosted on-prem Kubernetes
- External access routed through Azure Front Door and API Management
- Authentication handled via Keycloak (for portal and operational access)
- Service-owned databases hosted on-prem
- Saga orchestration used for coordinated multi-step workflows
Data ownership
Section titled “Data ownership”This solution owns:
- Flow/rule configuration (conditions, parameters)
- Execution state for ongoing flows
- Audit/history records created by the solution (where applicable)
Source systems retain ownership of master data:
- BFUS for customer/service status and facility information
- Lime for CRM cases/history
- Gateware for metering control state
Operations
Section titled “Operations”Deployment
Section titled “Deployment”- Portal frontend deployed via Azure Static Web Apps
- Backend services deployed on on-prem Kubernetes
- Container images published through Azure Container Registry
Observability
Section titled “Observability”- Centralized service logging
- Platform monitoring and alerting
Common operational concerns
Section titled “Common operational concerns”- Gateware connectivity or command failures (connect/disconnect)
- Missing or incorrect facility/customer data from BFUS views
- BFUS REST API disruptions when updating service status
- SMS delivery issues via TellusTalk
- ScheduleAPI execution failures around day boundary
- Customer approval flow failures (CustomerFormulaAPI / frontend)
Ownership
Section titled “Ownership”- Functional owner: Mät & Data + Olle Jonsson
Known constraints
Section titled “Known constraints”- Automatic disconnect depends on accurate successor detection in BFUS data
- Day-boundary scheduling requires ScheduleAPI availability
- Customer self-connect requires SMS deliverability and reachable frontend
- Meter operations depend on Gateware and meter availability