HA HACs integration

Hi,
I have been running this version of the HACs integration for AmpliPi. I noticed in the v0.4.2 release notes that the integration has had some love, but it is now to be found at;

https://github.com/micro-nova/hacs_amplipi

So I removed Brian’s version completely, deleted all my entities, and the HACs integration etc.

But when trying to re-install the new mico-nova version I was not getting any auto-discovery happening. So I tried to manually add a device, entering the IP address of my AmpliPi in the first box, and 80 in the second box (neither having labels) and it came up saying the device had been successfully installed.

However looking in my device list there was an entry for the AmpliPi but it was saying there was an error;

homeassistant_app.1.x4d476o5470w@nuc01    | 2024-08-09 13:56:03.582 WARNING (MainThread) [custom_components.amplipi.config_flow] New Amplipi by user
homeassistant_app.1.x4d476o5470w@nuc01    | 2024-08-09 13:56:03.750 WARNING (MainThread) [homeassistant.util.loop] Detected blocking call to import_module with args ('custom_components.amplipi.media_player',) inside the event loop by custom integration 'amplipi' at custom_components/amplipi/__init__.py, line 33: await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS) (offender: /usr/src/homeassistant/homeassistant/loader.py, line 1296: return importlib.import_module(f"{self.pkg_path}.{platform_name}")), please report it to the author of the 'amplipi' custom integration
homeassistant_app.1.x4d476o5470w@nuc01    | For developers, please see https://developers.home-assistant.io/docs/asyncio_blocking_operations/#import_module
homeassistant_app.1.x4d476o5470w@nuc01    | Traceback (most recent call last):
homeassistant_app.1.x4d476o5470w@nuc01    |   File "<frozen runpy>", line 198, in _run_module_as_main
homeassistant_app.1.x4d476o5470w@nuc01    |   File "<frozen runpy>", line 88, in _run_code
homeassistant_app.1.x4d476o5470w@nuc01    |   File "/usr/src/homeassistant/homeassistant/__main__.py", line 223, in <module>
homeassistant_app.1.x4d476o5470w@nuc01    |     sys.exit(main())
homeassistant_app.1.x4d476o5470w@nuc01    |   File "/usr/src/homeassistant/homeassistant/__main__.py", line 209, in main
homeassistant_app.1.x4d476o5470w@nuc01    |     exit_code = runner.run(runtime_conf)
homeassistant_app.1.x4d476o5470w@nuc01    |   File "/usr/src/homeassistant/homeassistant/runner.py", line 190, in run
homeassistant_app.1.x4d476o5470w@nuc01    |     return loop.run_until_complete(setup_and_run_hass(runtime_config))
homeassistant_app.1.x4d476o5470w@nuc01    |   File "/usr/local/lib/python3.12/asyncio/base_events.py", line 674, in run_until_complete
homeassistant_app.1.x4d476o5470w@nuc01    |     self.run_forever()
homeassistant_app.1.x4d476o5470w@nuc01    |   File "/usr/local/lib/python3.12/asyncio/base_events.py", line 641, in run_forever
homeassistant_app.1.x4d476o5470w@nuc01    |     self._run_once()
homeassistant_app.1.x4d476o5470w@nuc01    |   File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1990, in _run_once
homeassistant_app.1.x4d476o5470w@nuc01    |     handle._run()
homeassistant_app.1.x4d476o5470w@nuc01    |   File "/usr/local/lib/python3.12/asyncio/events.py", line 88, in _run
homeassistant_app.1.x4d476o5470w@nuc01    |     self._context.run(self._callback, *self._args)
homeassistant_app.1.x4d476o5470w@nuc01    |   File "/usr/src/homeassistant/homeassistant/config_entries.py", line 752, in async_setup_locked
homeassistant_app.1.x4d476o5470w@nuc01    |     await self.async_setup(hass, integration=integration)
homeassistant_app.1.x4d476o5470w@nuc01    |   File "/usr/src/homeassistant/homeassistant/config_entries.py", line 604, in async_setup
homeassistant_app.1.x4d476o5470w@nuc01    |     result = await component.async_setup_entry(hass, self)
homeassistant_app.1.x4d476o5470w@nuc01    |   File "/config/custom_components/amplipi/__init__.py", line 33, in async_setup_entry
homeassistant_app.1.x4d476o5470w@nuc01    |     await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
homeassistant_app.1.x4d476o5470w@nuc01    |
homeassistant_app.1.x4d476o5470w@nuc01    | 2024-08-09 13:56:03.753 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry AmpliPi for amplipi
homeassistant_app.1.x4d476o5470w@nuc01    | Traceback (most recent call last):
homeassistant_app.1.x4d476o5470w@nuc01    |   File "/usr/src/homeassistant/homeassistant/config_entries.py", line 604, in async_setup
homeassistant_app.1.x4d476o5470w@nuc01    |     result = await component.async_setup_entry(hass, self)
homeassistant_app.1.x4d476o5470w@nuc01    |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
homeassistant_app.1.x4d476o5470w@nuc01    |   File "/config/custom_components/amplipi/__init__.py", line 33, in async_setup_entry
homeassistant_app.1.x4d476o5470w@nuc01    |     await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
homeassistant_app.1.x4d476o5470w@nuc01    |   File "/usr/src/homeassistant/homeassistant/config_entries.py", line 2085, in async_forward_entry_setups
homeassistant_app.1.x4d476o5470w@nuc01    |     await integration.async_get_platforms(platforms)
homeassistant_app.1.x4d476o5470w@nuc01    |   File "/usr/src/homeassistant/homeassistant/loader.py", line 1177, in async_get_platforms
homeassistant_app.1.x4d476o5470w@nuc01    |     import_future.result()
homeassistant_app.1.x4d476o5470w@nuc01    |   File "/usr/src/homeassistant/homeassistant/loader.py", line 1165, in async_get_platforms
homeassistant_app.1.x4d476o5470w@nuc01    |     platforms.update(self._load_platforms(platform_names))
homeassistant_app.1.x4d476o5470w@nuc01    |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
homeassistant_app.1.x4d476o5470w@nuc01    |   File "/usr/src/homeassistant/homeassistant/loader.py", line 1090, in _load_platforms
homeassistant_app.1.x4d476o5470w@nuc01    |     platform_name: self._load_platform(platform_name)
homeassistant_app.1.x4d476o5470w@nuc01    |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
homeassistant_app.1.x4d476o5470w@nuc01    |   File "/usr/src/homeassistant/homeassistant/loader.py", line 1264, in _load_platform
homeassistant_app.1.x4d476o5470w@nuc01    |     cache[full_name] = self._import_platform(platform_name)
homeassistant_app.1.x4d476o5470w@nuc01    |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
homeassistant_app.1.x4d476o5470w@nuc01    |   File "/usr/src/homeassistant/homeassistant/loader.py", line 1296, in _import_platform
homeassistant_app.1.x4d476o5470w@nuc01    |     return importlib.import_module(f"{self.pkg_path}.{platform_name}")
homeassistant_app.1.x4d476o5470w@nuc01    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
homeassistant_app.1.x4d476o5470w@nuc01    |   File "/usr/src/homeassistant/homeassistant/util/loop.py", line 200, in protected_loop_func
homeassistant_app.1.x4d476o5470w@nuc01    |     return func(*args, **kwargs)
homeassistant_app.1.x4d476o5470w@nuc01    |            ^^^^^^^^^^^^^^^^^^^^^
homeassistant_app.1.x4d476o5470w@nuc01    |   File "/usr/local/lib/python3.12/importlib/__init__.py", line 90, in import_module
homeassistant_app.1.x4d476o5470w@nuc01    |     return _bootstrap._gcd_import(name[level:], package, level)
homeassistant_app.1.x4d476o5470w@nuc01    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
homeassistant_app.1.x4d476o5470w@nuc01    |   File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
homeassistant_app.1.x4d476o5470w@nuc01    |   File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
homeassistant_app.1.x4d476o5470w@nuc01    |   File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
homeassistant_app.1.x4d476o5470w@nuc01    |   File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
homeassistant_app.1.x4d476o5470w@nuc01    |   File "<frozen importlib._bootstrap_external>", line 995, in exec_module
homeassistant_app.1.x4d476o5470w@nuc01    |   File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
homeassistant_app.1.x4d476o5470w@nuc01    |   File "/config/custom_components/amplipi/media_player.py", line 20, in <module>
homeassistant_app.1.x4d476o5470w@nuc01    |     from pyamplipi.models import ZoneUpdate, Source, SourceUpdate, GroupUpdate, Stream, Group, Zone, Announcement, \
homeassistant_app.1.x4d476o5470w@nuc01    | ImportError: cannot import name 'PlayMedia' from 'pyamplipi.models' (/usr/local/lib/python3.12/site-packages/pyamplipi/models.py)

