Étape 1 complete: V2C Trydan nymea plugin (Modbus TCP, status Partial).
Plugin (IntegrationPluginV2c):
- discoverThings: delegates to V2cTcpDiscovery, maps results to
ThingDescriptors; createMethod "user" bypasses discovery.
- setupThing: registers a NetworkDeviceMonitor (IP tracking on DHCP
renewal), creates TrydanModbusTcpMaster, wires reachableChanged →
initialize() → state update on initializationFinished(), then starts
periodic polls on a 30s PluginTimer.
- updateThingStates: ChargeState 0/1/2 → pluggedIn/charging;
power = (PauseState==0 AND Lock==0) per evcc trydan.go Enabled().
- handleDynamicConflict: if Dynamic==1 (V2C internal PV optimizer),
write PauseDynamic=1 to suppress it. NEVER write Dynamic=0 (silences
ChargePower telemetry). Writes only on state transition to minimize
flash wear. cf. github.com/evcc-io/evcc/issues/28047.
- Action "power": writes PauseState then Lock (always in mirror), then
fire-and-forgets PauseDynamic if Dynamic==1. Action handlers filter
writeCompleted by register address to avoid reacting to concurrent
background writes.
- Action "maxChargingCurrent": clamps to [minIntensity, maxIntensity],
writes Intensity. Below 6A → pause instead of invalid setpoint.
JSON (integrationpluginv2c.json):
- ThingClass "trydan" implementing evcharger + connectable + networkdevice.
- settingsTypes: suspendInternalOptimizer (bool, default true) — allows
the user to disable Dynamic conflict management if they want the V2C
PID to remain active alongside the HEMS.
- State "chargeEnergy" exposed as diagnostic only (NOT sessionEnergy) —
firmware reliability on this register is unvalidated; cf. evcc #28047.
Build (v2c.pro):
- MODBUS_CONNECTIONS intentionally empty: the modbus-tool code generator
assumes non-overlapping block reads; leaving it empty skips generation
while still linking nymea-modbus via the PKGCONFIG in modbus.pri.
VendorId 56c3e7bb… is new (no existing V2C vendor in the repo).
PluginId f0692725… is new (generated for this plugin).
PORTING_STATUS_modbus.md documents register sources, the 4 items that
require validation on real hardware, and the "no beta matrix" constraint.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
64 lines
1.9 KiB
Prolog
64 lines
1.9 KiB
Prolog
TEMPLATE = subdirs
|
|
|
|
# Note: In the loop at the end of this file the plugin
|
|
# dependency on the libs will be defined
|
|
|
|
PLUGIN_DIRS = \
|
|
eastron \
|
|
abbb2x \
|
|
abbterra \
|
|
v2c
|
|
|
|
|
|
message(============================================)
|
|
message("Qt version:" $$[QT_VERSION])
|
|
|
|
gcc {
|
|
COMPILER_VERSION = $$system($$QMAKE_CXX " -dumpversion")
|
|
COMPILER_MAJOR_VERSION = $$str_member($$COMPILER_VERSION)
|
|
greaterThan(COMPILER_MAJOR_VERSION, 7): QMAKE_CXXFLAGS += -Wno-deprecated-copy
|
|
}
|
|
|
|
plugininfo.depends = FORCE
|
|
for (entry, PLUGIN_DIRS):plugininfo.commands += test -d $${entry} || mkdir -p $${entry}; cd $${entry} && qmake -o Makefile $$PWD/$${entry}/$${entry}.pro && cd ..;
|
|
for (entry, PLUGIN_DIRS):plugininfo.commands += make -C $${entry} plugininfo.h;
|
|
QMAKE_EXTRA_TARGETS += plugininfo
|
|
|
|
# Translations:
|
|
# make lupdate to update .ts files
|
|
lupdate.depends = FORCE plugininfo
|
|
for (entry, PLUGIN_DIRS):lupdate.commands += make -C $${entry} lupdate;
|
|
QMAKE_EXTRA_TARGETS += lupdate
|
|
|
|
# make lrelease to build .qm from .ts
|
|
lrelease.depends = FORCE
|
|
for (entry, PLUGIN_DIRS):lrelease.commands += lrelease $$files($$PWD/$${entry}/translations/*.ts, true);
|
|
for (entry, PLUGIN_DIRS):lrelease.commands += rsync -a $$PWD/$${entry}/translations/*.qm $$OUT_PWD/translations/;
|
|
QMAKE_EXTRA_TARGETS += lrelease
|
|
|
|
# For Qt-Creator's code model: Add CPATH to INCLUDEPATH explicitly
|
|
INCLUDEPATH += $$(CPATH)
|
|
|
|
message("Usage: qmake [srcdir] [WITH_PLUGINS=\"...\"] [WITHOUT_PLUGINS=\"...\"]")
|
|
|
|
isEmpty(WITH_PLUGINS) {
|
|
PLUGINS = $${PLUGIN_DIRS}
|
|
} else {
|
|
PLUGINS = $${WITH_PLUGINS}
|
|
}
|
|
PLUGINS-=$${WITHOUT_PLUGINS}
|
|
|
|
message("Building plugins:")
|
|
for(plugin, PLUGINS) {
|
|
exists($${plugin}) {
|
|
SUBDIRS*= $${plugin}
|
|
message("- $${plugin}")
|
|
# Make sure the libs will be built before the plugins
|
|
equals(plugin, "sunspec") {
|
|
} else {
|
|
}
|
|
} else {
|
|
error("Invalid plugin \"$${plugin}\".")
|
|
}
|
|
}
|