aqhome-apps: decreased verbosity.

This commit is contained in:
Martin Preuss
2025-03-10 00:02:26 +01:00
parent cf9408b594
commit 5011e7e123
12 changed files with 52 additions and 42 deletions

View File

@@ -159,7 +159,7 @@ void _runService(AQH_OBJECT *aqh, AQH_EVENT_LOOP *eventLoop)
}
if (_diffInSeconds(now, timeLastWrite)>WRITE_INTERVAL_IN_SECS) {
DBG_ERROR(NULL, "Write time");
DBG_INFO(NULL, "Write time");
_writeCurrentState(aqh);
timeLastWrite=now;
}

View File

@@ -129,7 +129,7 @@ int _storeDataPoints(AQHOME_SERVER *xo, const AQH_VALUE *v, const uint64_t *data
return AQH_MSGDATA_RESULT_ERROR_GENERIC;
}
else {
DBG_ERROR(NULL, "Datapoint added for value \"%s\"", AQH_Value_GetNameForSystem(v));
DBG_INFO(NULL, "Datapoint added for value \"%s\"", AQH_Value_GetNameForSystem(v));
}
} /* for */

View File

@@ -96,7 +96,8 @@ int main(int argc, char **argv)
}
GWEN_Logger_Open(0, "aqhome-mqttlog", 0, GWEN_LoggerType_Console, GWEN_LoggerFacility_User);
GWEN_Logger_SetLevel(0, GWEN_LoggerLevel_Warning);
//GWEN_Logger_SetLevel(0, GWEN_LoggerLevel_Warning);
GWEN_Logger_SetLevel(0, GWEN_LoggerLevel_Notice);
rv=_setSignalHandlers();
if (rv<0) {
@@ -163,7 +164,7 @@ void _runService(AQH_OBJECT *aqh, AQH_EVENT_LOOP *eventLoop)
now=time(NULL);
if (_diffInSeconds(now, timeLastConnCheck)>CONNCHECK_INTERVAL_IN_SECS) {
DBG_ERROR(NULL, "Check connections");
DBG_INFO(NULL, "Check connections");
AQH_MqttLogServer_CheckBrokerConnection(aqh);
AQH_MqttLogServer_CheckMqttConnection(aqh);
timeLastConnCheck=now;
@@ -178,7 +179,7 @@ void _runService(AQH_OBJECT *aqh, AQH_EVENT_LOOP *eventLoop)
}
if (_diffInSeconds(now, timeLastSave)>SAVE_INTERVAL_IN_SECS) {
DBG_ERROR(NULL, "Writing device files");
DBG_INFO(NULL, "Writing device files");
rv=AQH_MqttLogServer_SaveRuntimeDeviceFiles(aqh);
if (rv<0) {
DBG_INFO(NULL, "Error writing device file");

View File

@@ -460,7 +460,7 @@ int _startBroker(AQH_OBJECT *o, AQH_MQTTLOG_SERVER *xo)
DBG_ERROR(NULL, "Error connecting to broker server %s:%d", xo->brokerAddress, xo->brokerPort);
return GWEN_ERROR_IO;
}
DBG_ERROR(NULL, "Physically connected to broker server %s:%d", xo->brokerAddress, xo->brokerPort);
DBG_INFO(NULL, "Physically connected to broker server %s:%d", xo->brokerAddress, xo->brokerPort);
ep=AQH_IpcClientObject_new(AQH_Object_GetEventLoop(o), fd);
assert(ep);
@@ -474,7 +474,7 @@ int _startBroker(AQH_OBJECT *o, AQH_MQTTLOG_SERVER *xo)
DBG_ERROR(NULL, "Error connecting to broker: %d", rv);
return (rv<0)?rv:GWEN_ERROR_PERMISSIONS;
}
DBG_ERROR(NULL, "Connected to broker at %s:%d", xo->brokerAddress, xo->brokerPort);
DBG_NOTICE(NULL, "Connected to broker at %s:%d", xo->brokerAddress, xo->brokerPort);
return 0;
}
else {
@@ -523,7 +523,7 @@ int _startMqtt(AQH_OBJECT *o, AQH_MQTTLOG_SERVER *xo)
DBG_ERROR(NULL, "Error connecting to MQTT server %s:%d", xo->mqttAddress, xo->mqttPort);
return GWEN_ERROR_IO;
}
DBG_ERROR(NULL, "Physically connected to MQTT server %s:%d", xo->mqttAddress, xo->mqttPort);
DBG_INFO(NULL, "Physically connected to MQTT server %s:%d", xo->mqttAddress, xo->mqttPort);
ep=AQH_MqttClientObject_new(AQH_Object_GetEventLoop(o), fd);
assert(ep);
@@ -544,7 +544,7 @@ int _startMqtt(AQH_OBJECT *o, AQH_MQTTLOG_SERVER *xo)
return (rv<0)?rv:GWEN_ERROR_PERMISSIONS;
}
DBG_ERROR(NULL, "Connected to MQTT at %s:%d", xo->mqttAddress, xo->mqttPort);
DBG_NOTICE(NULL, "Connected to MQTT at %s:%d", xo->mqttAddress, xo->mqttPort);
return 0;
}
else {
@@ -612,7 +612,7 @@ int _exchangeMqttSubscribe(AQH_MQTTLOG_SERVER *xo)
}
}
else {
DBG_ERROR(NULL, "No CONNACK message received.");
DBG_ERROR(NULL, "No SUBACK message received.");
return GWEN_ERROR_GENERIC;
}
}
@@ -628,6 +628,15 @@ int _exchangeMqttSubscribe(AQH_MQTTLOG_SERVER *xo)
void AQH_MqttLogServer_Fini(AQH_OBJECT *o)
{
if (o) {
AQH_MQTTLOG_SERVER *xo;
xo=GWEN_INHERIT_GETDATA(AQH_OBJECT, AQH_MQTTLOG_SERVER, o);
if (xo) {
if (xo->pidFile)
remove(xo->pidFile);
}
}
}
@@ -669,7 +678,7 @@ void _handleMsgFromBroker(AQH_OBJECT *o, AQH_OBJECT *ep, const AQH_MESSAGE *msg)
code=AQH_IpcMessage_GetCode(msg);
protoId=AQH_IpcMessage_GetProtoId(msg);
if (protoId==AQH_IPC_PROTOCOL_DATA_ID) {
DBG_ERROR(NULL, "Received IPC packet %d (%x)", (int) code, code);
DBG_INFO(NULL, "Received IPC packet %d (%x)", (int) code, code);
switch(code) {
case AQH_MSGTYPE_IPC_DATA_SETDATA: AQH_MqttLogServer_HandleSetData(o, msg, tagList); break;
default: break;
@@ -693,7 +702,7 @@ void AQH_MqttLogServer_CheckBrokerConnection(AQH_OBJECT *o)
if (xo->brokerEndpoint) {
if (AQH_Object_GetFlags(xo->brokerEndpoint) & AQH_OBJECT_FLAGS_DELETE) {
DBG_ERROR(NULL, "Deleting broker connection");
DBG_INFO(NULL, "Deleting broker connection");
AQH_Object_Disable(xo->brokerEndpoint);
AQH_Object_free(xo->brokerEndpoint);
xo->brokerEndpoint=NULL;
@@ -707,7 +716,7 @@ void AQH_MqttLogServer_CheckBrokerConnection(AQH_OBJECT *o)
if (_diffInSeconds(now, xo->timestampBrokerDown)>AQH_MQTTLOG_SERVER_BROKER_RESTARTTIME) {
int rv;
DBG_ERROR(NULL, "Restarting broker connection");
DBG_INFO(NULL, "Restarting broker connection");
rv=_startBroker(o, xo);
if (rv<0) {
DBG_ERROR(NULL, "here (%d)", rv);
@@ -762,7 +771,7 @@ void _handleMsgFromMqtt(AQH_OBJECT *o, AQH_OBJECT *ep, const AQH_MESSAGE *msg)
void _handleMqttMsgPingRsp(AQH_OBJECT *o, AQH_OBJECT *ep, const AQH_MESSAGE *msg)
{
DBG_ERROR(NULL, "PING response received");
DBG_INFO(NULL, "PING response received");
}
@@ -775,7 +784,7 @@ void AQH_MqttLogServer_CheckMqttConnection(AQH_OBJECT *o)
if (xo) {
if (xo->mqttEndpoint) {
if (AQH_Object_GetFlags(xo->mqttEndpoint) & AQH_OBJECT_FLAGS_DELETE) {
DBG_ERROR(NULL, "Deleting mqtt connection");
DBG_INFO(NULL, "Deleting mqtt connection");
AQH_Object_Disable(xo->mqttEndpoint);
AQH_Object_free(xo->mqttEndpoint);
xo->mqttEndpoint=NULL;
@@ -789,7 +798,7 @@ void AQH_MqttLogServer_CheckMqttConnection(AQH_OBJECT *o)
if (_diffInSeconds(now, xo->timestampMqttDown)>AQH_MQTTLOG_SERVER_MQTT_RESTARTTIME) {
int rv;
DBG_ERROR(NULL, "Restarting MQTT connection");
DBG_INFO(NULL, "Restarting MQTT connection");
rv=_startMqtt(o, xo);
if (rv<0) {
DBG_ERROR(NULL, "here (%d)", rv);
@@ -809,7 +818,7 @@ int AQH_MqttLogServer_SendPing(AQH_OBJECT *o)
if (xo) {
AQH_MESSAGE *msgOut;
DBG_ERROR(NULL, "Sending PING");
DBG_INFO(NULL, "Sending PING");
msgOut=AQH_MqttMessage_new(AQH_MQTTMSG_MSGTYPE_PINGREQ, 0, NULL);
AQH_Endpoint_AddMsgOut(xo->mqttEndpoint, msgOut);
return 0;
@@ -932,7 +941,7 @@ void AQH_MqttLogServer_ReloadDeviceFiles(AQH_OBJECT *o)
if (xo) {
AQHMQTT_DEVICE_LIST *deviceList;
DBG_ERROR(NULL, "Loading devices description files");
DBG_INFO(NULL, "Loading devices description files");
deviceList=AQH_MqttLogServer_ReadDataDeviceFiles(o);
if (deviceList)
AQH_MqttLogServer_SetAvailableDeviceList(o, deviceList);
@@ -951,7 +960,7 @@ void AQH_MqttLogServer_LoadRuntimeDeviceFiles(AQH_OBJECT *o)
if (xo) {
AQHMQTT_DEVICE_LIST *deviceList;
DBG_ERROR(NULL, "Loading registered devices from file \"%s\"", xo->deviceFile);
DBG_INFO(NULL, "Loading registered devices from file \"%s\"", xo->deviceFile);
deviceList=AQH_MqttLogServer_ReadDeviceFile(o, xo->deviceFile);
if (deviceList)
AQH_MqttLogServer_SetRegisteredDeviceList(o, deviceList);
@@ -1012,7 +1021,7 @@ int _handleSignal(AQH_OBJECT *o, uint32_t slotId, AQH_OBJECT *senderObject, GWEN
int _handleBrokerDown(AQH_MQTTLOG_SERVER *xo)
{
if (xo->brokerEndpoint) {
DBG_ERROR(NULL, "Broker connection down");
DBG_WARN(NULL, "Broker connection down");
AQH_Object_AddFlags(xo->brokerEndpoint, AQH_OBJECT_FLAGS_DELETE);
xo->timestampBrokerDown=time(NULL);
}
@@ -1024,7 +1033,7 @@ int _handleBrokerDown(AQH_MQTTLOG_SERVER *xo)
int _handleMqttDown(AQH_MQTTLOG_SERVER *xo)
{
if (xo->mqttEndpoint) {
DBG_ERROR(NULL, "MQTT connection down");
DBG_WARN(NULL, "MQTT connection down");
AQH_Object_AddFlags(xo->mqttEndpoint, AQH_OBJECT_FLAGS_DELETE);
xo->timestampMqttDown=time(NULL);
}

View File

@@ -108,8 +108,8 @@ int main(int argc, char **argv)
}
GWEN_Logger_Open(0, "aqhome-react", 0, GWEN_LoggerType_Console, GWEN_LoggerFacility_User);
//GWEN_Logger_SetLevel(0, GWEN_LoggerLevel_Warning);
GWEN_Logger_SetLevel(0, GWEN_LoggerLevel_Info);
GWEN_Logger_SetLevel(0, GWEN_LoggerLevel_Warning);
//GWEN_Logger_SetLevel(0, GWEN_LoggerLevel_Info);
rv=_setSignalHandlers();
if (rv<0) {
@@ -138,7 +138,7 @@ int main(int argc, char **argv)
_runService(aqh, eventLoop);
//AQH_NodeServer_Fini(aqh);
AQH_ReactServer_Fini(aqh);
AQH_Object_free(aqh);
GWEN_Gui_SetGui(NULL);
@@ -175,7 +175,7 @@ void _runService(AQH_OBJECT *aqh, AQH_EVENT_LOOP *eventLoop)
now=time(NULL);
if (_diffInSeconds(now, timeLastConnCheck)>CONNCHECK_INTERVAL_IN_SECS) {
DBG_ERROR(NULL, "Check connections");
DBG_INFO(NULL, "Check connections");
AQH_ReactServer_CheckBrokerConnection(aqh);
timeLastConnCheck=now;
}

View File

@@ -482,7 +482,7 @@ int _startBroker(AQH_OBJECT *o, AQH_REACT_SERVER *xo)
DBG_ERROR(NULL, "Error connecting to broker server %s:%d", xo->brokerAddress, xo->brokerPort);
return GWEN_ERROR_IO;
}
DBG_ERROR(NULL, "Physically connected to broker server %s:%d", xo->brokerAddress, xo->brokerPort);
DBG_INFO(NULL, "Physically connected to broker server %s:%d", xo->brokerAddress, xo->brokerPort);
ep=AQH_IpcClientObject_new(AQH_Object_GetEventLoop(o), fd);
assert(ep);
@@ -496,7 +496,7 @@ int _startBroker(AQH_OBJECT *o, AQH_REACT_SERVER *xo)
DBG_ERROR(NULL, "Error connecting to broker: %d", rv);
return (rv<0)?rv:GWEN_ERROR_PERMISSIONS;
}
DBG_ERROR(NULL, "Connected to broker at %s:%d", xo->brokerAddress, xo->brokerPort);
DBG_INFO(NULL, "Connected to broker at %s:%d", xo->brokerAddress, xo->brokerPort);
return 0;
}
else {
@@ -596,7 +596,7 @@ void _handleMsgFromBroker(AQH_REACT_SERVER *xo, const AQH_MESSAGE *msg)
tagList=AQH_IpcMessageTag16_ParsePayload(msg, 0);
if (tagList) {
DBG_ERROR(NULL, "Received IPC packet %d (%x)", (int) code, code);
DBG_INFO(NULL, "Received IPC packet %d (%x)", (int) code, code);
switch(code) {
case AQH_MSGTYPE_IPC_DATA_DATACHANGED: _handleBrokerChangeData(xo->serverVarChangeUnit, tagList); break;
default: break;
@@ -620,9 +620,9 @@ void _handleBrokerChangeData(AQHREACT_UNIT *varChangeUnit, const GWEN_TAG16_LIST
value=AQH_IpcdMessageMultiData_ReadValue(tagList);
if (value) {
AQH_IpcdMessageMultiData_ReadDatapoints(tagList, &dataPoints, &numberOfPoints);
DBG_ERROR(NULL, "Value changed on server: %s (%d data points)",
AQH_Value_GetNameForSystem(value),
(int) numberOfPoints);
DBG_INFO(NULL, "Value changed on server: %s (%d data points)",
AQH_Value_GetNameForSystem(value),
(int) numberOfPoints);
if (numberOfPoints>0 && dataPoints) {
uint32_t i;
@@ -633,7 +633,7 @@ void _handleBrokerChangeData(AQHREACT_UNIT *varChangeUnit, const GWEN_TAG16_LIST
timestamp=*(dataPoints++);
u.i=*(dataPoints++);
AqHomeReact_UnitVarChanges_ValueUpdated(varChangeUnit, value, timestamp, u.f);
DBG_ERROR(NULL, " datapoint: %f", u.f);
DBG_INFO(NULL, " datapoint: %f", u.f);
}
}
AQH_Value_free(value);
@@ -650,7 +650,7 @@ void AQH_ReactServer_CheckBrokerConnection(AQH_OBJECT *o)
if (xo && xo->dbArgs) {
if (xo->brokerEndpoint) {
if (AQH_Object_GetFlags(xo->brokerEndpoint) & AQH_OBJECT_FLAGS_DELETE) {
DBG_ERROR(NULL, "Deleting broker connection");
DBG_INFO(NULL, "Deleting broker connection");
AQH_Object_Disable(xo->brokerEndpoint);
AQH_Object_free(xo->brokerEndpoint);
xo->brokerEndpoint=NULL;

View File

@@ -184,7 +184,7 @@ int _isInsideSuntime(AQHREACT_UNIT *unit)
endTimeInMinutes=xunit->sunSetTimeInMinutes+xunit->offsetMinsForSunset;
result=(nowInMinutes>=startTimeInMinutes && nowInMinutes<=endTimeInMinutes)?1:0;
DBG_ERROR(NULL, "Is inside suntime: %d", result);
DBG_INFO(NULL, "Is inside suntime: %d", result);
return result;
}
return 0;
@@ -205,13 +205,13 @@ void _updateSuntimes(AQHREACT_UNIT *unit)
t=AQHomeReact_GetSunriseTimeForDateAndLoc(xunit->date, xunit->latitude, xunit->longitude);
xunit->sunRiseTimeInMinutes=_gwenTimeToMinutes(t);
DBG_ERROR(NULL, "%s: Sunrise today at %02d:%02d UTC",
DBG_INFO(NULL, "%s: Sunrise today at %02d:%02d UTC",
GWEN_Date_GetString(xunit->date), xunit->sunRiseTimeInMinutes/60, xunit->sunRiseTimeInMinutes%60);
GWEN_Time_free(t);
t=AQHomeReact_GetSunsetTimeForDateAndLoc(xunit->date, xunit->latitude, xunit->longitude);
xunit->sunSetTimeInMinutes=_gwenTimeToMinutes(t);
DBG_ERROR(NULL, "%s: Sunset today at %02d:%02d UTC",
DBG_INFO(NULL, "%s: Sunset today at %02d:%02d UTC",
GWEN_Date_GetString(xunit->date), xunit->sunSetTimeInMinutes/60, xunit->sunSetTimeInMinutes%60);
GWEN_Time_free(t);
@@ -261,7 +261,7 @@ void _readParams(AQHREACT_UNIT *unit)
xunit=GWEN_INHERIT_GETDATA(AQHREACT_UNIT, AQHREACT_UNIT_SUNTIME, unit);
if (xunit) {
DBG_ERROR(NULL, "Reading parameters");
DBG_INFO(NULL, "Reading parameters");
/* default to "Neues Rathaus" Celle ;-) */
xunit->latitude=AQHREACT_Unit_GetParamValueDouble(unit, AQHOMEREACT_UNIT_SUNTIME_PARAM_LAT, 52.619425);
xunit->longitude=AQHREACT_Unit_GetParamValueDouble(unit, AQHOMEREACT_UNIT_SUNTIME_PARAM_LONG, 10.087891);

View File

@@ -1,6 +1,6 @@
#!/bin/bash
export AQHOME_LOGLEVEL=info
#export AQHOME_LOGLEVEL=info
export LD_LIBRARY_PATH="0-build/aqhome/:$LD_LIBRARY_PATH"
# 0-build/apps/aqhome-storage/aqhome-storage $*

View File

@@ -1,6 +1,6 @@
#!/bin/bash
export AQHOME_LOGLEVEL=info
#export AQHOME_LOGLEVEL=info
export LD_LIBRARY_PATH="0-build/aqhome/:$LD_LIBRARY_PATH"
# 0-build/apps/aqhome-mqttlog/aqhome-mqttlog -ma 192.168.117.192 -mp 1883 -W /tmp/aqhome/mqttlog -i apps/aqhome-mqttlog/mqttlog.conf --mqttclientid=AQHOMEMQTTLOGTEST $*

View File

@@ -1,6 +1,6 @@
#!/bin/bash
export AQHOME_LOGLEVEL=info
# export AQHOME_LOGLEVEL=info
export LD_LIBRARY_PATH="0-build/aqhome/:$LD_LIBRARY_PATH"
0-build/apps/aqhome-react/aqhome-react -p ./aqhome-react.pid "$@"

View File

@@ -93,7 +93,7 @@ int _readMsg(AQH_OBJECT *o)
xo->currentMsgBuf=NULL;
xo->flags&=~AQH_MSG_READER_FLAGS_READBODY;
DBG_ERROR(NULL, "Received message:");
DBG_INFO(NULL, "Received message:");
//GWEN_Text_LogString((const char*) msgPtr, msgLen, NULL, GWEN_LoggerLevel_Error);
rv=AQH_Object_EmitSignal(o, AQH_MSG_READER_SIGNAL_MSGRECVD, msgLen, (void*) msgPtr);
if (rv==0) {

View File

@@ -92,7 +92,7 @@ char *AQH_MqttMessagePublish_ExtractTopic(const AQH_MESSAGE *msg)
ptr=AQH_Message_GetMsgPointer(msg)+idx;
len=(int)AQH_Message_GetUsedSize(msg)-idx;
DBG_ERROR(AQH_LOGDOMAIN, "Extracting string from %d (remaining len=%d)", idx, len);
DBG_INFO(AQH_LOGDOMAIN, "Extracting string from %d (remaining len=%d)", idx, len);
if (len>1)
return AQH_MqttMessage_ExtractStringAt(ptr, len);
}