energy-app-middle-integration

Use when integrating with the energy-app-middle BFF service - covers REST API endpoints, gRPC client setup, authentication headers, multi-tenancy, and downstream service dependencies for the changyuanfeilun energy platform.

Safety Notice

This listing is from the official public ClawHub registry. Review SKILL.md and referenced scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "energy-app-middle-integration" with this command: npx skills add effort02/energy-app-middle-integration

energy-app-middle Integration Guide

Overview

energy-app-middle is a BFF + API aggregation layer for the distributed energy management platform. It exposes REST APIs to three client types (Owner / Provider / Platform) and orchestrates calls to IoT Core, IoT PaaS, IAM, algorithm services, and time-series databases.

Quick Reference

Client TypeBase PathAudience
Owner API/api/owner/*Energy asset owners
Provider API/api/provider/*Service providers
Platform API/platform-api/*Platform admins
gRPC Serverport 9090Internal services
Managementport 38081Actuator / metrics

1. Key REST Endpoints

Owner API (/api/owner/)

MethodPathDescription
GET/api/owner/der/control_record/{resourceId}DER control records (paginated)
GET/POST/api/owner/der/control_automation/{resourceId}DER automation settings
POST/api/owner/der/control_automation/{resourceId}/switchToggle automation on/off
POST/api/owner/der/control_automation/{resourceId}/deviceDevice automation properties
GET/POST/api/owner/project/price/{projectId}Electricity pricing
GET/api/owner/project/statistics/*Project electricity statistics
GET/api/owner/project/trend/*Project trend charts
GET/POST/api/owner/der/plan_prompt/*DER plan prompts

Provider API (/api/provider/)

MethodPathDescription
GET/api/provider/der/{resourceId}/billing_typeBilling type (TOU/Market)
GET/POST/api/provider/der/{resourceId}/market_price_configMarket price configs

Platform API (/platform-api/)

MethodPathDescription
GET/platform-api/market/config?marketCode={code}Market metric configurations
POST/platform-api/dataQuery market metric data

2. Authentication & Headers

Token validation is delegated to IAM via gRPC. All requests must carry:

HeaderDescription
X-ACCESS-TOKENJWT token (validated by IAM)
X-AppApp code
X-TenantTenant code
X-UIDUser UID (set by gateway)
X-PUIDParent UID (for sub-accounts)

All data is tenant-scoped — tenantCode is extracted from request context and applied to every query.

3. gRPC Integration (Internal Services)

Dependency

<dependency>
    <groupId>com.feilun</groupId>
    <artifactId>energy-app-middle-grpc-interface</artifactId>
</dependency>

Client Configuration

grpc:
  client:
    energy-app-middle:
      address: dns:///energy-app-middle.${K8S_POD_NS}.svc.cluster.local:9090
      negotiationType: PLAINTEXT
      enableKeepAlive: true

4. Downstream Dependencies

ServiceProtocolPurpose
iamgRPCToken validation, authorization
iot-coregRPCDevice management & queries
iot-paasgRPCDevice grouping, batch tasks
basicgRPCInfrastructure services
algorithm-der-power-forecastHTTPPV power forecasting
algorithm-dispatchHTTPDR dispatch planning
algorithm-bess-optHTTPBattery storage optimization
algorithm-bidHTTPVPP spot bidding
MySQLJDBCTransactional data
TDEngineJDBCTime-series device metrics
RisingWaveJDBCReal-time metric aggregation
Apache PulsarMessagingDevice events, market data
PowerJobHTTPDistributed job scheduling

5. Key DTOs

DerAutomationSettingsReq:
  dailyMaxImport/Export, dailyMinimalImport/Export (Double)
  maximumExportPower/ImportPower (Double)
  opportunityImportPrice/ExportPrice (Double)

DerControlRecordRes:
  resourceId, controlCode, status
  startTime, endTime, controlDate
  controlCurve (JSON array of power points)

MarketMetricDataReq:
  marketCode (AEMO_REGIONS: NSW1/QLD1/VIC1/SA1/TAS1)
  metrics (List<String>), targetId, startTime, endTime

6. Environment Variables

VariablePurpose
K8S_POD_NSKubernetes namespace (used in gRPC addresses)
BIZ_NAMEBusiness code (energy-app-middle)
SPRING_PROFILES_ACTIVEProfile (localdev / prod)
k8s.all.mysql.host/portMySQL connection
k8s.eam.mysql.databaseMySQL database name
k8s.all.tdengine.hostTDEngine host
k8s.all.risingwave.host/portRisingWave connection
k8s.all.pulsar.service-urlPulsar broker URL
k8s.all.powerjob.worker.server-addressPowerJob server

7. Common Mistakes

MistakeFix
Missing X-Tenant headerRequired for all requests — tenant isolation is enforced
Calling gRPC without X-UID/X-PUIDIoT PaaS interceptor requires both headers
Querying metrics without time rangeTDEngine/RisingWave queries require startTime + endTime
Wrong marketCodeAEMO regions: NSW1, QLD1, VIC1, SA1, TAS1 only

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Coding

Spicy Ai Video

Turn a 60-second talking head clip into 1080p high-energy edited videos just by typing what you need. Whether it's turning bland footage into visually intens...

Registry SourceRecently Updated
Coding

Video Maker Fast

Get polished MP4 videos ready to post, without touching a single slider. Upload your video clips (MP4, MOV, AVI, WebM, up to 500MB), say something like "trim...

Registry SourceRecently Updated
Coding

Generation Generator

generate text prompts or clips into AI generated videos with this skill. Works with MP4, MOV, PNG, JPG files up to 500MB. marketers, content creators, social...

Registry SourceRecently Updated
Coding

Editor On Android

Get edited MP4 clips ready to post, without touching a single slider. Upload your video clips (MP4, MOV, AVI, WebM, up to 500MB), say something like "trim th...

Registry SourceRecently Updated