DEWETRON / OXYGEN-SDK-MQTT

OXYGEN MQTT Plugin
MIT License
1 stars 3 forks source link

Optional interval setting for async publish #4

Open moberhofer opened 2 years ago

moberhofer commented 2 years ago

It would be nice to set an optional interval when publishing data. Now, the user has to know, if a channel is synchronous or asynchronous nature and only can publish in native interval (async, sync has a downsampling option).

Suggestion: new Sampling type "interval" with same payload-type as async. "sampling": { "type": "interval", "interval_sec": 1 }

The Payload should have this format: { "sampling": "interval", "timestamp": 3, "value": 1, "min_value": 0.5, "max_value": 1.1, "avg_value": 0.8 } There should be new fields for statistic values since the last publish.

HpLightcorner commented 2 years ago

Just to make sure requirements are clear:

Can you give some more specific payload examples for sync and async channels? What happens if there is no new data for an async channel? Publish statistics with empty data array?

moberhofer commented 2 years ago
  • Can be applied to sync and async channels
    • Every interval_sec the plugin publishes data

Correct. This is what I ment.

What happens if there is no new data for an async channel? Publish statistics with empty data array?

In case of no new data, publish the "old" data with new timestamp (aka hold last value).

Can you give some more specific payload examples for sync and async channels?

The payload should look like the same for sync and async in this case of interval as shown in the first comment. Or am I missing something?