@impact0815/node-red-contrib-shelly-admin 1.0.5
Safety-first local Shelly Gen1-Gen4 fleet operations with guarded maintenance, encrypted backups, configuration drift and Easy-RSA HTTPS certificate automation.
@impact0815/node-red-contrib-shelly-admin
English (default) · Deutsch
Safety-first, local Shelly fleet administration for Node-RED: discovery, inventory, monitoring, guarded firmware maintenance, encrypted native backups, configuration drift, scheduled reboots, and optional HTTPS certificate automation. The package supports Shelly Gen1–Gen4 through the local Gen1 and Gen2+ HTTP APIs; it does not require the Shelly cloud or MQTT.
A practical control center for Shelly users
Shelly Admin turns Node-RED into a local operations console for a mixed Shelly installation. Instead of opening devices one by one, you can discover the fleet, see what is healthy or needs attention, compare firmware, inspect switch and measurement data, and run carefully gated maintenance workflows from one place.
Useful things you can do
- Find and organize local devices: scan authorized networks, build a persistent inventory, retain friendly device names, and distinguish Gen1 through Gen4 devices, models, profiles, firmware, IP addresses, reachability, and capabilities.
- See fleet health at a glance: poll devices locally and track latency, Wi-Fi signal where available, memory/filesystem evidence, temperature, power, voltage, current, energy, uptime, restart evidence, firmware availability, and structured observations.
- Use the supplied fleet Dashboard: get searchable/sortable device cards and tables, channel states, measurements, findings, firmware status, HTTPS status, detail views, clickable diagnostic counters, and guarded device actions through the optional FlowFuse Dashboard example.
- Spot changes and unusual behavior: keep bounded history, conservative baselines, anomaly/trend evidence, peer comparisons, offline/recovery transitions, unexpected restart evidence, and human-readable findings without claiming to predict failures.
- Handle firmware maintenance more safely: check stable or beta availability, preview eligible targets with dry-run, require explicit confirmation for real updates, serialize risky work, expose progress, and reconcile device state after reconnect.
- Back up supported devices: create encrypted native backups, keep archive and encryption key separate, verify checksums and retention metadata, and inspect a restore plan before any recovery work. Restore execution intentionally remains preview-only.
- Track configuration drift: capture redacted canonical snapshots, compare desired/current state, set baselines, and follow open/present/cleared drift findings without putting credentials into browser-facing data.
- Automate planned care: apply per-device and per-class policies, maintenance windows, scheduled reboots, firmware-check intervals, history retention, and carefully opt-in temperature actions.
- Work with authenticated and mixed fleets: reuse the configuration node's default or per-device credential profiles with Digest/Basic authentication, protocol/TLS settings, retries, timeouts, and request serialization.
- Optionally bring your own CA: plan, prepare, deploy, renew, and verify Shelly HTTPS server certificates with DNS, SAN, CA, fingerprint, capability, backup, reboot, and post-deployment identity gates—while keeping the CA private key outside Node-RED.
- Stay local: normal discovery, monitoring, Dashboard requests, and maintenance use the devices' local APIs; Shelly Cloud and MQTT are not required.
The package includes beginner, read-only monitoring, guarded maintenance, notification routing, safe-change, and full Dashboard example flows. Start with the read-only beginner flow and add only the workflows you actually need.
Safety first: this project can perform real administrative operations. Write actions are deliberately gated, but firmware updates, backups, reboots, switching, configuration work, and certificate deployment can still interrupt devices or connectivity. Review dry-runs, start with one non-critical recoverable device, keep current backups and a tested recovery path, and read the full Safety and disclaimer section before enabling mutations.
What is new in 1.0.5
- Builds and verifies source/release ZIPs entirely with Node.js, eliminating external
zip/unzip, WSL, Git Bash, 7-Zip, and other archiver requirements on Windows while keeping deterministic safe archives on every platform. - Uses the same cross-platform npm resolver for both exact-package auditing and release building, so native Windows
npm run release:buildsupportsnpm_execpath,npm.cmd, and paths with spaces without changing Linux/macOS behavior. - Resolves npm cross-platform for the exact-package audit: Windows npm scripts run
npm_execpaththrough Node, direct runs supportnpm.cmdshims, and Linux/macOS keep the shell-freenpminvocation. - Keeps the mandatory lint gate portable on Windows by streaming shell scripts to
bash -n -sinstead of passing nativeC:\...paths to Git Bash. - Makes the release audit a mandatory gate for repository source and the exact
npm packtarball, with rule-specific, reasoned allowlisting for synthetic fixtures. - Blocks private keys, authorization secrets, tokens, sensitive files, private network/DNS/device identifiers, populated secret fields, and optional locally supplied environment values before publishing.
- Prevents automatic HTTPS-to-HTTP downgrade after TLS/certificate failures; only reachability failures may use HTTP and the returned transport records the downgrade reason.
- Records the transport used to bootstrap the device private key, warns when it was HTTP, and adds optional PKI-broker peer-UID and SAN-scope restrictions.
- Makes Node-RED admin routes fail closed without permission middleware, switches npm publication to Trusted Publishing/OIDC, pins GitHub Actions, and adds bilingual documentation and example comments.
Quick start for first-time users
1. Check the prerequisites
You need:
- Node.js 18 or later (18 is supported for 1.0.x compatibility but is end-of-life; Node.js 20 or newer is recommended);
- Node-RED 3.1 or later;
- network access from Node-RED to the Shelly devices;
- credentials for the devices, if authentication is enabled; and
- authorization to scan the target network.
FlowFuse Dashboard is only needed for the optional dashboard example:
cd ~/.node-red
npm install @flowfuse/node-red-dashboard
2. Install the package
Published package:
cd ~/.node-red
npm install @impact0815/[email protected]
Supplied release archive:
cd ~/.node-red
npm install /path/to/impact0815-node-red-contrib-shelly-admin-1.0.5.tgz
Restart Node-RED after installation.
3. Make state persistent
In settings.js, configure a file-backed Context store so inventory, history, maintenance results, and drift state survive a restart:
contextStorage: {
default: "memoryOnly",
memoryOnly: { module: "memory" },
file: { module: "localfilesystem", config: { flushInterval: 30 } }
}
Restart Node-RED again, then select file in the Shelly Admin config node.
4. Import the beginner flow
- Open Menu → Import in Node-RED.
- Import
examples/00-first-time-user.json. - Open the
shelly-admin-confignode before deploying. - Replace the example target
192.0.2.0/24with an authorized network. - Enter credentials in the config node. Never put passwords in Function nodes, Inject nodes, or
msgobjects. - Select the file-backed Context store.
- Deploy.
5. Run the safe read-only checks
Run the numbered Inject nodes in order:
- Full scan — finds devices and builds the inventory.
- Monitor once — reads current health and measurements.
- Firmware check — checks availability but installs nothing.
Confirm device names, models, IP addresses, generation, firmware, and reachability before enabling schedules or importing maintenance examples.
6. Back up before changing devices
Use examples/07-safe-change-pipeline.json. Start with the backup plan and keep dryRun:true. A real backup can reboot the device and requires confirm:true. Native backup is only available when the device advertises the required firmware 2.2 backup methods.
Dashboard and HTTPS status
Import examples/08-dashboard-safe-change-tls.json after installing FlowFuse Dashboard 2.0. It expects the Discovery, Monitor, and Maintenance outputs to be connected through the named Link nodes documented in the examples guide.
Each device card displays one of these HTTPS states:
| Card state | Meaning | Recommended action |
|---|---|---|
| HTTPS verified | CA, hostname/SAN, fingerprint, and device identity passed the latest recorded check | Monitor expiry |
| HTTPS not verified | The device is capable or was checked, but a fully verified HTTPS result is not recorded | Run the read-only TLS check |
| HTTPS unsupported | Capability evidence says the device cannot currently accept a server certificate | Keep HTTP, update supported firmware, or replace the device |
| HTTPS error | DNS gate, deployment, or post-deployment verification failed | Open device details and resolve the recorded error |
| HTTPS unchecked | No TLS capability/status result has been recorded yet | Run the read-only fleet recheck |
Gen2+ devices that cannot use automatic upload can additionally show Certificate prepared. The matching certificate and key remain on the PKI host until an administrator deliberately exports them for manual upload. Gen1 never receives a prepared certificate.
The detail view retains certificate expiry, CA trust, SANs, fingerprint, device identity, capability reason, missing RPC methods, and the next action. It also shows the inventory/device name, technical ID, generation, firmware, inventory IP, generated DNS name, resolved DNS addresses, exact reason code, and a bilingual explanation. Fleet counters are clickable filters that reveal the affected devices. DNS mismatches explicitly compare DNS IP with inventory IP.
Important: “Unsupported” is evidence-based. Gen1 is unsupported. Gen2+ is supported only when both
Shelly.PutHTTPServerCertandShelly.PutHTTPServerKeyare actually advertised and known firmware is not below 2.0.0.
Safe operation rules
- Use
dryRun:trueuntil the selected devices and plan are correct. - Real update, reboot, backup, and certificate operations require explicit confirmation.
- Fleet certificate changes additionally require
allowAll:trueand are always sequential (maxSimultaneouslyUnavailable:1). missing-onlyskips verified devices, deploys to upload-capable devices, and prepares Gen2+ certificates for manual upload when upload RPCs are unavailable.tls-prepareissues certificates for eligible Gen2+ devices without upload, reboot, or device change.forcereissues and deploys to upload-capable devices; non-upload-capable Gen2+ devices receive prepared material for manual upload.- With
failFast:false, a per-device error is recorded and the next device is processed. WithfailFast:true, unstarted devices are explicitly markednot-processed. - Test one non-critical, physically recoverable device before any fleet-wide operation.
Optional: use your own CA
The package works over ordinary HTTP without a private CA. HTTPS certificate automation is optional and disabled by default.
If you want certificates issued by your own Easy-RSA CA, follow:
- Optional custom-CA guide — English
- Optionale Anleitung für eine eigene CA — Deutsch
- TLS acceptance tests — German
The CA private key must remain on the host. During initial certificate bootstrap, the device private key may be uploaded over HTTP when the device has no verified HTTPS endpoint; perform that operation only on an isolated trusted network and review the returned keyTransport field. Do not mount the PKI, Docker socket, or CA key into Node-RED. Node-RED communicates with the supplied allow-listed broker over a Unix socket and receives only the short-lived device certificate material needed for a confirmed operation.
Upgrade from 0.8.x or 1.0.0–1.0.3
- Back up the Node-RED user directory or Docker
/datavolume. - Install
1.0.5and restart Node-RED. - Keep the existing
shelly-admin-confignode and its references; do not recreate or rewire it. - Import the new
examples/08-dashboard-safe-change-tls.jsonif you use the Dashboard. An npm package update cannot modify a flow that was already imported. - With multiple Shelly Admin configurations, select the intended configuration in Shelly HTTP (authenticated); a sole deployed configuration is selected automatically.
- Test a read-only channel-state request on one Gen1 and one Gen2+ device before any switch command.
Nodes
| Node | Purpose | Outputs |
|---|---|---|
shelly-admin-config |
Credentials, transport, discovery, persistence, backups, desired state, history, TLS, and safety | Configuration node |
shelly-admin-discovery |
Full/incremental discovery and inventory validation | Inventory · events · errors |
shelly-admin-monitor |
Polling, history, observations, and temperature safety | Health · alerts · errors |
shelly-admin-maintenance |
Firmware, backup/restore planning, snapshots/drift, reboots, and optional certificates | Result · progress · errors |
shelly-admin-request |
Authenticated Dashboard status/configuration/switch requests using the shared credential resolver | Result or structured error |
Message examples
Read-only full scan:
{"action":"scan","mode":"full","targets":"192.0.2.0/24"}
Read-only TLS fleet check:
{"action":"tls-plan","allowAll":true,"dryRun":true,"failFast":false}
Deploy only where verified HTTPS is missing:
{"action":"tls-deploy","allowAll":true,"deploymentMode":"missing-only","dryRun":false,"confirm":true,"failFast":false}
Reissue for every eligible device:
{"action":"tls-deploy","allowAll":true,"deploymentMode":"force","dryRun":false,"confirm":true,"failFast":false}
The complete contract is in Message API (Deutsch). For a guided first installation, see the Beginner guide (Deutsch); for upgrades, see Upgrading (Deutsch).
Examples
Start with one flow, not all flows at once:
00-first-time-user.json— discovery, monitor, and read-only firmware check;01-discovery-monitor.json— compact read-only starter;02-safe-maintenance.json— guarded maintenance;03-complete-operations-en.json— complete English operation flow;04-kompletter-betrieb-de.json— equivalent German flow;07-safe-change-pipeline.json— backup, restore preview, snapshot, and drift;08-dashboard-safe-change-tls.json— FlowFuse Dashboard, Safe Change, and optional TLS fleet operations.
See examples/README.md for prerequisites, wiring, safe first runs, and expected output.
Safety and disclaimer
This project performs administrative operations on real Shelly devices, including configuration changes, firmware maintenance, backup creation and restore planning, reboots, optional TLS certificate deployment, and multi-device fleet operations. Restore execution is not implemented; the current restore feature is preview-only.
Although the project includes dry-run modes, capability checks, confirmation and backup gates, DNS validation, sequential rollout, post-operation verification, and other safeguards, administrative operations can still cause temporary device unavailability, configuration changes, failed updates, loss of connectivity, incomplete recovery, or other unexpected effects.
Before using write or fleet operations:
- review the dry-run, capability, DNS, and target-selection results;
- test changes on one non-critical, physically recoverable Canary device first;
- create and verify a current backup before relying on it;
- keep a tested recovery path and local access available;
- use sequential rollout and stop when verification evidence is incomplete; and
- keep private CA keys and device credentials out of Node-RED flows, messages, logs, dashboards, screenshots, support bundles, and public repositories.
The Easy-RSA/private-CA integration is optional, disabled by default, and intended only for users who understand their local PKI, certificate trust model, key protection, DNS, and device recovery process. The CA private key must remain outside Node-RED.
This software is provided without warranty. You are responsible for deciding whether an operation is appropriate for your devices and environment. Use the software and its administrative functions at your own risk. This is an unofficial community project and is not affiliated with or supported by Shelly/Allterco.
The complete legal and operational disclaimer is also available as English and Deutsch.
Additional limits:
- Trend observations are not guaranteed failure predictions.
- The project does not replace manufacturer protection, smoke alarms, professional electrical work, inspection, or supervised maintenance.
- Automatic temperature shutdown remains off unless both explicit policy-action mode and an exact device policy enable it. Outputs are never automatically re-enabled.
- Configuration restore remains preview-only and is not firmware rollback.
- Hardware and firmware capabilities vary. The software fails closed when required methods are not proven.
Documentation map
- Examples guide · Deutsch
- Message API · Deutsch
- Optional custom CA · Deutsch
- Release operations
- Release notes 1.0.5 · Deutsch
- Changelog
- Security policy
Development and verification
npm ci
npm run lint
npm test
npm run test:coverage
npm pack --dry-run
Build release artifacts with:
npm run release:build