E-Stop IP

This commit is contained in:
chk
2026-06-12 18:59:56 +02:00
parent 3e3023fa63
commit bfb84fab50
8 changed files with 78 additions and 12 deletions

View File

@@ -25,9 +25,11 @@ module.exports = class ShellyEmergencyStop extends SenderInterface {
constructor(url, options = {}) {
super();
this._offUrl = url || null;
this._onUrl = url ? url.replace('on=false', 'on=true') : null;
// Switch.GetStatus?id=0 — leitet Status-URL aus der Switch.Set-URL ab
this._statusUrl = url ? url.replace(/\/rpc\/.*$/, '/rpc/Switch.GetStatus?id=0') : null;
// Explizite URL-Felder haben Vorrang vor Ableitungslogik.
// Das erlaubt IP-Adressen statt .local-Hostnamen (nötig in Docker-Umgebungen,
// wo mDNS nicht verfügbar ist).
this._onUrl = options.urlOn || (url ? url.replace('on=false', 'on=true') : null);
this._statusUrl = options.urlStatus || (url ? url.replace(/\/rpc\/.*$/, '/rpc/Switch.GetStatus?id=0') : null);
this.url = url || null; // für getStatus / InfoServer-Anzeige
this.state = 'ready';
this.error = null;