jomjol / AI-on-the-edge-device

Easy to use device for connecting "old" measuring units (water, power, gas, ...) to the digital world
https://jomjol.github.io/AI-on-the-edge-device-docs/
5.63k stars 606 forks source link

Add more variables to API json #2335

Open danube opened 1 year ago

danube commented 1 year ago

The Feature

caco3 commented 1 year ago

Do you refer to MQTT or REST?

Since interval never changes after it got configured, its kind of a waste of resources to provide it in every round.

MQTT

interval is already available in another MQTT topic!

REST

Indeed that seems not to be available as of now.

danube commented 1 year ago

For various calculations, i.e. a daily throughput, one can multiply watermeter/main/json/rate with the interval. As this interval is not provided, it needs to be hardcoded in the application. Changing the interval on the ESP results in the need to adapt the application as well. This would not be necessary if having both values provided by the ESP.

But of course you're right and if CPU load exceeds a specific limit by extend the publishing code, it may make sense to reconsider this.

Regarding MQTT, you're right, interval is available in another topic watermeter/interval. But to perform above mentioned calculation, a subscription upon two topics instead of one is required. That may trigger your application twice, if the subscribed topics do not change at exactly the same time.