Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get live data from HTTP server with active aggregation #609

Open
shikousa opened this issue Nov 4, 2023 · 3 comments
Open

Get live data from HTTP server with active aggregation #609

shikousa opened this issue Nov 4, 2023 · 3 comments

Comments

@shikousa
Copy link

shikousa commented Nov 4, 2023

The HTTP server seems not to provide realtime readings, but only the aggregated values.

This delivers exactly the same, but should be different, as my aggregation time is 600s.
http://localhost/middleware.php/data.json?options=raw&from=now&uuid[]=1111-2222-3333
http://localhost:8081/1111-2222-3333

Is there a way to get the live data over HTTP? The push server is working, as I can see the live data in the middleware.

@r00t-
Copy link
Contributor

r00t- commented Nov 4, 2023

the server serves data from localbuffer:
https://github.com/volkszaehler/vzlogger/blob/master/src/local.cpp#L53

which is populated with data from just after aggregation:

add_ch_to_localbuffer(*(*ch)); // add this ch data to the local buffer

i'm not sure how much changes would be needed to serve non-aggregated data.
(besides obvious things like requiring a larger buffer.)

@shikousa
Copy link
Author

shikousa commented Nov 5, 2023

During aggregation it seems that both Push Server and MQTT Data is updated.
Is MQTT really updated during aggregation, as there is another update after aggregation?

vzlogger/src/threads.cpp

Lines 136 to 147 in df03cf6

// provide data to push data server:
if (pushDataList) {
const std::string uuid = (*ch)->uuid();
pushDataList->add(uuid, rds[i].time_ms(), rds[i].value());
print(log_finest, "added to uuid %s", "push", uuid.c_str());
}
#ifdef ENABLE_MQTT
// update mqtt values as well:
if (mqttClient) {
mqttClient->publish((*ch), rds[i]);
}
#endif

Is it possible to add this code section also during aggregation?

vzlogger/src/threads.cpp

Lines 163 to 168 in df03cf6

#ifdef LOCAL_SUPPORT
if (options.local()) {
shrink_localbuffer(); // remove old/outdated data in the local buffer
add_ch_to_localbuffer(*(*ch)); // add this ch data to the local buffer
}
#endif

@r00t-
Copy link
Contributor

r00t- commented Nov 9, 2023

Is it possible to add this code section also during aggregation?

why don't you just try it, worst case it will crash...

Is MQTT really updated during aggregation, as there is another update after aggregation?

i'm not so familiar with the MQTT integration, but i think it publishes BOTH the raw and aggregated values.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants