MattDahEpic / ha-midas

Home Assistant integration to get energy prices from California's MIDAS energy price API
MIT License
2 stars 0 forks source link

Integration won't start with valid credentials #4

Open Particpant opened 2 weeks ago

Particpant commented 2 weeks ago

System Health details

System Information

version core-2024.8.3
installation_type Home Assistant OS
dev false
hassio true
docker true
user root
virtualenv false
python_version 3.12.4
os_name Linux
os_version 6.6.46-haos
arch x86_64
timezone America/Los_Angeles
config_dir /config
Home Assistant Community Store GitHub API | ok -- | -- GitHub Content | ok GitHub Web | ok HACS Data | ok GitHub API Calls Remaining | 5000 Installed Version | 2.0.0 Stage | running Available Repositories | 1390 Downloaded Repositories | 13
Home Assistant Cloud logged_in | true -- | -- subscription_expiration | May 17, 2025 at 5:00 PM relayer_connected | true relayer_region | ****** remote_enabled | true remote_connected | true alexa_enabled | false google_enabled | false remote_server | us-east-1-8.ui.nabu.casa certificate_status | ready instance_id | ********************************* can_reach_cert_server | ok can_reach_cloud_auth | ok can_reach_cloud | ok
Home Assistant Supervisor host_os | Home Assistant OS 13.1 -- | -- update_channel | stable supervisor_version | supervisor-2024.08.0 agent_version | 1.6.0 docker_version | 26.1.4 disk_total | 109.3 GB disk_used | 38.9 GB healthy | true supported | true host_connectivity | true supervisor_connectivity | true ntp_synchronized | true virtualization | board | generic-x86-64 supervisor_api | ok version_api | ok installed_addons | Samba share (12.3.2), File editor (5.8.0), Terminal & SSH (9.14.0), Advanced SSH & Web Terminal (18.0.0), Z-Wave JS UI (3.10.0), ESPHome (2024.8.1), LMS Lyrion Music Server(Formerly Logitech Media Server) (8.5.2.0), Whisper (2.1.2), Piper (1.5.2), Squeezelite (0.0.19), chrony (3.0.1), Tailscale (0.21.0), eufy-security-ws (1.9.0), Music Assistant Server (2.2.2), Mosquitto broker (6.4.1), AdGuard Home (5.1.1)
Dashboards dashboards | 15 -- | -- resources | 4 views | 40 mode | storage
Recorder oldest_recorder_run | August 25, 2024 at 5:22 PM -- | -- current_recorder_run | September 2, 2024 at 3:38 PM estimated_db_size | 2744.94 MiB database_engine | sqlite database_version | 3.45.3

Checklist

Describe the issue

Failed setup after installing integration - I tried the rate ID from the forum thread and that did work, though it's not accurate for me. USCA-SCSC-0400-0000

Rate IDs

USCA-PGCC-0400-0000

Reproduction steps

  1. install integration
  2. create account via integration gui setup flow
  3. use confirmation link in email
  4. supply credentials to integration
  5. add my rate id
  6. integration fails to setup with the error from the debug log below. ...

Debug logs

2024-09-02 15:39:23.841 ERROR (MainThread) [custom_components.midas] Unexpected error fetching midas data
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 354, in _async_refresh
    self.data = await self._async_update_data()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/midas/coordinator.py", line 50, in _async_update_data
    data[rid] = await self._client.async_get_rate_data(rid)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/midas/api.py", line 29, in async_get_rate_data
    return await self._hass.async_add_executor_job(self._midas.GetRateInfo, rate_id)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/california_midasapi/ratelist.py", line 44, in GetRateInfo
    pricing_response = self.__request('GET', url)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/california_midasapi/internal.py", line 21, in __request
    raise f"Error preforming request: {response.status_code} {response.text}"
TypeError: exceptions must derive from BaseException
2024-09-02 15:39:23.859 DEBUG (MainThread) [custom_components.midas] Finished fetching midas data in 1.108 seconds (success: False)

Diagnostics dump

unavailable due to integration failing to set up

Particpant commented 2 weeks ago

try this <snip, highly suspect link> select the desired compiler in the installer

Anyone else encountering the issue reported in my post should not follow the link in the quoted reply to my issue report.

rohankapoorcom commented 2 weeks ago

Seeing the same issue with USCA-PGCC-0200-0000 and USCA-XXSF-0063-0000

MattDahEpic commented 2 weeks ago

Interesting, are either of you on Community Choice Aggregation electricity plans? USCA-PGCC-0400-0000 and USCA-PGCC-0200-0000 don't seem to exist in the MIDAS database though USCA-XXSF-0063-0000 does.

rohankapoorcom commented 2 weeks ago

Yes, I'm using a Community Choice Aggregation plan in San Francisco. The first code is from PG&E and the second code is from GreenPowerSF (the CCA).

MattDahEpic commented 2 weeks ago

After a little more investigation, I think this might be on PG&E. RINs are supposed to have a specific form that has the distribution and generation listed seperately for exactly this case: image

Per the MIDAS documentation CCA rates are divided into 2 RINs with the distribution one being USCA-PGXX-... and the generation one being USCA-XXSF-... but you both have "PGCC" as the delivery/generation pair while also having a second one for the CCA generation. Supporting this point is that the rates USCA-PGXX-0200-0000 and USCA-PGXX-0400-0000 both exist and seem like the rates that should be on your bill. I've reached out to the CEC to determine if this is intended and if not PG&E will likely get a letter telling them to make sure their bills are right.

Regardless, there is a bug here in that the error messages are pretty ugly. I've got a fix for that coming in the next release.

Particpant commented 2 weeks ago

For completeness' sake, I do have 2 codes, but I had initially missed that there were two, as they were on different pages. USCA-XXSF-0063-0000 is my CCA's code.

MattDahEpic commented 2 weeks ago

I've cleaned up the error messages a bit in the latest release: 0.1.3. I still want to have the integration actually check if the rates exist before letting you save so I'll leave this open for now.

As for the rates themselves the CEC has responded saying PG&E is aware and has been requested to update the RINs on bills but isn't sure when they'll do so. I'm not a PG&E customer so they're not likely to listen to me but if you feel it's worth the time you could send an email or call to PG&E letting them know the wrong RIN was on your bill.

In an effort to get you up and running until they fix the issue, I took a look into those previously mentioned XX energy code rates. If these sound like the distribution charges on your bill you might be able to use these until the real RINs start showing up and if my guess is right maybe they are the right RINs:

Particpant commented 2 weeks ago

It's close enough!

rohankapoorcom commented 2 weeks ago

Thank you, it's the correct one for me! Appreciate you taking the time to figure this out!