Github Mirror / telegraf-plugins: 62b6ed78




Don't try and fetch consumption if we don't know the meter serial (utilities/telegraf-plugins#17)

Don't try and fetch consumption if we don't know the meter serial (utilities/telegraf-plugins#17)

The meter's serial number is required when fetching consumption information. When Octopus are in the process of setting up an export account the API may return the new MPAN with no meters registered against it - this change prevents that from breaking collection of other info

Commit 62b6ed78.

Authored 2023-07-24T16:52:32.000+01:00 by B Tasker in project Github Mirror / telegraf-plugins

+3 lines -1 lines

Commit Signature

Changes

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
# @@ -231,6 +231,7 @@ def main(api_key, octo_account):
#
# addresses = []
# lp_buffer = []
# +
# # Iterate through addresses
# for prop in account['properties']:
# prop_info = {
# @@ -285,7 +286,8 @@ def main(api_key, octo_account):
# meter_info = getPricing(meter_info, session)
#
# # Get consumption
# - meter_info['consumption'] = getConsumption(meter_info, session)
# + if "serial" in meter_info:
# + meter_info['consumption'] = getConsumption(meter_info, session)
#
# # Create some LP for the meter itself
# lp = f'octopus_meter,mpan={meter_info["mpan"]},property={prop_info["id"]},account={prop_info["account_number"]},is_export={str(meter_info["is_export"])} start_date="{prop_info["start_date"]}" {int(dt.now().strftime("%s")) * 1000000000}'
#