hansij66 / dsmr2mqtt

DSMR to MQTT; Smartmeter to MQTT; Slimme meter naar MQTT
GNU General Public License v3.0
9 stars 14 forks source link

Ability to configure sample rate #2

Closed erikhubers closed 1 year ago

erikhubers commented 1 year ago

Hey there,

Thank you for this amazing tool! I bought myself a P1 cable yesterday to integrate my energy usage into HomeAssistant. I'm investigating my energy usage at the moment and needed a higher sample rate than once per minute (10s) in order to have a 'live' view of the current power usage to find some devices that draw a lot of power.

I created a fork with a (quick & dirty) way to set the sample rate in the config.py.

If you like this small addition you could merge this PR, if not you can just decline this and I'll keep using my fork :). PR feedback is fine too if I need to improve on some stuff before approval.

hansij66 commented 1 year ago

Hey Erik

Always nice to hear that someone is using my code :) Thanks for letting me know.

I have not tested all options of my release, but my intend was that what you want, a higher sample rate is already implemented.

My intend was that you adapt dmsr50.py If you would set the MAXRATE field of a measurement to eg 3600 for the entries which need a high sample rate, you would get every second a sample (assuming that the DSMR meter will actually generate every second a sample).

My intention was that you can specify this per measurement, eg it is useless to do high frequency for kWh measurement, as that is a cumulative number; while for W measurement, it can be very useful. I am storing all my measurements in a influx database; to reduce disk space by reducing sample frequency where it high frequency is not required.

I think you have made the sample frequency for all measurements equal, while I made it configurable per measurement in dsmr50.py.

Have you tried this?

Thanks Hans

On Mon, Nov 14, 2022 at 5:07 PM Erik @.***> wrote:

Hey there,

Thank you for this amazing tool! I bought myself a P1 cable yesterday to integrate my energy usage into HomeAssistant. I'm investigating my energy usage at the moment and needed a higher sample rate than once per minute (10s) in order to have a 'live' view of the current power usage to find some devices that draw a lot of power.

I created a fork with a (quick & dirty) way to set the sample rate in the config.py.

If you like this small addition you could merge this PR, if not you can just decline this and I'll keep using my fork :). PR feedback is fine too if I need to improve on some stuff before approval.

You can view, comment on, or merge this pull request online at:

https://github.com/hansij66/dsmr2mqtt/pull/2 Commit Summary

File Changes

(3 files https://github.com/hansij66/dsmr2mqtt/pull/2/files)

Patch Links:

— Reply to this email directly, view it on GitHub https://github.com/hansij66/dsmr2mqtt/pull/2, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFFPZDZI2KN5UX5EI2XAQPTWIJPV5ANCNFSM6AAAAAAR77QU7A . You are receiving this because you are subscribed to this thread.Message ID: @.***>

erikhubers commented 1 year ago

Hey Hans,

Thank you for your explanation. I wasn't really interpreting this as a configuration file. With your explanation of the intended use of the dmsr50.py file this now makes a lot of sense and makes this PR a bit silly. Your approach makes a lot more sense.

I think I'll just populate the sample rates in the dmsr50.py file directly, I'll just have to tweak my Ansible deployment a bit.

Thank you for taking the time to respond.

Kind regards,

Erik

hansij66 commented 1 year ago

Hi Erik, I will see if I can enhance the readme a bit better.

On Mon, Nov 14, 2022 at 9:41 PM Erik @.***> wrote:

Hey Hans,

Thank you for your explanation. I wasn't really interpreting this as a configuration file. With your explanation of the intended use of the dmsr50.py file this now makes a lot of sense and makes this PR a bit silly. Your approach makes a lot more sense.

I think I'll just populate the sample rates in the dmsr50.py file directly, I'll just have to tweak my Ansible deployment a bit.

Thank you for taking the time to respond.

Kind regards,

Erik

— Reply to this email directly, view it on GitHub https://github.com/hansij66/dsmr2mqtt/pull/2#issuecomment-1314353761, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFFPZD6HZRBN2NDTTZ6QCLDWIKPX5ANCNFSM6AAAAAAR77QU7A . You are receiving this because you commented.Message ID: @.***>