Which version of the integration should we be using?!

Cheers,
Ben

Howdy @sumnerboy,

good catch! We were running our local development fork of pyamplipi on our HomeAssistant instance and forgot to bump the version number in the manifest; I just merged a fix. Could you try updating the HACS custom repo info & redownloading to grab the latest?

Nope still no good…

homeassistant_app.1.x4d476o5470w@nuc01    | 2024-08-10 21:56:11.160 WARNING (MainThread) [custom_components.amplipi.config_flow] New Amplipi by user
homeassistant_app.1.x4d476o5470w@nuc01    | 2024-08-10 21:56:23.432 WARNING (MainThread) [custom_components.amplipi.config_flow] New Amplipi by user
homeassistant_app.1.x4d476o5470w@nuc01    | 2024-08-10 21:56:23.578 WARNING (MainThread) [homeassistant.util.loop] Detected blocking call to import_module with args ('custom_components.amplipi.media_player',) inside the event loop by custom integration 'amplipi' at custom_components/amplipi/__init__.py, line 33: await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS) (offender: /usr/src/homeassistant/homeassistant/loader.py, line 1296: return importlib.import_module(f"{self.pkg_path}.{platform_name}")), please report it to the author of the 'amplipi' custom integration
homeassistant_app.1.x4d476o5470w@nuc01    | For developers, please see https://developers.home-assistant.io/docs/asyncio_blocking_operations/#import_module
homeassistant_app.1.x4d476o5470w@nuc01    | Traceback (most recent call last):
homeassistant_app.1.x4d476o5470w@nuc01    |   File "<frozen runpy>", line 198, in _run_module_as_main
homeassistant_app.1.x4d476o5470w@nuc01    |   File "<frozen runpy>", line 88, in _run_code
homeassistant_app.1.x4d476o5470w@nuc01    |   File "/usr/src/homeassistant/homeassistant/__main__.py", line 223, in <module>
homeassistant_app.1.x4d476o5470w@nuc01    |     sys.exit(main())
homeassistant_app.1.x4d476o5470w@nuc01    |   File "/usr/src/homeassistant/homeassistant/__main__.py", line 209, in main
homeassistant_app.1.x4d476o5470w@nuc01    |     exit_code = runner.run(runtime_conf)
homeassistant_app.1.x4d476o5470w@nuc01    |   File "/usr/src/homeassistant/homeassistant/runner.py", line 190, in run
homeassistant_app.1.x4d476o5470w@nuc01    |     return loop.run_until_complete(setup_and_run_hass(runtime_config))
homeassistant_app.1.x4d476o5470w@nuc01    |   File "/usr/local/lib/python3.12/asyncio/base_events.py", line 674, in run_until_complete
homeassistant_app.1.x4d476o5470w@nuc01    |     self.run_forever()
homeassistant_app.1.x4d476o5470w@nuc01    |   File "/usr/local/lib/python3.12/asyncio/base_events.py", line 641, in run_forever
homeassistant_app.1.x4d476o5470w@nuc01    |     self._run_once()
homeassistant_app.1.x4d476o5470w@nuc01    |   File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1990, in _run_once
homeassistant_app.1.x4d476o5470w@nuc01    |     handle._run()
homeassistant_app.1.x4d476o5470w@nuc01    |   File "/usr/local/lib/python3.12/asyncio/events.py", line 88, in _run
homeassistant_app.1.x4d476o5470w@nuc01    |     self._context.run(self._callback, *self._args)
homeassistant_app.1.x4d476o5470w@nuc01    |   File "/usr/src/homeassistant/homeassistant/config_entries.py", line 752, in async_setup_locked
homeassistant_app.1.x4d476o5470w@nuc01    |     await self.async_setup(hass, integration=integration)
homeassistant_app.1.x4d476o5470w@nuc01    |   File "/usr/src/homeassistant/homeassistant/config_entries.py", line 604, in async_setup
homeassistant_app.1.x4d476o5470w@nuc01    |     result = await component.async_setup_entry(hass, self)
homeassistant_app.1.x4d476o5470w@nuc01    |   File "/config/custom_components/amplipi/__init__.py", line 33, in async_setup_entry
homeassistant_app.1.x4d476o5470w@nuc01    |     await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
homeassistant_app.1.x4d476o5470w@nuc01    |
homeassistant_app.1.x4d476o5470w@nuc01    | 2024-08-10 21:56:23.579 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry AmpliPi for amplipi
homeassistant_app.1.x4d476o5470w@nuc01    | Traceback (most recent call last):
homeassistant_app.1.x4d476o5470w@nuc01    |   File "/usr/src/homeassistant/homeassistant/config_entries.py", line 604, in async_setup
homeassistant_app.1.x4d476o5470w@nuc01    |     result = await component.async_setup_entry(hass, self)
homeassistant_app.1.x4d476o5470w@nuc01    |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
homeassistant_app.1.x4d476o5470w@nuc01    |   File "/config/custom_components/amplipi/__init__.py", line 33, in async_setup_entry
homeassistant_app.1.x4d476o5470w@nuc01    |     await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
homeassistant_app.1.x4d476o5470w@nuc01    |   File "/usr/src/homeassistant/homeassistant/config_entries.py", line 2085, in async_forward_entry_setups
homeassistant_app.1.x4d476o5470w@nuc01    |     await integration.async_get_platforms(platforms)
homeassistant_app.1.x4d476o5470w@nuc01    |   File "/usr/src/homeassistant/homeassistant/loader.py", line 1177, in async_get_platforms
homeassistant_app.1.x4d476o5470w@nuc01    |     import_future.result()
homeassistant_app.1.x4d476o5470w@nuc01    |   File "/usr/src/homeassistant/homeassistant/loader.py", line 1165, in async_get_platforms
homeassistant_app.1.x4d476o5470w@nuc01    |     platforms.update(self._load_platforms(platform_names))
homeassistant_app.1.x4d476o5470w@nuc01    |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
homeassistant_app.1.x4d476o5470w@nuc01    |   File "/usr/src/homeassistant/homeassistant/loader.py", line 1090, in _load_platforms
homeassistant_app.1.x4d476o5470w@nuc01    |     platform_name: self._load_platform(platform_name)
homeassistant_app.1.x4d476o5470w@nuc01    |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
homeassistant_app.1.x4d476o5470w@nuc01    |   File "/usr/src/homeassistant/homeassistant/loader.py", line 1264, in _load_platform
homeassistant_app.1.x4d476o5470w@nuc01    |     cache[full_name] = self._import_platform(platform_name)
homeassistant_app.1.x4d476o5470w@nuc01    |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
homeassistant_app.1.x4d476o5470w@nuc01    |   File "/usr/src/homeassistant/homeassistant/loader.py", line 1296, in _import_platform
homeassistant_app.1.x4d476o5470w@nuc01    |     return importlib.import_module(f"{self.pkg_path}.{platform_name}")
homeassistant_app.1.x4d476o5470w@nuc01    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
homeassistant_app.1.x4d476o5470w@nuc01    |   File "/usr/src/homeassistant/homeassistant/util/loop.py", line 200, in protected_loop_func
homeassistant_app.1.x4d476o5470w@nuc01    |     return func(*args, **kwargs)
homeassistant_app.1.x4d476o5470w@nuc01    |            ^^^^^^^^^^^^^^^^^^^^^
homeassistant_app.1.x4d476o5470w@nuc01    |   File "/usr/local/lib/python3.12/importlib/__init__.py", line 90, in import_module
homeassistant_app.1.x4d476o5470w@nuc01    |     return _bootstrap._gcd_import(name[level:], package, level)
homeassistant_app.1.x4d476o5470w@nuc01    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
homeassistant_app.1.x4d476o5470w@nuc01    |   File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
homeassistant_app.1.x4d476o5470w@nuc01    |   File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
homeassistant_app.1.x4d476o5470w@nuc01    |   File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
homeassistant_app.1.x4d476o5470w@nuc01    |   File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
homeassistant_app.1.x4d476o5470w@nuc01    |   File "<frozen importlib._bootstrap_external>", line 995, in exec_module
homeassistant_app.1.x4d476o5470w@nuc01    |   File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
homeassistant_app.1.x4d476o5470w@nuc01    |   File "/config/custom_components/amplipi/media_player.py", line 20, in <module>
homeassistant_app.1.x4d476o5470w@nuc01    |     from pyamplipi.models import ZoneUpdate, Source, SourceUpdate, GroupUpdate, Stream, Group, Zone, Announcement, \
homeassistant_app.1.x4d476o5470w@nuc01    | ImportError: cannot import name 'PlayMedia' from 'pyamplipi.models' (/usr/local/lib/python3.12/site-packages/pyamplipi/models.py)
homeassistant_app.1.x4d476o5470w@nuc01    | 2024-08-10 21:56:32.260 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry AmpliPi for amplipi
homeassistant_app.1.x4d476o5470w@nuc01    | Traceback (most recent call last):
homeassistant_app.1.x4d476o5470w@nuc01    |   File "/usr/src/homeassistant/homeassistant/config_entries.py", line 604, in async_setup
homeassistant_app.1.x4d476o5470w@nuc01    |     result = await component.async_setup_entry(hass, self)
homeassistant_app.1.x4d476o5470w@nuc01    |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
homeassistant_app.1.x4d476o5470w@nuc01    |   File "/config/custom_components/amplipi/__init__.py", line 33, in async_setup_entry
homeassistant_app.1.x4d476o5470w@nuc01    |     await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
homeassistant_app.1.x4d476o5470w@nuc01    |   File "/usr/src/homeassistant/homeassistant/config_entries.py", line 2085, in async_forward_entry_setups
homeassistant_app.1.x4d476o5470w@nuc01    |     await integration.async_get_platforms(platforms)
homeassistant_app.1.x4d476o5470w@nuc01    |   File "/usr/src/homeassistant/homeassistant/loader.py", line 1177, in async_get_platforms
homeassistant_app.1.x4d476o5470w@nuc01    |     import_future.result()
homeassistant_app.1.x4d476o5470w@nuc01    |   File "/usr/src/homeassistant/homeassistant/loader.py", line 1165, in async_get_platforms
homeassistant_app.1.x4d476o5470w@nuc01    |     platforms.update(self._load_platforms(platform_names))
homeassistant_app.1.x4d476o5470w@nuc01    |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
homeassistant_app.1.x4d476o5470w@nuc01    |   File "/usr/src/homeassistant/homeassistant/loader.py", line 1090, in _load_platforms
homeassistant_app.1.x4d476o5470w@nuc01    |     platform_name: self._load_platform(platform_name)
homeassistant_app.1.x4d476o5470w@nuc01    |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
homeassistant_app.1.x4d476o5470w@nuc01    |   File "/usr/src/homeassistant/homeassistant/loader.py", line 1264, in _load_platform
homeassistant_app.1.x4d476o5470w@nuc01    |     cache[full_name] = self._import_platform(platform_name)
homeassistant_app.1.x4d476o5470w@nuc01    |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
homeassistant_app.1.x4d476o5470w@nuc01    |   File "/usr/src/homeassistant/homeassistant/loader.py", line 1296, in _import_platform
homeassistant_app.1.x4d476o5470w@nuc01    |     return importlib.import_module(f"{self.pkg_path}.{platform_name}")
homeassistant_app.1.x4d476o5470w@nuc01    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
homeassistant_app.1.x4d476o5470w@nuc01    |   File "/usr/src/homeassistant/homeassistant/util/loop.py", line 200, in protected_loop_func
homeassistant_app.1.x4d476o5470w@nuc01    |     return func(*args, **kwargs)
homeassistant_app.1.x4d476o5470w@nuc01    |            ^^^^^^^^^^^^^^^^^^^^^
homeassistant_app.1.x4d476o5470w@nuc01    |   File "/usr/local/lib/python3.12/importlib/__init__.py", line 90, in import_module
homeassistant_app.1.x4d476o5470w@nuc01    |     return _bootstrap._gcd_import(name[level:], package, level)
homeassistant_app.1.x4d476o5470w@nuc01    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
homeassistant_app.1.x4d476o5470w@nuc01    |   File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
homeassistant_app.1.x4d476o5470w@nuc01    |   File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
homeassistant_app.1.x4d476o5470w@nuc01    |   File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
homeassistant_app.1.x4d476o5470w@nuc01    |   File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
homeassistant_app.1.x4d476o5470w@nuc01    |   File "<frozen importlib._bootstrap_external>", line 995, in exec_module
homeassistant_app.1.x4d476o5470w@nuc01    |   File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
homeassistant_app.1.x4d476o5470w@nuc01    |   File "/config/custom_components/amplipi/media_player.py", line 20, in <module>
homeassistant_app.1.x4d476o5470w@nuc01    |     from pyamplipi.models import ZoneUpdate, Source, SourceUpdate, GroupUpdate, Stream, Group, Zone, Announcement, \
homeassistant_app.1.x4d476o5470w@nuc01    | ImportError: cannot import name 'PlayMedia' from 'pyamplipi.models' (/usr/local/lib/python3.12/site-packages/pyamplipi/models.py)

