Github Mirror / telegraf-plugins: d879fadc




Use end of period for pricing information.

Use end of period for pricing information.

This is a little less intuitive in terms of reading graphs, but ensures that usage costs are calculated correctly if usage is joined with pricing info.

Commit d879fadc.

Authored 2023-07-15T11:15:08.000+01:00 by B Tasker in project Github Mirror / telegraf-plugins

+2 lines -1 lines

Commit Signature

Changes

diff --git a/octopus-energy/README.md b/octopus-energy/README.md
--- a/octopus-energy/README.md
+++ b/octopus-energy/README.md
# @@ -84,6 +84,7 @@ Notes:
#
# - The `octopus_meter` measurement exists purely to make information on the meter available, it's most useful values are the tagset rather than the fields
# - The timestamp used in `octopus_consumption` is the *end* of the indicated period, so if Octopus's API reports 1kWh used between 00:00 and 00:30, the timestamp on the point will be for 00:30
# +- For ease of joining, the timestamp used in `octopus_pricing` is the *end* of the indicated period, so if Octopus's API reports a price of 0.01 between 00:00 and 00:30, the timestamp on the point will be for 00:30
# - For ease of joining, the plugin calculates `octopus_pricing` points every 30 minutes between `valid_from` and `valid_to`
# - Export tariffs don't currently have any specific handling (that will be added later)
# - Gas isn't currently handled
#
diff --git a/octopus-energy/octopus-energy.py b/octopus-energy/octopus-energy.py
--- a/octopus-energy/octopus-energy.py
+++ b/octopus-energy/octopus-energy.py
# @@ -198,7 +198,7 @@ def priceToLP(price, tariff_code):
# # Iterate through
# lp_buffer = []
# while valid_from < valid_to:
# - lp_buffer.append(f"{lp} {valid_from * 1000000000}")
# + lp_buffer.append(f"{lp} {(valid_from + 1800) * 1000000000}")
# valid_from = valid_from + 1800
#
# return lp_buffer
#