OpenADR (Open Automated Demand Response) is how a utility or an aggregator tells the energy resources of its customers what is coming: a price for every hour of tomorrow, a request to shed load, a limit on export. Version 3 is a REST API over HTTPS with three roles. The VTN (virtual top node) is the server in the middle. Business Logic on the utility’s side publishes programs and events to it. A VEN (virtual end node) at the customer site, such as an energy management system, a charger or a gateway, reads the events meant for it and sends reports back.
Where you meet it
- Dynamic electricity tariffs sent to home and building energy management systems
- Demand response and flexibility programs run by utilities and aggregators
- EV chargers, heat pumps and batteries that follow a price or a grid signal
Quickstart
OpenADR has no OT Fabric command-line tool. The library ships example programs instead: a standalone VTN, a VEN and a Business Logic client that publishes a tariff from a CSV file.
Run the example programs
From a checkout of go-openadr, run a VTN, a Business Logic client and a VEN through the program, event and report workflow in one process:
go run ./examples/quickstartFrom Go
go get github.com/otfabric/go-openadrA VEN that reads the active events of a program and prints the prices (abridged from the go-openadr README):
ven, err := client.NewVEN(client.Config{ BaseURL: "https://vtn.example.com/openadr3", Credentials: &client.Credentials{ClientID: id, ClientSecret: secret},})if err != nil { return err}
events, err := ven.Events(ctx, client.EventQuery{ProgramID: programID, ActiveOnly: true})if err != nil { return err}for _, event := range events { for _, interval := range event.Intervals { for _, payload := range interval.Payloads { if price, ok := payload.Values[0].Number(); ok && payload.Type == "PRICE" { fmt.Println(interval.ID, price) } } }}The client finds the token endpoint from the VTN, gets a token with OAuth2 client credentials, and renews it when it expires.
What go-openadr supports
| Roles | VEN client, Business Logic client, and a VTN as an embeddable http.Handler |
| Operations | All 45 operations of OpenADR 3.1.0 in the VTN |
| Authentication | OAuth2 client credentials, JSON Web Tokens with static keys or JWKS, scopes, object ownership, targeting; anonymous clients when allowed |
| Notifications | Webhooks (durable across restarts with an outbox) and MQTT; WebSocket and resource groups as opt-in extensions shared with OpenLEADR |
| In production | Logging, metrics, client retries with Retry-After, and a rate limiting hook on the VTN that answers 429 |
| Extras | Intervals as a table with the timing rules applied (timeline), CSV in and out, mDNS discovery of a local VTN |
| Dependencies | None outside the Go standard library |