arazzo: 1.0.1 info: title: Tibber Real-Time Power Readiness summary: Resolve the WebSocket subscription URL and check whether a home has Tibber Pulse real-time consumption enabled before opening a liveMeasurement stream. description: >- Two chained GraphQL operations against Tibber's legacy /gql endpoint that prepare a client to consume real-time power. The first query reads the viewer's websocketSubscriptionUrl and the per-home features.realTimeConsumptionEnabled flag; the flow then branches on that flag so only homes with a Tibber Pulse confirm the home detail needed to open a stream. Adaptation note: the actual liveMeasurement feed is delivered over a GraphQL WebSocket subscription, which is not an HTTP request and therefore cannot be expressed as an Arazzo step; this workflow stops at surfacing the subscription URL and readiness so a downstream client can open the socket itself. Each step spells out its request inline so the flow can be read and executed without opening the underlying OpenAPI description. version: 1.0.0 sourceDescriptions: - name: tibberGraphqlApi url: ../openapi/tibber-graphql-api-openapi.yml type: openapi workflows: - workflowId: realtime-power-readiness summary: Surface the WebSocket subscription URL and confirm a home is ready for liveMeasurement. description: >- Reads the viewer's websocketSubscriptionUrl and each home's realTimeConsumptionEnabled flag, branches on whether real-time is enabled, and on the enabled path confirms the home's id and nickname so a client can open the liveMeasurement WebSocket subscription. inputs: type: object required: - accessToken properties: accessToken: type: string description: Tibber personal access token (bearer) issued at developer.tibber.com. steps: - stepId: readReadiness description: >- Read the viewer's WebSocket subscription URL and the per-home real-time consumption flag, capturing the URL, first home id, and that flag. operationId: executeGraphQL parameters: - name: Authorization in: header value: Bearer $inputs.accessToken requestBody: contentType: application/json payload: query: "{ viewer { websocketSubscriptionUrl homes { id appNickname features { realTimeConsumptionEnabled } } } }" successCriteria: - condition: $statusCode == 200 outputs: websocketSubscriptionUrl: $response.body#/data/viewer/websocketSubscriptionUrl homeId: $response.body#/data/viewer/homes/0/id realTimeEnabled: $response.body#/data/viewer/homes/0/features/realTimeConsumptionEnabled onSuccess: - name: realtimeEnabled type: goto stepId: confirmHome criteria: - context: $response.body condition: $.data.viewer.homes[0].features.realTimeConsumptionEnabled == true type: jsonpath - name: realtimeDisabled type: end criteria: - context: $response.body condition: $.data.viewer.homes[0].features.realTimeConsumptionEnabled == false type: jsonpath - stepId: confirmHome description: >- Confirm the home id, nickname, and real-time flag for the home that has Tibber Pulse enabled so a client can open the liveMeasurement stream. operationId: executeGraphQL parameters: - name: Authorization in: header value: Bearer $inputs.accessToken requestBody: contentType: application/json payload: query: "{ viewer { homes { id appNickname features { realTimeConsumptionEnabled } } } }" successCriteria: - condition: $statusCode == 200 outputs: homeId: $response.body#/data/viewer/homes/0/id appNickname: $response.body#/data/viewer/homes/0/appNickname outputs: websocketSubscriptionUrl: $steps.readReadiness.outputs.websocketSubscriptionUrl homeId: $steps.readReadiness.outputs.homeId realTimeEnabled: $steps.readReadiness.outputs.realTimeEnabled appNickname: $steps.confirmHome.outputs.appNickname