home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
72.02k stars 30.17k forks source link

Amber Electric integration suddenly failing #120840

Open clydebarrow opened 3 months ago

clydebarrow commented 3 months ago

The problem

I have been using the Amber Electric integration for some time, and apart from having to reload it daily it's been working fine. Today it has started reporting failure, and returning no data. I have tried removing the integration and reinstalling it and rebooting HA with no change. The API key is evidently correct since it correctly fetches my NMI. I can test the Amber API using their online tool with success, using the same API key and either default date range or today as a date range

The problem appears to have started at midnight today so I suspect the integration is passing an invalid query but I do not know what query parameters the HA integration is passing in the request as this is not reported in the debug log.

What version of Home Assistant Core has the issue?

Core 2024.6.4

What was the last working version of Home Assistant Core?

2024.6.4

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Amber Electric

Link to integration documentation on our website

https://www.home-assistant.io/integrations/amberelectric

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

2024-06-30 04:45:09.016 DEBUG (SyncWorker_2) [amberelectric.rest] response body: b'{"message": "Internal server error"}'
2024-06-30 04:45:09.033 DEBUG (MainThread) [homeassistant.components.amberelectric] Finished fetching amberelectric data in 0.718 seconds (success: False)
2024-06-30 04:46:43.838 DEBUG (SyncWorker_5) [amberelectric.rest] response body: b'{"message": "Internal server error"}'
2024-06-30 04:46:43.855 DEBUG (MainThread) [homeassistant.components.amberelectric] Finished fetching amberelectric data in 0.680 seconds (success: False)

Additional information

No response

home-assistant[bot] commented 3 months ago

Hey there @madpilot, mind taking a look at this issue as it has been labeled with an integration (amberelectric) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `amberelectric` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign amberelectric` Removes the current integration label and assignees on the issue, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


amberelectric documentation amberelectric source (message by IssueLinks)

madpilot commented 3 months ago

This is an issue on the Amber side, not the integration.

Please email info@amber.com.au with your NMI so we can figure out what the issue is.

joshm74 commented 3 months ago

I've also sent my NMI through. I have one NMI that still works (a closed account) but my main one doesn't work. On looking at the API results for both, I do see that the one that does work has "tariffInformation > season" with a value of default where the one that does not work does not have this element in the respose (this is under the currentPrices API).

madpilot commented 3 months ago

We having some issues pricing a few tariffs at the moment. The 500 errors should be gone now, but N71 tariffs will be incorrect until we can apply the correct fix tomorrow.

joshm74 commented 3 months ago

We having some issues pricing a few tariffs at the moment. The 500 errors should be gone now, but N71 tariffs will be incorrect until we can apply the correct fix tomorrow.

For what it's worth I'm still getting internal server errors - on Essential (BLNT3AL/BLNE23AU)

madpilot commented 3 months ago

Noted. I’m at the limit of patching I can do today without doing the proper fixes that are required.

Sorry about that

clydebarrow commented 3 months ago

This is an issue on the Amber side, not the integration.

The 500 error certainly suggested that, but since it worked by accessing the API directly, I had nothing to report to Amber. I'd recommend that the integration needs to report more detail at least with debug logging enabled, to facilitate troubleshooting.

clydebarrow commented 3 months ago

When trying to reload the integration I now get this error:

Logger: homeassistant.components.automation.amber_reload
Source: components/automation/__init__.py:723
integration: Automation (documentation, issues)
First occurred: 05:30:00 (11 occurrences)
Last logged: 15:30:00

While executing automation automation.amber_reload
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/automation/__init__.py", line 723, in async_trigger
    return await self.action_script.async_run(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1769, in async_run
    return await asyncio.shield(create_eager_task(run.async_run()))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 464, in async_run
    await self._async_step(log_exceptions=False)
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 528, in _async_step
    self._handle_exception(
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 558, in _handle_exception
    raise exception
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 526, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 763, in _async_call_service_step
    response_data = await self._async_run_long_action(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 726, in _async_run_long_action
    return await long_task
           ^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2741, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2784, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1080, in _async_admin_handler
    await result
  File "/usr/src/homeassistant/homeassistant/components/homeassistant/__init__.py", line 313, in async_handle_reload_config_entry
    raise ValueError("There were no matching config entries to reload")
ValueError: There were no matching config entries to reload
clydebarrow commented 3 months ago

For what it's worth I'm still getting internal server errors - on Essential (BLNT3AL/BLNE23AU)

Same for me, on the same tariffs.

madpilot commented 3 months ago

This is an issue on the Amber side, not the integration.

The 500 error certainly suggested that, but since it worked by accessing the API directly, I had nothing to report to Amber. I'd recommend that the integration needs to report more detail at least with debug logging enabled, to facilitate troubleshooting.

The API doesn’t give more information on a 500, but I can see the logs on Amber’s side which does give me the answer.

clydebarrow commented 3 months ago

The API doesn’t give more information on a 500, b

Sure, but if the integration reported the failed URI it could be reproduced. Anyway, glad you're onto it and hopefully it will be resolved shortly. I have several automations that depend on pricing information.

mitchellsanders commented 3 months ago

I'm also having this issue with the integration. Looking forward to a speedy fix :)

joshm74 commented 3 months ago

Mine appears to be working again now - hopefully the same for everyone :)

Ralim commented 3 months ago

Can confirm this is still broken for N73 tariff (for me). (Amber app also showing errors for usage data). Should we continue to contact the Amber email with our NMI's ?

Edit: As of 5:15pm it is working again. Thank you 🎉

clydebarrow commented 3 months ago

Working for me now on Essential Energy tariff.

the1poet commented 3 months ago

Miner's working now. I'm with essential energy

issue-triage-workflows[bot] commented 5 days ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.