etm-powersync-plugins-modbus/v2c/integrationpluginv2c.json
Patrick Schurig 076a0dcae9 feat(v2c): remove NetworkDeviceMonitor, add poll-based connectivity + statusMessage
The Trydan ESP32 WiFi stack saturates under nymea's periodic ICMP pings
(observed: latency > 14 s, Modbus timeouts, charger drops off).

Changes:
- NetworkDeviceMonitor removed entirely from setupThing() and thingRemoved().
  The charger is expected to have a DHCP-reserved IP (documented in code).
  Address comes from trydanThingAddressParamTypeId param — already the correct
  path after the previous setup fix.
- Connectivity now derives from Modbus poll success/failure only (reachable()
  from TrydanModbusTcpMaster), NOT from network ping.  A ping response does
  not imply Modbus usability on this hardware.
- postSetupThing() timer (30 s): if not reachable, calls connectDevice() for
  reconnect; if reachable, calls update().  The 30 s period IS the backoff —
  no aggressive retry loop.
- Modbus timeout: 2 s → 5 s (tolerates residual WiFi latency spikes).
- Modbus retries per read: 1 → 0 (abort fast on first timeout; full poll
  sequence already aborts at first error via doNextRead).
- k_errorLimit: 5 → 3 (3 × 5 s = 15 s before marking unreachable).
- New state "statusMessage" (QString): set on disconnect with timestamp +
  cause ("timeout Modbus — vérifier signal WiFi de la borne"); cleared on
  successful poll.  Visible in nymea-app; helps SAV without SSH access.
- "networkdevice" removed from JSON interfaces (contract broken without monitor).

Invariants preserved: Big/Big float32 decode, no block read, PauseState+Lock
mirror, PauseDynamic conflict management, writeCompleted address filtering.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-12 18:15:30 +02:00

195 lines
8.5 KiB
JSON

{
"name": "V2C",
"displayName": "V2C Trydan",
"id": "f0692725-650a-47c3-a673-172f077768f1",
"paramTypes": [],
"vendors": [
{
"id": "56c3e7bb-2db8-4002-b799-9e21530e6fb9",
"name": "v2c",
"displayName": "V2C",
"thingClasses": [
{
"id": "b2a12873-4d11-444e-a4ad-914907491eb4",
"name": "trydan",
"displayName": "Trydan",
"interfaces": [
"evcharger",
"connectable"
],
"createMethods": [
"discovery",
"user"
],
"discoveryType": "weak",
"paramTypes": [
{
"id": "2fe17a54-b24b-4868-ae99-36a4627e6827",
"name": "macAddress",
"displayName": "MAC address",
"type": "QString",
"inputType": "MacAddress",
"defaultValue": "",
"readOnly": true
},
{
"id": "c0cdfa64-7054-4486-809e-3b7f257a3aab",
"name": "address",
"displayName": "Host address",
"type": "QString",
"inputType": "IPv4Address",
"defaultValue": ""
},
{
"id": "bd9987a4-4c45-49c8-ab67-8c80705ec109",
"name": "hostName",
"displayName": "Host name",
"type": "QString",
"inputType": "TextLine",
"defaultValue": ""
},
{
"id": "d096bfe1-5861-456f-915c-f1f2c65b03b3",
"name": "port",
"displayName": "Modbus TCP port",
"type": "uint",
"defaultValue": 502
}
],
"settingsTypes": [
{
"id": "a47f20bd-dfdc-4827-ab7d-05d7819f316e",
"name": "suspendInternalOptimizer",
"displayName": "Suspend internal V2C optimizer when HEMS takes control",
"type": "bool",
"defaultValue": true
}
],
"stateTypes": [
{
"id": "47054399-82fb-4e12-9bb6-9ae3e4fd4f78",
"name": "connected",
"displayName": "Connected",
"type": "bool",
"defaultValue": false,
"cached": false
},
{
"id": "f38c313c-47cc-4791-8a8f-64c1af852af6",
"name": "pluggedIn",
"displayName": "Plugged in",
"type": "bool",
"defaultValue": false,
"cached": false
},
{
"id": "6d003e09-d30d-4a1c-9e2d-9e838b61dc5d",
"name": "charging",
"displayName": "Charging",
"type": "bool",
"defaultValue": false,
"cached": false
},
{
"id": "eb3253a2-7518-4e76-9c06-1bb133d5037d",
"name": "power",
"displayName": "Charging enabled",
"displayNameAction": "Set charging enabled",
"type": "bool",
"defaultValue": true,
"writable": true
},
{
"id": "deb8826d-4f91-42b8-89cf-16feb6425e0e",
"name": "maxChargingCurrent",
"displayName": "Maximum charging current",
"displayNameAction": "Set maximum charging current",
"type": "double",
"unit": "Ampere",
"minValue": 6,
"maxValue": 32,
"stepSize": 1,
"defaultValue": 16,
"writable": true
},
{
"id": "2570c0d7-f9a5-4e24-9242-6d79253004ec",
"name": "currentPower",
"displayName": "Charging power",
"type": "double",
"unit": "Watt",
"defaultValue": 0,
"cached": false
},
{
"id": "d11a392f-387d-4f10-9050-e25198d2c584",
"name": "housePower",
"displayName": "House power (CT clamp)",
"type": "double",
"unit": "Watt",
"defaultValue": 0,
"cached": false
},
{
"id": "37e706fb-fa3c-484a-b776-b50aa5de5c61",
"name": "solarPower",
"displayName": "Solar power (PV seen by charger)",
"type": "double",
"unit": "Watt",
"defaultValue": 0,
"cached": false
},
{
"id": "9a9e6afb-a641-409f-9705-c16776db3a29",
"name": "slaveError",
"displayName": "Charger error code",
"type": "uint",
"defaultValue": 0
},
{
"id": "fe616e45-39cb-4be3-8426-9d27c7a64f06",
"name": "chargeEnergy",
"displayName": "Session energy (diagnostic)",
"type": "double",
"unit": "KiloWattHour",
"defaultValue": 0
},
{
"id": "71773194-ebd3-4ded-893c-14bfef9b1854",
"name": "intensity",
"displayName": "Current charging current",
"type": "double",
"unit": "Ampere",
"defaultValue": 0,
"cached": false
},
{
"id": "3c86495b-74da-440e-98a5-825678e35c1a",
"name": "conflictDetected",
"displayName": "Internal V2C optimizer active",
"type": "bool",
"defaultValue": false
},
{
"id": "006dd018-9c6a-4a4e-a7b2-eb965d27ca92",
"name": "optimizerSuspended",
"displayName": "Internal optimizer suspended by HEMS",
"type": "bool",
"defaultValue": false
},
{
"id": "c2d4e6f8-1a3b-4c7d-be0f-2a4b6c8d0e1f",
"name": "statusMessage",
"displayName": "Connection status",
"type": "QString",
"defaultValue": "",
"cached": false
}
],
"actionTypes": []
}
]
}
]
}