Hey @sumnerboy -

Could you try to install this integration once again? I just merged a fix for this; the latest version should have commit id f671269.

The root cause was an unpinned version of pyamplipi in our fork from development and folks upgrading from the prior version of the install, which is also why we didn’t catch it in house - we were working from a fresh install which pulled the latest pyamplipi. We’re definitely taking that as a lesson learned.

Yep seems to be working now - can see the “Announcement” media player :slight_smile:

The source list change from the original extension is not useful.

Previously each zone had a source list:

  • Source 1
  • Source 2
  • Source 3
  • Source 4

Now the source list looks something like:

  • Source 1 - LmS 1 - lms

This looks good when you are clicking the interface and using it that way, but what happens when you use automations, now instead of “Source 1” you have an unknown number of permutations for whatever label may get added to “Source 1”.

The primary intent with Home Assistant is automation, not as an interface to click on, I would suggest that this change needs to be rethought as automations are significantly more difficult now.

Would be nice to have the Groups be interactive as well, like be able to select source and turn them on/off.

Has anyone got a working method for using the announcement channel for their doorbell?

Has anyone figured out a better way to configure some automations or triggers to make this work better in HomeKit? My initial thought would be hoping to go into each room I have in HomeKit and select a source and then turn the speakers on/control volume.

Hey all, question for you guys – I was hoping to use the new and improved announcement section to send audio when the garage door or other doors open around the house…my only thing is I would like only certain groups of the house to make this announcement…like I wouldn’t want the bedrooms to receive these announcements. Is that possible to take a few of the speakers out of the announcement channel? Or at least mute them during certain times or something?

