lewei50 / ha_iammeter

IAMMETER custom component for Home Assistant
Apache License 2.0
4 stars 1 forks source link

Failed to set up HA Core 2023.5.0 #6

Closed soheiladeli closed 1 year ago

soheiladeli commented 1 year ago

Hi, have issue with the home assistant core integration 2023.5.0. The HACS integration fails to set up: Home Assistant core 2023.5.0 Frontend 20230503.1 - latest

Logger: homeassistant.config_entries Source: custom_components/iammeter_http/init.py:25 Integration: Iammeter_http First occurred: 5:10:34 PM (1 occurrences) Last logged: 5:10:34 PM

Error setting up entry i_meter_fc621daa for iammeter_http Traceback (most recent call last): File "/srv/homeassistant/lib/python3.10/site-packages/homeassistant/config_entries.py", line 387, in async_setup result = await component.async_setup_entry(hass, self) File "/root/.homeassistant/custom_components/iammeter_http/init.py", line 25, in async_setup_entry hass.config_entries.async_setup_platforms(entry, PLATFORMS) AttributeError: 'ConfigEntries' object has no attribute 'async_setup_platforms'

image
grahambrown11 commented 1 year ago

I have the same issue... Open custom_components/iammeter_http/__init__.py in an editor (I use the VSCode Addon) and update line 25 to

await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)

Restart HA and the integration is working again and getting the enery data 😄 I'll see if I have time I'll clone the project and submit a PR...

soheiladeli commented 1 year ago

@grahambrown11 , thanks, that fixed it 👍

grahambrown11 commented 1 year ago

PR submitted #7

sinemaker commented 1 year ago

I am having the same problem with six iammeter devices. I have tried deleting, re-installing. I added the word "await" to line 25 as suggested but that had no impact.

grahambrown11 commented 1 year ago

@sinemaker the whole line needs to change... it used a deprecated method and the HomeAssistant maintainers removed a lot of deprecations this release... the function was async_setup_platforms and now needs to be async_forward_entry_setups with the await

miwyf commented 1 year ago

Issue resolved, many thanks to @grahambrown11 for the PR submitted

grahambrown11 commented 1 year ago

Issue resolved, many thanks to @grahambrown11 for the PR submitted

@miwyf I have updated via HACS and can confirm all working now 🎉 , you may close this issue 🚀