Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged config_flow HA changes #15

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

CoreyJ87
Copy link

@CoreyJ87 CoreyJ87 commented Apr 2, 2024

Sorry to reopen this. I thought the code I had in the original PR did not work. I was testing wrong. It appears it does work. Anyways like I said in the other PR

In #10 this pull request Gabriel mentioned that the config text was broken. I believe this is the missing code that should fix that. As this is part of the rework they did in the official HA integration around the config flow. Also removed the extra "CONF_NAME".

@CoreyJ87
Copy link
Author

CoreyJ87 commented Apr 4, 2024

Okay, so after some more testing now that I finally have the device. This doesn't quite fix it. I've narrowed it down a bit. It seems to be related to the fact that when it tries to make these calls in each file. It times out and errors. https://github.com/thebradleysanders/Monoprice-6-Zone-Audio-Controller/blob/dev/custom_components/monoprice_custom/media_player.py#L212.

When you don't have the extra zones. Like in my case. I just have a single 6 zone. It blows up trying to make this call state = self._monoprice.zone_status(self._zone_id) to each zone you don't have. It times out and causes everything to throw warnings and errors. Bombing out the configuration even though in the background everything still loads correctly.

I was able to fix the config flow bombing out by adding in this if. This effectively skips doing that call for any zones I personally do not have. Fixing the flow.

       """Retrieve latest state."""
       if self._zone_id > 20:
           self._update_success = False
           return
       try:
           state = self._monoprice.zone_status(self._zone_id)

This obviously isn't a fix. As people need this if they have more than 6 zones. I just don't know enough of what I'm doing here to say what that fix is. Just figured I'd post what I have so far in hopes it will save you guys some time.

I'll keep digging when I have time but here is an example of the error I get from the config flow when I don't have that if statement in there.

Error setting up entry socket://ip:port for monoprice
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 504, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/monoprice/__init__.py", line 51, in async_setup_entry
    await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 1741, in async_forward_entry_setups
    await asyncio.gather(
asyncio.exceptions.CancelledError

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant