From 3bf4684e1d1e99550e93d0a52b3ae07b49075295 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 4 Jan 2026 22:44:07 +0000 Subject: [PATCH 1/2] Update session entities to only publish during charging Session power, Session duration, and Session cost entities are now only updated when the device is actively charging (status='2'). When the device is not charging, updates to these entities are silently skipped. --- packages/eviqo-mqtt/src/gateway.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/packages/eviqo-mqtt/src/gateway.ts b/packages/eviqo-mqtt/src/gateway.ts index 7604712..855158c 100644 --- a/packages/eviqo-mqtt/src/gateway.ts +++ b/packages/eviqo-mqtt/src/gateway.ts @@ -24,6 +24,11 @@ import { getTopicId, } from './ha-discovery'; +/** + * Session entity names - these are only updated during charging + */ +const SESSION_ENTITIES = new Set(['Session duration', 'Session power', 'Session cost']); + /** * Value transformers for specific widgets * Maps widget name to a function that transforms the raw value @@ -404,6 +409,15 @@ export class EviqoMqttGateway extends EventEmitter { // Only publish widgets that have a mapping defined if (!isInWidgetMappings && !controlSettings) return; + // Session entities are only updated during charging + if (SESSION_ENTITIES.has(widgetName)) { + const currentStatus = this.deviceStatus.get(String(deviceId)); + if (currentStatus !== '2') { + logger.debug(`Skipping ${widgetName} update for device ${deviceId}: not charging (status=${currentStatus})`); + return; + } + } + // Apply value transformer if one exists for this widget const transformer = VALUE_TRANSFORMERS[widgetName]; const publishValue = transformer ? transformer(rawValue) : rawValue; From 7044c44df382ba8eea09566dc93dc88699584fd8 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 4 Jan 2026 22:44:52 +0000 Subject: [PATCH 2/2] Update package-lock.json versions --- package-lock.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 11f7ec1..89751bd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "eviqo-monorepo", - "version": "1.0.0", + "version": "1.0.4", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "eviqo-monorepo", - "version": "1.0.0", + "version": "1.0.4", "license": "MIT", "workspaces": [ "packages/*" @@ -6396,7 +6396,7 @@ } }, "packages/eviqo-client-api": { - "version": "1.0.0", + "version": "1.0.4", "license": "MIT", "dependencies": { "dotenv": "^16.3.0", @@ -6422,7 +6422,7 @@ } }, "packages/eviqo-mqtt": { - "version": "1.0.0", + "version": "1.0.4", "license": "MIT", "dependencies": { "dotenv": "^16.3.0",