· 4 years ago · Aug 18, 2021, 02:54 PM
1# Sensors retrieving meter data for the current month to date (does not retrieve the last 48 hours data due to delays in Octopus reporting/receiving the data
2
3- platform: command_line
4 command: 'curl --user **replace with your API key** "https://api.octopus.energy/v1/electricity-meter-points/**replace with your MPAN**/meters/**replace with meter serial number**/consumption/?page_size=1&period_from={{ as_timestamp(now().replace(day=1, hour=0, minute=0, second=0)) | timestamp_custom("%Y-%m-%dT%H:%M:%S") }}&period_to={{ as_timestamp(now()-timedelta(hours=48)) | timestamp_custom("%Y-%m-%dT%H:%M:%S") }}&group_by=month"'
5 name: Electricity MTD
6 value_template: '{{ value_json.results[0].consumption }}'
7 unit_of_measurement: kWh
8 scan_interval: 300
9
10- platform: command_line
11 command: 'curl --user sk_**replace with your API key** "https://api.octopus.energy/v1/gas-meter-points/**replace with your MPAN**/meters/**replace with meter serial number**/consumption/?page_size=1&period_from={{ as_timestamp(now().replace(day=1, hour=0, minute=0, second=0)) | timestamp_custom("%Y-%m-%dT%H:%M:%S") }}&period_to={{ as_timestamp(now()-timedelta(hours=48)) | timestamp_custom("%Y-%m-%dT%H:%M:%S") }}&group_by=month"'
12 name: Gas MTD
13 value_template: '{{ value_json.results[0].consumption }}'
14 unit_of_measurement: kWh
15 scan_interval: 300
16
17# Utility meters set up to allow reporting into the energy module NOTE: The data used here and in the resulting energy graphs will be 2 days behind e.g. graphs showing the date 18/08/2021 will actually be providing data for 16/08/2021
18
19utility_meter:
20 electricity_daily:
21 source: sensor.electricity_mtd
22 cycle: daily
23 offset:
24 days: 2
25 electricity_monthly:
26 source: sensor.electricity_mtd
27 cycle: monthly
28 offset:
29 days: 2
30 gas_daily:
31 source: sensor.gas_mtd
32 cycle: daily
33 offset:
34 days: 2
35 gas_monthly:
36 source: sensor.gas_mtd
37 cycle: monthly
38 offset:
39 days: 2
40
41
42