Hi @ajoyce I have tried to follow along with your Octopus API example, but I am not sure if I am missing parts of your config?
My setup is in a package as follows:
# Octopus API
sensor:
- platform: command_line
name: electricity
value_template: '{{ value_json.count }}'
scan_interval: 600
json_attributes:
- results
command: >-
curl -u "APIKey:" "https://api.octopus.energy/v1/electricity-meter-points/MPN/meters/SERIAL/consumption/?period_from={{ (as_timestamp(now()) - 86400) | timestamp_custom("%Y-%m-%d", True) }}T00:00:00&period_to={{ (as_timestamp(now()) - 86400) | timestamp_custom("%Y-%m-%d", True) }}T23:59:59"
input_number:
electricity:
name: Electricity Use Yesterday
icon: mdi:flash
unit_of_measurement: 'kWh'
min: 0
max: 100
automation:
- alias: Electricity Update
initial_state: True
trigger:
- platform: state
entity_id: sensor.electricity
to: '48'
action:
service: input_number.set_value
data_template:
entity_id: input_number.electricity
value: '{{ (state_attr("sensor.electricity", "results") | map(attribute="consumption") | sum ) | round(3) }}'
Yesterday I just added the sensor without the automation and got the Blue bar with 50 (as per image below. When I added the automation this morning and restarted I got the Orange bar with 2.
I manually triggered the automation and got a consumption of 0.287kWh which I guess is the sum of the two entries from yesterday?
Am I missing parts of the configuration out?
If i try curl -H "Authorization: Basic xxxxxxxxxxxxxxxx"
The sensor returns no values.
Are you bale to share your complete configuration?