← Browse

@firstof9/virtual-hub

A

Overview of the Virtual Hub design pattern used to manage shared settings centrally across multiple GasBuddy station configurations.

skillclaude

Install

agr install @firstof9/virtual-hub --target claude

Writes 1 file into .claude/skills/, pinned to git-56d6e152.

  • .claude/skills/virtual-hub/SKILL.md

Document


name: virtual_hub description: Overview of the Virtual Hub design pattern used to manage shared settings centrally across multiple GasBuddy station configurations.

Virtual Hub Architecture

The custom component implements a Virtual Hub config entry (unique_id = "hub") to hold global settings shared across individual station entries.

Keys Shared Centrally

  • solver: The FlareSolverr URL used to bypass Cloudflare.
  • timeout: Request timeout in milliseconds.
  • brand_adjustments: Price adjustments per brand configured as a YAML block.

How it works in code

1. Dynamic Settings Resolution

The update coordinator resolves settings using self._get_hub_setting(key, default). This helper automatically checks for an active "hub" config entry first and returns its options. If not found, it falls back to the individual station's config:

def _get_hub_setting(self, key: str, default: Any = None) -> Any:
    for entry in self.hass.config_entries.async_entries(DOMAIN):
        if entry.unique_id == "hub":
            val = entry.options.get(key) or entry.data.get(key)
            if val is not None:
                return val
    return self._config.options.get(key) or self._config.data.get(key, default)

2. Device Registry Nesting

The Hub config entry registers a central device in the Home Assistant device registry. Station sensors specify via_device=(DOMAIN, "hub") in their device_info to visually group the stations under the main Hub card in the UI.

3. Automatic Settings Migration

When the Hub entry is set up, a routine automatically imports and merges the solver, timeout, and brand adjustments from any existing station entries into the Hub, and removes those options from the stations to prevent stale duplicates.

Trustgrade A

  • passBody integrity

    Whether the stored document is plausibly the kind of file the artifact declares, rather than something fetched by mistake.

  • passType matchnot applicable to this artifact type

    Whether the artifact is really the kind of thing its metadata claims it is.

  • passFreshness

    How long since the source repository was last pushed to.

  • passPrompt injection

    Scans the artifact's own text for instructions aimed at your agent rather than at you.

  • passLicense

    Whether the source repository declares an SPDX license permissive enough to redistribute.

How the grade is calculated

Each check contributes 0 points when it passes, 1 when it warns, and 2 when it fails. The total maps to a letter:

  • Aevery check passed
  • Bone warning
  • Ctwo warnings
  • Dprompt injection or body integrity failed, or three warnings
  • Fone of those failed, and something else is wrong

These are automated hygiene checks, not a security audit, and not a dependency or vulnerability scan. A grade of A means nothing was flagged — not that the artifact is safe.

Versions

  • git-56d6e15239252026-07-31