Thanks all for talking it through with me!

Hey @matchmee, I recently did something similar to announce specific things to specific rooms. This is completely separate from the HACS integration and solely integrating with the AmpliPi’s API:

Service:

# Example usage: 
#   service: script.amplipi_announce_tts
#   data:
#     message: "This is a message"
#     volume: "0.5"
#     where: family_room
amplipi_announce_tts:
  sequence:
      - service: rest_command.create_tts
        data:
          message: "{{ message }}"
        response_variable: create_tts_response
      - if: "{{ create_tts_response['status'] == 200 }}"
        then:
          - alias: "Parse data"
            variables:
              url_variable: "{{ create_tts_response['content']['url'] }}"
          - service: rest_command.amplipi_announce_url
            data:
              url: "{{ url_variable }}"
              volume: "{{ volume if volume is defined else 0.6 }}"
              where: "{{ where }}" 
          # Intentionally set a 5 second delay to give AmpliPi a moment
          - delay: "00:00:02"

This essentially uses Home Assistant’s TTS then feeds it into a custom rest_command below to send it to a specific “zone” or the whole home:

amplipi_announce_url:
    url: !secret amplipi_announce_url
    method: post
    payload: > 
          {% if where == 'family_room' %}
            { "media" : "{{ url }}" , "vol_f" : "{{ volume }}", "zones" : [0]}
          {% elif where == 'office' %}
            { "media" : "{{ url }}" , "vol_f" : "{{ volume }}", "zones" : [1]}
          {% elif where == 'master_bedroom' %}
            { "media" : "{{ url }}" , "vol_f" : "{{ volume }}", "zones" : [2]}
          {% elif where == 'porch' %}
            { "media" : "{{ url }}" , "vol_f" : "{{ volume }}", "zones" : [3]}
          {% elif where == 'kitchen' %}
            { "media" : "{{ url }}" , "vol_f" : "{{ volume }}", "zones" : [4]}
          {% else %}
            { "media" : "{{ url }}" , "vol_f" : "{{ volume }}", "groups" : [102]}
          {% endif %}
    headers:
      content-type: 'application/json'
    verify_ssl: false

