BottlecapDave / HomeAssistant-OctopusEnergy

Unofficial Home Assistant integration for interacting with Octopus Energy
https://bottlecapdave.github.io/HomeAssistant-OctopusEnergy/
MIT License
535 stars 51 forks source link

Integration pulls only zero data values from Octopus #28

Closed 35aportal closed 2 years ago

35aportal commented 2 years ago

My integration appears to work fine other than it only pulls zeros for electricity & gas consumption. 'Octopus Energy Electricity Current Rate' is pulled correctly.

  1. I've created a display for sensor.octopus_energy_electricity_16kxxxxxxxx_latest_consumption and see 0 reported, same for gas consumption.

  2. For the days prior to setting up the integration, the Energy dashboard correctly reports "There is no data for this period." So I'm confident that I'm retrieving data from Octopus, but it's 0's.

  3. I've downloaded raw data from Octopus and see consumption values in the Excel file that results.

  4. The only related log entry shows...

Logger: homeassistant.helpers.entity Source: helpers/entity.py:661 First occurred: 27 November 2021, 12:00:18 (11 occurrences) Last logged: 09:00:21

Update of sensor.octopus_energy_electricity_16kxxxxxxxx_latest_consumption is taking over 10 seconds Update of sensor.octopus_energy_gas_g4ksxxxxxxxx_latest_consumption is taking over 10 seconds Update of sensor.octopus_energy_electricity_16kxxxxxxxx_previous_accumulative_consumption is taking over 10 seconds

Any assistance would be very much appreciated. Thank you.

35aportal commented 2 years ago

Not sure how I missed this yesterday, could this be the cause of the problem...

This error originated from a custom integration.

Logger: custom_components.octopus_energy Source: custom_components/octopus_energy/api_client.py:21 Integration: Octopus Energy (documentation, issues) First occurred: 29 November 2021, 12:30:36 (1 occurrences) Last logged: 29 November 2021, 12:30:36

Unexpected error fetching rates data: Expecting value: line 1 column 1 (char 0) Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 187, in _async_refresh self.data = await self._async_update_data() File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 147, in _async_update_data return await self.update_method() File "/config/custom_components/octopus_energy/init.py", line 81, in async_update_data tariff_code = await async_get_current_agreement_tariff_code(client, config) File "/config/custom_components/octopus_energy/init.py", line 54, in async_get_current_agreement_tariff_code account_info = await client.async_get_account(config[CONFIG_MAIN_ACCOUNT_ID]) File "/config/custom_components/octopus_energy/api_client.py", line 21, in async_get_account data = await response.json(content_type=None) File "/usr/local/lib/python3.9/site-packages/aiohttp/client_reqrep.py", line 1113, in json return loads(stripped.decode(encoding)) File "/usr/local/lib/python3.9/json/init.py", line 346, in loads return _default_decoder.decode(s) File "/usr/local/lib/python3.9/json/decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/usr/local/lib/python3.9/json/decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

BottlecapDave commented 2 years ago

Hello, sorry for the late response. Unfortunately when I wrote this integration I was in the process of switching over to Octopus Energy. It was only upon switching did I realise they didn't provide live consumption data (previous day gets populates at roughly 8:00 the next day).

I'll remove the current consumption sensors in the next release to avoid confusion.

kinnectus commented 2 years ago

I've noticed my daily previous accumulative gets in to HA any time between 11-12 (lunch time) and 3-5pm. I usually get electricity accumulative first (around lunch time), followed by gas later.

I'm an ex-Avro customer moved as a result of SoLR.

I, too, always notice the current usage values are always 0.0. I was also under the impression it was due to the fact the API is always a day out, so we shouldn't expect to see the current usage populated.

35aportal commented 2 years ago

Thanks for the clarification. I'm now using previous consumption and can see consumption data in the HA Energy dashboard. I did set up 'Octopus Energy Electricity Previous Rate' as the rate in the HA Energy dashboard - this sensor shows the correct rate when I check it, but my cost is displayed a zero in the HA Energy dashboard. Not such a big issue - thanks for your help.