Skip to content

v0.2.0

Choose a tag to compare

@github-actions github-actions released this 25 Nov 04:21
· 6 commits to main since this release
fd36cf9

plugyard can now be driven from another machine: over HTTP, by an AI agent through MCP tools, and from a container.

Before you update

Nothing you have needs changing. Site files, Chargerfiles, scenarios and saved chargers work as before.

  • Updating from v0.1.x: stop running sites first (plugyard site down, or plugyard stop <charger>), then plugyard update. v0.1.x refuses to update while a site runs, and says which. From v0.2.0 on, update stops and restarts them for you.
  • Nothing new listens unless you start it. The API runs only after plugyard api up or site up --api, and then on 127.0.0.1 only, until you make a token and name another address.

New

An HTTP API, for those with no shell where plugyard runs

On a shared staging server, the app and dashboard teams can now plug an EV in, present a tag or cause a fault themselves.

plugyard api token create mobile-team --site staging   # prints the token, once
plugyard api up -d --listen 0.0.0.0:7070
curl -X POST -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
     -d '{"tag": "04A1B2C3"}' https://plugyard.example.com/v1/chargers/FAST-1/tap
curl -H "Authorization: Bearer $TOKEN" "https://plugyard.example.com/v1/chargers/FAST-1/wait?state=Charging"
  • It lists and inspects chargers, runs the actions of plugyard exec, waits for a state, and reads a charger's log. Starting chargers, updating plugyard and anything that touches files stay on the command line.
  • Tokens have names, can be limited to one site, and can be read-only. plugyard api logs shows who did what to which charger.
  • A web page in a browser cannot act through it.
  • plugyard api spec prints the description as an OpenAPI document.

Tools for AI agents (MCP)

The API serves the same reading and actions as tools, at /mcp. In Claude Code:

claude mcp add --transport http plugyard https://plugyard.example.com/mcp \
       --header "Authorization: Bearer $TOKEN"

Then ask: "plug an EV into FAST-1, start a session with tag 04A1B2C3, and tell me what the CSMS answered".

  • Reading: list_chargers, inspect_charger, wait_for_state, read_logs.
  • Acting: plug, unplug, tap, fault, clear_fault, go_offline, go_online, reboot, fail_next.
  • A read-only token is offered the reading tools only.
  • Tried with Claude Code. Other agent clients have not been tried yet; reports are welcome.

A container image

plugyard is on Docker Hub as amraa1/plugyard, for linux/amd64 and linux/arm64.

docker run --rm -e CSMS_URL=ws://host.docker.internal:9000/ocpp amraa1/plugyard:0.2.0
  • With nothing mounted it runs three chargers against the CSMS you name. Mount a folder with your site.yaml at /site to run your own.
  • plugyard site up --api <address> runs a site and the API in one process, which is what a container wants.
  • examples/docker/compose.yaml is a ready setup for a server, with a volume and a restart after a crash or a reboot.

update and uninstall take care of what is running

  • plugyard update stops running sites and the API, replaces the program, and starts them again with the same chargers. It asks first, and says how many transactions would end.
  • plugyard uninstall stops them after you confirm.

Not yet tried

  • The API and the tools behind a reverse proxy with HTTPS.
  • The image on an ARM machine.
  • A restart of running sites across a real update, since this is the first version that does it.

What's Changed

  • Add an HTTP API for callers with no shell on the machine by @Amraa1 in #31
  • Stop what is running for update and uninstall, and restart it by @Amraa1 in #32
  • Add the container image and site up --api by @Amraa1 in #33
  • Add wait and logs to the HTTP API by @Amraa1 in #34
  • Serve the API's reading and actions as MCP tools by @Amraa1 in #35

Full Changelog: v0.1.4...v0.2.0