mbmd icon indicating copy to clipboard operation
mbmd copied to clipboard

feature request: variable polling frequency and registers

Open bikeymouse opened this issue 4 years ago • 13 comments

Great program, now that I have it working. However I notice that it looks like it polls my meter like crazy (every second?) and requests all parameters from my SDM630 meter.

However I only would like query my meter every minute and want only with a subset of all possible parameters, so as not to produce too much overhead and pushing useless data to Influx (or MQTT). Is there a place in the code where I can adjust this? Or even better: would you consider to make this configurable? Perhaps via the input parameters or even better using the mbmd.yaml so this can be configured specifically for each meter.

bikeymouse avatar Nov 26 '19 21:11 bikeymouse

I'm not concerned with the overhead but please see https://github.com/volkszaehler/mbmd/issues/22 for open roadmap topics- this includes rate limiting. For limiting the data pushed I could suggest to give https://github.com/andig/ingress a try.

andig avatar Nov 26 '19 22:11 andig

Thanks for your quick reaction. I think even on my Raspberry Pi2b this can be handled by Influx although this would wear the SSD additionally while perhaps the amounts of write for my use case could be reduced by more then 60-fold (from 1/sec to 1/min) if I could reduce the polling frequency. And then again by 2 or 3 times by not writing all kind of parameters I will never look at.

While this rate-limiting is on the roadmap, could I change this somewhere in the code?

And would it work If I edit mdm.go and comment out all the op-codes that I don't need?

bikeymouse avatar Nov 26 '19 22:11 bikeymouse

See https://github.com/volkszaehler/mbmd/pull/59

andig avatar Dec 25 '19 12:12 andig

Tried it and it works great, thanks for the update!

Perhaps good to at this in the documentation as well, I struggled a bit to find out that the --rate flag needs not only a value but also a unit parameter, e.g. "--rate 30s"

bikeymouse avatar Dec 26 '19 14:12 bikeymouse

Could you please add more documentation about "rate limit feature"? Is it possible to put these parameters into config file?

bilbolodz avatar Jan 03 '20 11:01 bilbolodz

Right now, --rate|-r can only be set globally, on command line and as global setting in the yaml. I will add per-device rate limit to the todo list.

andig avatar Jan 03 '20 12:01 andig

OK but please give some details about --rate parameter. Maybe a little example with some explanation?

bilbolodz avatar Jan 03 '20 12:01 bilbolodz

Just add it:

# REST api, use 127.0.0.1 to restrict to localhost
api: 127.1:8081
rate: 30s
...

andig avatar Jan 03 '20 13:01 andig

OK but "rate: 30s" what does it means?

bilbolodz avatar Jan 03 '20 13:01 bilbolodz

Not sure I follow. It means that the device will be polled every 30 seconds?!

andig avatar Jan 03 '20 13:01 andig

OK, I see. Ideal solution (for me of course) is to keep frequency of pooling device BUT throttle frequency of Influxdb updates.Maybe it also could be good idea (for some parameters) send data to Influxdb ONLY on value change.

bilbolodz avatar Jan 03 '20 13:01 bilbolodz

Please open separate issue for influx throttling. I'm not sure thats very benefitial but we can keep track of it.

andig avatar Jan 03 '20 14:01 andig

Done.

bilbolodz avatar Jan 03 '20 17:01 bilbolodz