Was hoping to do some sort of walk through with this on youtube or something. Have been getting a tad fancier with some automations and AmpliPi lately.

That’s awesome! I finally got something similar to work with playing different audio files for when doors open or the doorbell is pressed- are you creating the custom messages or sending the same ones every time? I think this would be cool with asking Siri or Google to “say ‘what do you want for dinner’ in the kitchen.” Much like the intercom feature both have on their devices. Could be cool!

I ended up making one service that I can dynamically send any text and the TTS creates a URL for amplipi to reference and play.

Then another service that has a list of audio files I put on the AmpliPi manually that it can reference.

Hi all,

I would like to try the amplipi HA integration. Installation went fine, however I cannot connect to the amplipi. In the logs I get the following error:

2024-11-22 10:26:10.982 ERROR (MainThread) [custom_components.amplipi.config_flow] Unexpected exception
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/pyamplipi/client.py", line 63, in _handle_error
    response_json = await response.json()
                    ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/aiohttp_client.py", line 80, in json
    return await super().json(*args, loads=loads, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/client_reqrep.py", line 1199, in json
    raise ContentTypeError(
aiohttp.client_exceptions.ContentTypeError: 401, message='Attempt to decode JSON with unexpected mimetype: text/html; charset=utf-8', url='http://192.168.123.140/api/'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/config/custom_components/amplipi/config_flow.py", line 107, in async_step_user_confirm
    await async_retrieve_info(self.hass, user_input[CONF_HOST], user_input[CONF_PORT])
  File "/config/custom_components/amplipi/config_flow.py", line 37, in async_retrieve_info
    return await client.get_status()
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/pyamplipi/amplipi.py", line 29, in get_status
    response = await self._client.get('')
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/pyamplipi/client.py", line 168, in get
    return await self._process_response(response)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/pyamplipi/client.py", line 94, in _process_response
    await self._handle_error(response)
  File "/usr/local/lib/python3.12/site-packages/pyamplipi/client.py", line 65, in _handle_error
    raise AccessDeniedError(response.url)
pyamplipi.error.AccessDeniedError: Access denied for resource http://192.168.123.140/api/
2024-11-22 10:27:35.325 WARNING (MainThread) [xknx.log] Error: KNX bus did not respond in time (2.0 secs) to GroupValueRead request for: 1/0/39

Since I have set a password this error is fine, however where can I put the access key to be able to use the integration?

thx

At the moment hacs_amplipi does not support using a password protected interface. To make this work some modifications need to be made to both pyamplipi and hacs_amplipi. I’ll talk to some of the other developers and see what needs to be changed.

In the meantime if you want this working quickly, I would recommend temporarily removing the password from the amplipi api.