Fix init after setup

master
Simon Stürz 2025-09-10 12:55:46 +02:00
parent 4b230b4ae8
commit 395a75766d
2 changed files with 8 additions and 10 deletions

View File

@ -50,9 +50,9 @@ void IntegrationPluginEverest::init()
QFileInfo enableMqttFileInfo(NymeaSettings::settingsPath() + "/everest-mqtt");
m_useMqtt = enableMqttFileInfo.exists();
if (m_useMqtt) {
qCDebug(dcEverest()) << "MQTT API module enabled, detected" << enableMqttFileInfo.absoluteFilePath();
qCDebug(dcEverest()) << "MQTT API module autodetection enabled, found enable file" << enableMqttFileInfo.absoluteFilePath();
} else {
qCDebug(dcEverest()) << "MQTT API module disabled, the file" << enableMqttFileInfo.absoluteFilePath() << "does not exist.";
qCDebug(dcEverest()) << "MQTT API module autodetection disabled, the enable file" << enableMqttFileInfo.absoluteFilePath() << "does not exist.";
}
}
@ -210,9 +210,6 @@ void IntegrationPluginEverest::discoverThings(ThingDiscoveryInfo *info)
mqttDiscovery->start();
return;
}
} else {
info->finish(Thing::ThingErrorUnsupportedFeature);
return;
}
if (info->thingClassId() == everestConnectionThingClassId) {

View File

@ -51,7 +51,7 @@ EverestEvse::EverestEvse(EverestJsonRpcClient *client, Thing *thing, QObject *pa
connect(m_client, &EverestJsonRpcClient::evseStatusChanged, this, [this](int evseIndex, const EverestJsonRpcClient::EVSEStatus &evseStatus){
// We are only insterested in our own status
if (m_index != evseIndex)
if (m_index != evseIndex || !m_initialized)
return;
m_evseStatus = evseStatus;
@ -60,7 +60,7 @@ EverestEvse::EverestEvse(EverestJsonRpcClient *client, Thing *thing, QObject *pa
connect(m_client, &EverestJsonRpcClient::hardwareCapabilitiesChanged, this, [this](int evseIndex, const EverestJsonRpcClient::HardwareCapabilities &hardwareCapabilities){
// We are only insterested in our own status
if (m_index != evseIndex)
if (m_index != evseIndex || !m_initialized)
return;
m_hardwareCapabilities = hardwareCapabilities;
@ -69,16 +69,17 @@ EverestEvse::EverestEvse(EverestJsonRpcClient *client, Thing *thing, QObject *pa
connect(m_client, &EverestJsonRpcClient::meterDataChanged, this, [this](int evseIndex, const EverestJsonRpcClient::MeterData &meterData){
// We are only insterested in our own status
if (m_index != evseIndex)
if (m_index != evseIndex || !m_initialized)
return;
m_meterData = meterData;
processMeterData();
});
if (m_client->available())
if (m_client->available()) {
qCDebug(dcEverest()) << "Evse: The connection is already available. Initializing the instance...";
initialize();
}
}
int EverestEvse::index() const