Greencell: the charger on your own broker, not a cloud it never had
The HabuDen has no cloud API to connect to. It is commissioned over Bluetooth in
the Greencell GC app, pointed at an MQTT broker the owner runs, and from then on
publishes there — so the connector is an MQTT client rather than an HTTP one,
and nothing in it reaches Greencell. The wire contract is Home Assistant's own
greencell component and the greencell_client 1.0.3 library beneath it, which is
the only published description of the topics: a BROADCAST on /greencell/broadcast
draws device announcements, and /greencell/evse/{sn}/ carries current in
milliamps, voltage, power under "momentary", the EVSE state, and the access level
chosen in the app.
That meant an MQTT client, and the server takes no dependencies, so internal/mqtt
is hand-rolled the way internal/ocpp's RFC 6455 layer is. It is scoped to what
this connector needs and says so: QoS 0 for everything we send, clean session,
no reconnect — a connection lives for one plugin call, which is exactly how the
manager builds and tears down an instance. Inbound PUBLISH is accepted at QoS 0,
1 and 2 with the acknowledgements each requires, because the QoS of a delivery is
the broker's choice and not ours; an unacknowledged QoS 1 is redelivered forever.
Read-only, and the reason is worth writing down rather than rediscovering. A
device in EXECUTE mode accepts START, STOP, SET_CURRENT and QUERY — but the topic
those go to appears in no source: not Greencell's integration page, not
greencell_client, and Home Assistant ships sensor-only for that same reason.
Publishing to a guessed topic would be a control feature whose failure mode is a
driver believing they stopped a charge. So the access level is reported, and
commandTopic is the seam: an operator who has watched their own broker and found
theirs sets it, and a state read then sends QUERY — the one command a READ-mode
device also honours — instead of waiting out the charger's publish cadence. The
day the topic is public, control is a payload away from the same field.
What the cascade resolves here is a broker, not an account, so host, port, TLS and
credentials resolve together from the highest layer that names a host: an
organization's address paired with a user's password would address a broker with
credentials never meant for it. The serial, the QUERY topic and the listen window
each describe the charger rather than the endpoint, so each resolves on its own.
Two reading rules the tests pin. A phase the device did not report stays nil
rather than zero, because zero amps on a charger is a real measurement — a JSON
null decoding to 0.0 was a live bug until a test caught it — and a partial read
returns with received/complete flags instead of failing, since a device that
publishes some topics on a slower cadence is still worth reading. And a reachable
broker with no charger on it is degraded, not down: the half we configure works
and the missing half is the device. The plugin's end-to-end tests run against an
in-process broker written to the raw wire format, so a bug in the client cannot
hide behind a matching bug in the fixture.
The apps get the third connector card. The panel needed nothing — it renders a
plugin's ConfigFields itself — but the per-user panes are still hand-written per
integration, which is now three near-copies and the argument for the generic
version already noted in the plugins README. The web form splits the broker from
the charger because the server resolves them differently. The phone card is a
declarative config against the shared widget, which gained a number field type, a
degraded state that reads amber rather than red, and a fix for a locked field
that was covering its own displayed value with dots. Twenty keys in three
languages across both apps; Greencell, HabuDen and the literal QUERY join the
proper nouns that stay in English.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
5e6b8b4b1c
commit
340a81b0d6
26 files changed
+4330
-38
No files matched your search
@@ -317,6 +317,16 @@ export const api = {
|
||||
body: JSON.stringify(body),
|
||||
}),
|
||||
|
||||
// Greencell (HabuDen EV charger) — same cascade again, but what resolves is an
|
||||
// MQTT broker rather than a cloud account: the charger publishes to a broker
|
||||
// the owner runs, and the server joins it as a client. getGreencell returns the
|
||||
// resolved view (secrets and inherited host/username masked); saveGreencell
|
||||
// writes the caller's editable layer; testGreencell connects to the broker and
|
||||
// broadcasts for devices.
|
||||
getGreencell: () => request("/integrations/greencell"),
|
||||
saveGreencell: (body) => request("/integrations/greencell", { method: "PUT", body: JSON.stringify(body) }),
|
||||
testGreencell: () => request("/integrations/greencell/health", { method: "POST" }),
|
||||
|
||||
// Settings — advanced / danger zone
|
||||
exportData: () => requestBlob("/me/export"),
|
||||
importData: (payload) => request("/me/import", { method: "POST", body: JSON.stringify(payload) }),
|
||||
|
||||
@@ -296,7 +296,27 @@
|
||||
"controlRevoke": "Tilbagekald token",
|
||||
"controlRevokeConfirm": "Tilbagekald denne laders styringstoken? Den bliver afbrudt og kan ikke forbinde igen, før du genererer et nyt.",
|
||||
"controlConnected": "Forbundet til styrings-backend",
|
||||
"controlDisconnected": "Ikke forbundet"
|
||||
"controlDisconnected": "Ikke forbundet",
|
||||
"greencell": "Greencell (HabuDen EV-lader)",
|
||||
"greencellDesc": "Læs din Greencell-lader via den MQTT-broker, den publicerer til. Kun lokalt — ingen Greencell-skykonto er involveret.",
|
||||
"greencellBroker": "MQTT-broker",
|
||||
"greencellCharger": "Lader",
|
||||
"greencellHost": "Brokerens vært",
|
||||
"greencellHostHint": "Den broker, du pegede laderen på i Greencell GC-appen.",
|
||||
"greencellPort": "Brokerens port",
|
||||
"greencellPortHint": "Som standard 1883, eller 8883 når TLS er slået til.",
|
||||
"greencellTls": "Forbindelse",
|
||||
"greencellTlsOff": "Almindelig MQTT",
|
||||
"greencellTlsOn": "TLS (MQTTS)",
|
||||
"greencellUsername": "Brugernavn til broker",
|
||||
"greencellUsernameHint": "Lad feltet stå tomt, hvis din broker tillader anonyme klienter.",
|
||||
"greencellPassword": "Adgangskode til broker",
|
||||
"greencellSerial": "Laderens serienummer",
|
||||
"greencellSerialHint": "Valgfrit — lad det stå tomt, så finder søgningen det, der er på brokeren.",
|
||||
"greencellTimeout": "Lyttevindue (sekunder)",
|
||||
"greencellTimeoutHint": "Hvor længe der ventes på, at laderen publicerer. Greencell giver en enhed op til 30 s til at svare; hæv værdien, hvis intet findes.",
|
||||
"greencellCommandTopic": "Emne for QUERY-kommandoen",
|
||||
"greencellCommandTopicHint": "Valgfrit. Greencell beskriver en QUERY-kommando, der får laderen til at publicere med det samme, men ikke det emne, den lytter på. Finder du dit, så skriv det her, og læsninger behøver ikke vente på laderens egen kadence. Brug {sn} for serienummeret."
|
||||
},
|
||||
|
||||
"org": {
|
||||
|
||||
@@ -295,7 +295,27 @@
|
||||
"controlRevoke": "Revoke token",
|
||||
"controlRevokeConfirm": "Revoke this charger's control token? It will disconnect and can't reconnect until you generate a new one.",
|
||||
"controlConnected": "Connected to control backend",
|
||||
"controlDisconnected": "Not connected"
|
||||
"controlDisconnected": "Not connected",
|
||||
"greencell": "Greencell (HabuDen EV charger)",
|
||||
"greencellDesc": "Read your Greencell wallbox over the MQTT broker it publishes to. Local only — no Greencell cloud account is involved.",
|
||||
"greencellBroker": "MQTT broker",
|
||||
"greencellCharger": "Charger",
|
||||
"greencellHost": "Broker host",
|
||||
"greencellHostHint": "The broker you pointed the charger at in the Greencell GC app.",
|
||||
"greencellPort": "Broker port",
|
||||
"greencellPortHint": "Defaults to 1883, or 8883 with TLS on.",
|
||||
"greencellTls": "Connection",
|
||||
"greencellTlsOff": "Plain MQTT",
|
||||
"greencellTlsOn": "TLS (MQTTS)",
|
||||
"greencellUsername": "Broker username",
|
||||
"greencellUsernameHint": "Leave blank if your broker allows anonymous clients.",
|
||||
"greencellPassword": "Broker password",
|
||||
"greencellSerial": "Charger serial",
|
||||
"greencellSerialHint": "Optional — leave blank and discovery finds whatever is on the broker.",
|
||||
"greencellTimeout": "Listen window (seconds)",
|
||||
"greencellTimeoutHint": "How long to wait for the charger to publish. Greencell allows a device up to 30 s to answer; raise this if nothing is found.",
|
||||
"greencellCommandTopic": "QUERY command topic",
|
||||
"greencellCommandTopicHint": "Optional. Greencell documents a QUERY command that makes the charger publish at once, but not the topic it listens on. If you find yours, put it here and reads stop waiting for the charger's own cadence. Use {sn} for the serial."
|
||||
},
|
||||
|
||||
"org": {
|
||||
|
||||
@@ -300,7 +300,27 @@
|
||||
"controlRevoke": "Unieważnij token",
|
||||
"controlRevokeConfirm": "Unieważnić token sterowania tej ładowarki? Rozłączy się i nie połączy ponownie, dopóki nie wygenerujesz nowego.",
|
||||
"controlConnected": "Połączono z backendem sterowania",
|
||||
"controlDisconnected": "Nie połączono"
|
||||
"controlDisconnected": "Nie połączono",
|
||||
"greencell": "Greencell (ładowarka EV HabuDen)",
|
||||
"greencellDesc": "Odczytuj swoją ładowarkę Greencell przez brokera MQTT, do którego publikuje. Tylko lokalnie — konto w chmurze Greencell nie jest potrzebne.",
|
||||
"greencellBroker": "Broker MQTT",
|
||||
"greencellCharger": "Ładowarka",
|
||||
"greencellHost": "Adres brokera",
|
||||
"greencellHostHint": "Broker, który wskazałeś ładowarce w aplikacji Greencell GC.",
|
||||
"greencellPort": "Port brokera",
|
||||
"greencellPortHint": "Domyślnie 1883, a przy włączonym TLS 8883.",
|
||||
"greencellTls": "Połączenie",
|
||||
"greencellTlsOff": "Zwykłe MQTT",
|
||||
"greencellTlsOn": "TLS (MQTTS)",
|
||||
"greencellUsername": "Użytkownik brokera",
|
||||
"greencellUsernameHint": "Pozostaw puste, jeśli broker dopuszcza klientów anonimowych.",
|
||||
"greencellPassword": "Hasło brokera",
|
||||
"greencellSerial": "Numer seryjny ładowarki",
|
||||
"greencellSerialHint": "Opcjonalne — pozostaw puste, a wykrywanie znajdzie to, co jest na brokerze.",
|
||||
"greencellTimeout": "Okno nasłuchu (sekundy)",
|
||||
"greencellTimeoutHint": "Jak długo czekać, aż ładowarka opublikuje dane. Greencell daje urządzeniu do 30 s na odpowiedź; zwiększ tę wartość, jeśli nic nie zostaje znalezione.",
|
||||
"greencellCommandTopic": "Temat polecenia QUERY",
|
||||
"greencellCommandTopicHint": "Opcjonalne. Greencell opisuje polecenie QUERY, które każe ładowarce natychmiast opublikować dane, ale nie podaje tematu, na którym ona nasłuchuje. Jeśli poznasz swój, wpisz go tutaj, a odczyty przestaną czekać na własny rytm ładowarki. Użyj {sn} zamiast numeru seryjnego."
|
||||
},
|
||||
|
||||
"org": {
|
||||
|
||||
@@ -37,6 +37,7 @@ watch(tabs, (list) => {
|
||||
// list of connectors you expand to configure.
|
||||
const toyotaOpen = ref(false);
|
||||
const ankerOpen = ref(false);
|
||||
const greencellOpen = ref(false);
|
||||
|
||||
async function load() {
|
||||
loading.value = true;
|
||||
@@ -594,6 +595,142 @@ async function testAnkerConnection() {
|
||||
}
|
||||
}
|
||||
|
||||
// --- Integrations: Greencell (HabuDen EV charger) ---
|
||||
//
|
||||
// Same cascade once more, but what resolves here is an MQTT *broker*, not a
|
||||
// cloud account: host/port/TLS/credentials describe one endpoint and the server
|
||||
// resolves them together, so the form treats them as a group. The serial, the
|
||||
// QUERY topic and the listen window resolve on their own.
|
||||
//
|
||||
// Only the password and — when inherited — the host and username are masked by
|
||||
// the server; the rest are plain settings, so a locked one shows its effective
|
||||
// value the way Anker's control mode does.
|
||||
|
||||
const GREENCELL_FIELDS = ["host", "port", "tls", "username", "password", "serial", "commandTopic", "timeout"];
|
||||
const GREENCELL_MASKED = ["host", "username"]; // masked by the server when inherited
|
||||
|
||||
const greencell = ref(null); // resolved view from the server
|
||||
const greencellScope = ref("user"); // "user" | "org" (org admins only)
|
||||
const greencellForm = ref({
|
||||
host: "", port: "", tls: "off", username: "", password: "", serial: "", commandTopic: "", timeout: "",
|
||||
});
|
||||
const greencellSaving = ref(false);
|
||||
const greencellSaved = ref(false);
|
||||
const greencellError = ref("");
|
||||
const greencellTesting = ref(false);
|
||||
const greencellHealth = ref(null); // { status, detail } from the last test
|
||||
|
||||
const greencellReadOnly = computed(() => !!greencell.value?.isSuperadmin);
|
||||
const greencellScopeKey = computed(() =>
|
||||
greencell.value?.isSuperadmin ? "user" : greencellScope.value
|
||||
);
|
||||
const greencellScopeData = computed(
|
||||
() => greencell.value?.scopes?.[greencellScopeKey.value] || { editableLayer: "user", fields: {} }
|
||||
);
|
||||
const greencellEditingOrg = computed(() => greencellScopeKey.value === "org");
|
||||
|
||||
function greencellField(k) {
|
||||
return greencellScopeData.value.fields?.[k] || { effective: "", own: "", source: "unset", locked: false };
|
||||
}
|
||||
function greencellLocked(k) {
|
||||
return greencellReadOnly.value || greencellField(k).locked;
|
||||
}
|
||||
const greencellEnabled = computed(() =>
|
||||
greencellEditingOrg.value ? greencell.value?.orgEnabled : greencell.value?.enabled
|
||||
);
|
||||
function greencellSourceLabel(k) {
|
||||
const map = { global: "sourceGlobal", org: "sourceOrg", user: "sourceUser" };
|
||||
const key = map[greencellField(k).source] || "sourceGlobal";
|
||||
return t("settings.integrations.inheritedFrom", { source: t("settings.integrations." + key) });
|
||||
}
|
||||
|
||||
function fillGreencellForm() {
|
||||
const f = greencellScopeData.value.fields || {};
|
||||
const value = (k, fallback = "") => {
|
||||
const fv = f[k] || {};
|
||||
// A locked field the server masked has nothing useful to show; a locked
|
||||
// plain setting shows what is actually in force.
|
||||
if (fv.locked) return GREENCELL_MASKED.includes(k) ? "" : fv.effective || fallback;
|
||||
return fv.own || fallback;
|
||||
};
|
||||
greencellForm.value = {
|
||||
host: value("host"),
|
||||
port: value("port"),
|
||||
tls: value("tls", "off"),
|
||||
username: value("username"),
|
||||
password: "",
|
||||
serial: value("serial"),
|
||||
commandTopic: value("commandTopic"),
|
||||
timeout: value("timeout"),
|
||||
};
|
||||
}
|
||||
|
||||
function applyGreencellView(body) {
|
||||
greencell.value = body;
|
||||
if (greencellScope.value === "org" && !body.canEditOrg) greencellScope.value = "user";
|
||||
fillGreencellForm();
|
||||
}
|
||||
|
||||
async function loadGreencell() {
|
||||
try {
|
||||
applyGreencellView(await api.getGreencell());
|
||||
} catch (e) {
|
||||
greencellError.value = e.message;
|
||||
}
|
||||
}
|
||||
|
||||
watch(greencellScope, () => {
|
||||
greencellError.value = "";
|
||||
greencellSaved.value = false;
|
||||
greencellHealth.value = null;
|
||||
fillGreencellForm();
|
||||
});
|
||||
|
||||
async function toggleGreencell(v) {
|
||||
greencellError.value = "";
|
||||
const scope = greencellEditingOrg.value ? "org" : "user";
|
||||
try {
|
||||
applyGreencellView(await api.saveGreencell({ scope, enabled: v }));
|
||||
} catch (e) {
|
||||
greencellError.value = e.message;
|
||||
}
|
||||
}
|
||||
|
||||
async function saveGreencellSettings() {
|
||||
greencellError.value = "";
|
||||
greencellSaving.value = true;
|
||||
greencellSaved.value = false;
|
||||
const config = {};
|
||||
for (const k of GREENCELL_FIELDS) {
|
||||
if (greencellLocked(k)) continue;
|
||||
if (k === "password" && !greencellForm.value.password) continue;
|
||||
config[k] = greencellForm.value[k];
|
||||
}
|
||||
try {
|
||||
applyGreencellView(await api.saveGreencell({ scope: greencellScopeKey.value, config }));
|
||||
greencellSaved.value = true;
|
||||
setTimeout(() => (greencellSaved.value = false), 2000);
|
||||
} catch (e) {
|
||||
greencellError.value = e.message;
|
||||
} finally {
|
||||
greencellSaving.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
async function testGreencellConnection() {
|
||||
greencellError.value = "";
|
||||
greencellHealth.value = null;
|
||||
greencellTesting.value = true;
|
||||
try {
|
||||
const { health } = await api.testGreencell();
|
||||
greencellHealth.value = health;
|
||||
} catch (e) {
|
||||
greencellError.value = e.message;
|
||||
} finally {
|
||||
greencellTesting.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
function onLogout() {
|
||||
logout();
|
||||
router.replace({ name: "login" });
|
||||
@@ -729,6 +866,7 @@ onMounted(async () => {
|
||||
await loadAvatar();
|
||||
await loadToyota();
|
||||
await loadAnkerSolix();
|
||||
await loadGreencell();
|
||||
});
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
@@ -1018,7 +1156,7 @@ onBeforeUnmount(() => {
|
||||
|
||||
<!-- Integrations -->
|
||||
<div v-show="activeTab === 'integrations'" class="space-y-6">
|
||||
<section v-if="toyota || anker" class="dh-card p-6">
|
||||
<section v-if="toyota || anker || greencell" class="dh-card p-6">
|
||||
<h2 class="text-lg font-bold tracking-[-0.02em] text-strong">{{ t("settings.integrations.title") }}</h2>
|
||||
<p class="mb-4 mt-1 text-sm text-muted">{{ t("settings.integrations.subtitle") }}</p>
|
||||
|
||||
@@ -1348,6 +1486,212 @@ onBeforeUnmount(() => {
|
||||
<p v-if="ankerError" class="mt-2 text-sm text-danger">{{ ankerError }}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Greencell (HabuDen EV charger, read over your own MQTT broker) -->
|
||||
<div v-if="greencell" class="mt-4 rounded-control border border-subtle p-4">
|
||||
<button
|
||||
type="button"
|
||||
class="flex w-full items-start justify-between gap-3 text-left"
|
||||
:aria-expanded="greencellOpen"
|
||||
@click="greencellOpen = !greencellOpen"
|
||||
>
|
||||
<div>
|
||||
<p class="text-sm font-semibold text-strong">{{ t("settings.integrations.greencell") }}</p>
|
||||
<p class="mt-0.5 text-xs text-muted">{{ t("settings.integrations.greencellDesc") }}</p>
|
||||
</div>
|
||||
<div class="flex shrink-0 items-center gap-2">
|
||||
<span
|
||||
v-if="!greencellEditingOrg"
|
||||
class="dh-badge"
|
||||
:class="greencell.enabled ? 'dh-badge-success' : 'dh-badge-warning'"
|
||||
>
|
||||
{{ greencell.enabled ? t("settings.integrations.connected") : t("settings.integrations.notConnected") }}
|
||||
</span>
|
||||
<svg
|
||||
viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
|
||||
class="h-4 w-4 text-muted transition-transform" :class="greencellOpen ? 'rotate-180' : ''"
|
||||
><path stroke-linecap="round" stroke-linejoin="round" d="m6 9 6 6 6-6" /></svg>
|
||||
</div>
|
||||
</button>
|
||||
|
||||
<div v-show="greencellOpen">
|
||||
<!-- Master / org gates -->
|
||||
<p v-if="!greencell.available" class="mt-3 text-sm text-warning">{{ t("settings.integrations.unavailable") }}</p>
|
||||
<p
|
||||
v-else-if="greencell.orgId && !greencell.orgEnabled && !greencellEditingOrg"
|
||||
class="mt-3 text-sm text-warning"
|
||||
>
|
||||
{{ t("settings.integrations.orgDisabled") }}
|
||||
</p>
|
||||
|
||||
<template v-else>
|
||||
<!-- Scope switch (org admins) -->
|
||||
<div v-if="greencell.canEditOrg" class="mt-4 flex gap-2">
|
||||
<button
|
||||
v-for="sc in ['user', 'org']"
|
||||
:key="sc"
|
||||
class="rounded-control border px-3 py-1.5 text-sm font-medium transition-colors"
|
||||
:class="greencellScope === sc
|
||||
? 'border-accent bg-accent text-white'
|
||||
: 'border-subtle text-body hover:bg-sunken hover:text-strong'"
|
||||
@click="greencellScope = sc"
|
||||
>
|
||||
{{ sc === 'org' ? t("settings.integrations.scopeOrg") : t("settings.integrations.scopeMy") }}
|
||||
</button>
|
||||
</div>
|
||||
<p v-if="greencellEditingOrg" class="mt-2 text-xs text-muted">{{ t("settings.integrations.scopeHint") }}</p>
|
||||
<p v-if="greencellReadOnly" class="mt-3 text-xs text-muted">{{ t("settings.integrations.readOnly") }}</p>
|
||||
|
||||
<!-- Enable toggle -->
|
||||
<label class="mt-4 flex items-center gap-2 text-sm font-medium text-body">
|
||||
<input
|
||||
type="checkbox"
|
||||
class="h-4 w-4 rounded border-subtle text-accent focus:ring-accent"
|
||||
:checked="greencellEnabled"
|
||||
@change="toggleGreencell($event.target.checked)"
|
||||
/>
|
||||
<span>{{ greencellEditingOrg ? t("settings.integrations.enableOrg") : t("settings.integrations.enable") }}</span>
|
||||
</label>
|
||||
|
||||
<!-- Broker: host, port, TLS and credentials resolve together -->
|
||||
<p class="mt-5 text-xs font-semibold uppercase tracking-wide text-muted">
|
||||
{{ t("settings.integrations.greencellBroker") }}
|
||||
</p>
|
||||
<div class="mt-2 grid max-w-sm gap-3">
|
||||
<div>
|
||||
<label class="dh-label">{{ t("settings.integrations.greencellHost") }}</label>
|
||||
<input
|
||||
v-model="greencellForm.host"
|
||||
class="dh-input"
|
||||
:disabled="greencellLocked('host')"
|
||||
:placeholder="greencellLocked('host') ? '••••••••' : '10.2.1.10'"
|
||||
autocomplete="off"
|
||||
/>
|
||||
<p v-if="greencellField('host').locked" class="mt-1 text-xs text-muted">{{ greencellSourceLabel('host') }}</p>
|
||||
<p v-else class="mt-1 text-xs text-muted">{{ t("settings.integrations.greencellHostHint") }}</p>
|
||||
</div>
|
||||
<div>
|
||||
<label class="dh-label">{{ t("settings.integrations.greencellPort") }}</label>
|
||||
<input
|
||||
v-model="greencellForm.port"
|
||||
class="dh-input"
|
||||
:disabled="greencellLocked('port')"
|
||||
placeholder="1883"
|
||||
inputmode="numeric"
|
||||
autocomplete="off"
|
||||
/>
|
||||
<p v-if="greencellField('port').locked" class="mt-1 text-xs text-muted">{{ greencellSourceLabel('port') }}</p>
|
||||
<p v-else class="mt-1 text-xs text-muted">{{ t("settings.integrations.greencellPortHint") }}</p>
|
||||
</div>
|
||||
<div>
|
||||
<label class="dh-label">{{ t("settings.integrations.greencellTls") }}</label>
|
||||
<select v-model="greencellForm.tls" class="dh-input" :disabled="greencellLocked('tls')">
|
||||
<option value="off">{{ t("settings.integrations.greencellTlsOff") }}</option>
|
||||
<option value="on">{{ t("settings.integrations.greencellTlsOn") }}</option>
|
||||
</select>
|
||||
<p v-if="greencellField('tls').locked" class="mt-1 text-xs text-muted">{{ greencellSourceLabel('tls') }}</p>
|
||||
</div>
|
||||
<div>
|
||||
<label class="dh-label">{{ t("settings.integrations.greencellUsername") }}</label>
|
||||
<input
|
||||
v-model="greencellForm.username"
|
||||
class="dh-input"
|
||||
:disabled="greencellLocked('username')"
|
||||
:placeholder="greencellLocked('username') ? '••••••••' : ''"
|
||||
autocomplete="off"
|
||||
/>
|
||||
<p v-if="greencellField('username').locked" class="mt-1 text-xs text-muted">{{ greencellSourceLabel('username') }}</p>
|
||||
<p v-else class="mt-1 text-xs text-muted">{{ t("settings.integrations.greencellUsernameHint") }}</p>
|
||||
</div>
|
||||
<div>
|
||||
<label class="dh-label">{{ t("settings.integrations.greencellPassword") }}</label>
|
||||
<input
|
||||
v-model="greencellForm.password"
|
||||
type="password"
|
||||
class="dh-input"
|
||||
:disabled="greencellLocked('password')"
|
||||
:placeholder="greencellField('password').effective ? '••••••••' : ''"
|
||||
autocomplete="new-password"
|
||||
/>
|
||||
<p v-if="greencellField('password').locked" class="mt-1 text-xs text-muted">{{ greencellSourceLabel('password') }}</p>
|
||||
<p v-else class="mt-1 text-xs text-muted">{{ t("settings.integrations.passwordKeep") }}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Charger: resolves independently of the broker -->
|
||||
<p class="mt-5 text-xs font-semibold uppercase tracking-wide text-muted">
|
||||
{{ t("settings.integrations.greencellCharger") }}
|
||||
</p>
|
||||
<div class="mt-2 grid max-w-sm gap-3">
|
||||
<div>
|
||||
<label class="dh-label">{{ t("settings.integrations.greencellSerial") }}</label>
|
||||
<input
|
||||
v-model="greencellForm.serial"
|
||||
class="dh-input"
|
||||
:disabled="greencellLocked('serial')"
|
||||
placeholder="EVGC021B22752405ZM0018"
|
||||
autocomplete="off"
|
||||
/>
|
||||
<p v-if="greencellField('serial').locked" class="mt-1 text-xs text-muted">{{ greencellSourceLabel('serial') }}</p>
|
||||
<p v-else class="mt-1 text-xs text-muted">{{ t("settings.integrations.greencellSerialHint") }}</p>
|
||||
</div>
|
||||
<div>
|
||||
<label class="dh-label">{{ t("settings.integrations.greencellTimeout") }}</label>
|
||||
<input
|
||||
v-model="greencellForm.timeout"
|
||||
class="dh-input"
|
||||
:disabled="greencellLocked('timeout')"
|
||||
placeholder="12"
|
||||
inputmode="numeric"
|
||||
autocomplete="off"
|
||||
/>
|
||||
<p v-if="greencellField('timeout').locked" class="mt-1 text-xs text-muted">{{ greencellSourceLabel('timeout') }}</p>
|
||||
<p v-else class="mt-1 text-xs text-muted">{{ t("settings.integrations.greencellTimeoutHint") }}</p>
|
||||
</div>
|
||||
<div>
|
||||
<label class="dh-label">{{ t("settings.integrations.greencellCommandTopic") }}</label>
|
||||
<input
|
||||
v-model="greencellForm.commandTopic"
|
||||
class="dh-input"
|
||||
:disabled="greencellLocked('commandTopic')"
|
||||
placeholder="/greencell/evse/{sn}/command"
|
||||
autocomplete="off"
|
||||
/>
|
||||
<p v-if="greencellField('commandTopic').locked" class="mt-1 text-xs text-muted">{{ greencellSourceLabel('commandTopic') }}</p>
|
||||
<p v-else class="mt-1 text-xs text-muted">{{ t("settings.integrations.greencellCommandTopicHint") }}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mt-4 flex items-center gap-2">
|
||||
<button
|
||||
v-if="!greencellReadOnly"
|
||||
class="dh-btn dh-btn-primary"
|
||||
:disabled="greencellSaving"
|
||||
@click="saveGreencellSettings"
|
||||
>
|
||||
{{ greencellSaving ? t("common.saving") : greencellSaved ? t("settings.integrations.saved") : t("settings.integrations.save") }}
|
||||
</button>
|
||||
<button class="dh-btn dh-btn-ghost" :disabled="greencellTesting" @click="testGreencellConnection">
|
||||
{{ greencellTesting ? t("settings.integrations.testing") : t("settings.integrations.test") }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- A reachable broker with no charger on it is "degraded", not down:
|
||||
the half we configure works and the missing half is the device. -->
|
||||
<p
|
||||
v-if="greencellHealth"
|
||||
class="mt-2 text-sm"
|
||||
:class="greencellHealth.status === 'ok'
|
||||
? 'text-success'
|
||||
: greencellHealth.status === 'degraded' ? 'text-warning' : 'text-danger'"
|
||||
>
|
||||
{{ greencellHealth.detail || greencellHealth.status }}
|
||||
</p>
|
||||
</template>
|
||||
|
||||
<p v-if="greencellError" class="mt-2 text-sm text-danger">{{ greencellError }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in new issue
Block a user