aqhome-react: allow for int values.

those will be used e.g. to count number of open windows etc.
This commit is contained in:
Martin Preuss
2024-05-15 00:10:15 +02:00
parent 7ce34b0500
commit 5ec9827f92
8 changed files with 127 additions and 14 deletions

View File

@@ -216,6 +216,36 @@ double AqHomeReact_GetDoubleValue(AQHOME_REACT *aqh, const char *path, int idx,
int AqHomeReact_SetIntValue(AQHOME_REACT *aqh, const char *path, int value)
{
if (aqh && aqh->localVars && path && *path) {
int rv;
uint64_t timestamp;
timestamp=(uint64_t) time(NULL);
rv=AQH_Vars_SetIntValue(aqh->localVars, AQH_VARS_PATHFLAGS_OVERWRITE_VARS, path, value);
if (rv<0) {
DBG_INFO(NULL, "here (%d)", rv);
return rv;
}
AqHomeReact_UnitVarChanges_IntVarUpdated(aqh->localVarChangeUnit, path, timestamp, value);
return 0;
}
return GWEN_ERROR_INVALID;
}
int AqHomeReact_GetIntValue(AQHOME_REACT *aqh, const char *path, int idx, int defaultValue)
{
if (aqh && aqh->localVars && path && *path) {
return AQH_Vars_GetIntValue(aqh->localVars, path, idx, defaultValue);
}
return defaultValue;
}
AQHREACT_UNIT *AqHomeReact_CreateUnitByName(AQHOME_REACT *aqh, const char *unitType)
{
/* this does not include u_timer and u_varchanges, because those are only created once globally in init.c */