Patrick Schurig 9e0cd44af0 sunspec: add a device suite for the two connection behaviour
The two most certain defects of the multi unit ID work are invisible to
the offline suites, because they only appear once a discovery has
actually run: the orphan sweep deleting the children of the other
connection, and the aggregation of the connected state.

This suite mounts the plugin behind a real ThingManager against a real
device. It is deliberately not a testcase, so "make check" never runs
it, but it is still built so it cannot rot unnoticed. Without
SUNSPEC_TEST_HOST every test skips, and no address is written into the
repository: the address of a real installation is customer data.

NOT YET RUN against hardware. It needs the address of a GEN24 and, given
the polling rate guidance, a deliberate decision to point it at a
customer inverter.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-02 09:07:06 +02:00

76 lines
2.6 KiB
Prolog

include(../../../sunspec.pri)
QT += testlib network serialbus
QT -= gui
TEMPLATE = app
TARGET = tst_sunspecdevice
# Suite d'integration F3 : le plugin, monte derriere un vrai ThingManager, face
# a un vrai appareil.
#
# VOLONTAIREMENT PAS "testcase" : "make check" ne la lance jamais. Elle est
# quand meme construite, pour qu'elle ne pourrisse pas en silence.
#
# Elle exige un appareil joignable, passe par variable d'environnement :
#
# SUNSPEC_TEST_HOST=<adresse> [SUNSPEC_TEST_PORT=502]
# [SUNSPEC_TEST_METER_SLAVE_ID=200] [SUNSPEC_TEST_SLAVE_ID=1]
# ./tst_sunspecdevice
#
# Sans SUNSPEC_TEST_HOST, chaque test se met en QSKIP. Aucune adresse par
# defaut n'est ecrite ici : l'adresse d'une installation reelle est une donnee
# client et n'a rien a faire dans un depot a miroir public (voir AGENTS.md).
#
# ATTENTION avant de la lancer sur un onduleur client : le constructeur
# recommande de rester au-dessus de 7 s d'intervalle d'interrogation, faute de
# quoi l'onduleur peut passer hors ligne vis-a-vis de son portail, avec
# retablissement par coupure AC+DC sur site. Cette suite ne fait qu'un cycle de
# decouverte et n'interroge pas en boucle, mais elle ouvre bien deux connexions.
CONFIG += console c++17
CONFIG -= app_bundle
CONFIG += link_pkgconfig
PKGCONFIG += nymea nymea-core
PLUGIN_DIR = $$PWD/../..
INCLUDEPATH += $$PLUGIN_DIR
DEFINES += SUNSPEC_PLUGIN_TEST_ACCESS
JSONFILE = $$PLUGIN_DIR/integrationpluginsunspec.json
OTHER_FILES += $$JSONFILE
plugininfo.input = JSONFILE
plugininfo.output = plugininfo.h
plugininfo.commands = nymea-plugininfocompiler ${QMAKE_FILE_NAME} --output ${QMAKE_FILE_OUT}
plugininfo.dependency_type = TYPE_C
plugininfo.CONFIG += no_link combine
QMAKE_EXTRA_COMPILERS += plugininfo
extern_plugininfo.input = JSONFILE
extern_plugininfo.output = extern-plugininfo.h
extern_plugininfo.commands = nymea-plugininfocompiler ${QMAKE_FILE_NAME} --extern ${QMAKE_FILE_OUT}
extern_plugininfo.dependency_type = TYPE_C
extern_plugininfo.CONFIG += no_link combine
QMAKE_EXTRA_COMPILERS += extern_plugininfo
DEFINES += PLUGIN_JSON_PATH=\\\"$$JSONFILE\\\"
SOURCES += \
tst_sunspecdevice.cpp \
$$PLUGIN_DIR/integrationpluginsunspec.cpp \
$$PLUGIN_DIR/froniusrules.cpp \
$$PLUGIN_DIR/solaredgebattery.cpp \
$$PLUGIN_DIR/sunspecdiscovery.cpp \
$$PLUGIN_DIR/sunspecstoragelogic.cpp \
$$PLUGIN_DIR/sunspecthing.cpp
HEADERS += \
$$PLUGIN_DIR/integrationpluginsunspec.h \
$$PLUGIN_DIR/froniusrules.h \
$$PLUGIN_DIR/solaredgebattery.h \
$$PLUGIN_DIR/sunspecdiscovery.h \
$$PLUGIN_DIR/sunspecstoragelogic.h \
$$PLUGIN_DIR/sunspecthing.h