Xantech / Dayton Audio / Sonance multi-zone amps

anybody else have this problem after upgrading to HA 2024.6 ?

Logger: homeassistant.config
Source: config.py:1440
First occurred: 11 June 2024 at 22:40:04 (1 occurrences)
Last logged: 11 June 2024 at 22:40:04

Platform error: media_player - cannot import name 'SerialException' from 'serial' (/usr/local/lib/python3.12/site-packages/serial/__init__.py)
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config.py", line 1440, in _async_load_and_validate_platform_integration
    platform = await p_integration.integration.async_get_platform(domain)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1085, in async_get_platform
    platforms = await self.async_get_platforms((platform_name,))
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1162, in async_get_platforms
    import_future.result()
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1150, in async_get_platforms
    platforms.update(self._load_platforms(platform_names))
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1075, in _load_platforms
    platform_name: self._load_platform(platform_name)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1249, in _load_platform
    cache[full_name] = self._import_platform(platform_name)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1281, in _import_platform
    return importlib.import_module(f"{self.pkg_path}.{platform_name}")
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/util/loop.py", line 131, in protected_loop_func
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 995, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/config/custom_components/xantech/media_player.py", line 8, in <module>
    from serial import SerialException
ImportError: cannot import name 'SerialException' from 'serial' (/usr/local/lib/python3.12/site-packages/serial/__init__.py)

what I see that the serial package is really missing:

PyYAML-6.0.1.dist-info             packaging                          pyparsing
PyYAML.libs                        packaging-24.0.dist-info           pyparsing-3.1.2.dist-info
README.txt                         pathspec                           setuptools
_distutils_hack                    pathspec-0.12.1.dist-info          setuptools-69.5.1-py3.12.egg-info
_yaml                              pip                                yaml
awake                              pip-24.0-py3.12.egg-info           yamllint
awake-1.0-py3.12.egg-info          pkg_resources                      yamllint-1.35.1.dist-info
distutils-precedence.pth           pulsemixer-1.5.1.dist-info
➜  site-packages pip uninstall serial
WARNING: Skipping serial as it is not installed.
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
➜  site-packages pip uninstall pyserial
WARNING: Skipping pyserial as it is not installed.
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
➜  site-packages pip install pySerial                 
Looking in indexes: https://pypi.org/simple, https://wheels.home-assistant.io/musllinux-index/
Collecting pySerial
  Downloading https://wheels.home-assistant.io/musllinux-index/pyserial-3.5-py2.py3-none-any.whl.metadata (1.6 kB)
Downloading https://wheels.home-assistant.io/musllinux-index/pyserial-3.5-py2.py3-none-any.whl (90 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 90.6/90.6 kB 3.9 MB/s eta 0:00:00
Installing collected packages: pySerial
Successfully installed pySerial-3.5
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
➜  site-packages ls
PyYAML-6.0.1.dist-info             packaging-24.0.dist-info           pyserial-3.5.dist-info
PyYAML.libs                        pathspec                           serial
README.txt                         pathspec-0.12.1.dist-info          setuptools
_distutils_hack                    pip                                setuptools-69.5.1-py3.12.egg-info
_yaml                              pip-24.0-py3.12.egg-info           yaml
awake                              pkg_resources                      yamllint
awake-1.0-py3.12.egg-info          pulsemixer-1.5.1.dist-info         yamllint-1.35.1.dist-info
distutils-precedence.pth           pyparsing
packaging                          pyparsing-3.1.2.dist-info
➜  site-packages cd serial 
➜  serial ls
__init__.py     __pycache__     rs485.py        serialjava.py   serialutil.py   threaded        urlhandler
__main__.py     rfc2217.py      serialcli.py    serialposix.py  serialwin32.py  tools           win32.py

I tried reinstalling serial - it shows up but disappears after reboot…

After it is reinstalled, when I go to Developer Tools it still complains about missing “serial” and init.py

Configuration warnings
Platform error 'media_player' from integration 'xantech' - cannot import name 'SerialException' from 'serial' (/usr/local/lib/python3.12/site-packages/serial/__init__.py)

Anyone has an idea what happened?
For a while yesterday I had 2 USB SERIAL connected - one for DAYTON and one for Cambridge Audio CXA61. I have also installed CXA61 integration and forwarded another USB_to_serial (CXA61) to my VM running HA (on QNAP NAS).
After starting it the CXA61 integration did work but generated lags and only switching on was forwarded to CXA and it didn;t really react much.
After a restart or two both integrations broke and I started seeing the missing serial error.
I removed second serial (CXA61), made sure first serial is discovered as ttyUSB0 configured in xantech integration, restarted HA several times.
I even disconnected both serial and removed both integrations from config and made several restarts with no serials attached - no go.
I also rebooted QNAP host and also (software removed second serial (CXA61) passthrough and rebooted again with no serials attached,
Then rebooted with only xantech aserial attached.
no go.
no more ideas where to try…
Can anyobe help me solving this issue please?

Maybe this also has something to do with my problem?
I started seeing this in logs recently:

Logger: homeassistant.util.loop
Source: util/loop.py:84
First occurred: 04:57:11 (2 occurrences)
Last logged: 05:00:46

Detected blocking call to import_module inside the event loop by integration 'config' at homeassistant/components/config/core.py, line 38: res = await check_config.async_check_ha_config_file(request.app[KEY_HASS]) (offender: /usr/src/homeassistant/homeassistant/loader.py, line 1281: return importlib.import_module(f"{self.pkg_path}.{platform_name}")), please create a bug report at https://github.com/home-assistant/core/issues?q=is%3Aopen+is%3Aissue+label%3A%22integration%3A+config%22 Traceback (most recent call last): File "<frozen runpy>", line 198, in _run_module_as_main File "<frozen runpy>", line 88, in _run_code File "/usr/src/homeassistant/homeassistant/__main__.py", line 223, in <module> sys.exit(main()) File "/usr/src/homeassistant/homeassistant/__main__.py", line 209, in main exit_code = runner.run(runtime_conf) File "/usr/src/homeassistant/homeassistant/runner.py", line 190, in run return loop.run_until_complete(setup_and_run_hass(runtime_config)) File "/usr/local/lib/python3.12/asyncio/base_events.py", line 672, in run_until_complete self.run_forever() File "/usr/local/lib/python3.12/asyncio/base_events.py", line 639, in run_forever self._run_once() File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1988, in _run_once handle._run() File "/usr/local/lib/python3.12/asyncio/events.py", line 88, in _run self._context.run(self._callback, *self._args) File "/usr/local/lib/python3.12/site-packages/aiohttp/web_protocol.py", line 452, in _handle_request resp = await request_handler(request) File "/usr/local/lib/python3.12/site-packages/aiohttp/web_app.py", line 543, in _handle resp = await handler(request) File "/usr/local/lib/python3.12/site-packages/aiohttp/web_middlewares.py", line 114, in impl return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 92, in security_filter_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 83, in forwarded_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 26, in request_context_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 242, in auth_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/headers.py", line 32, in headers_middleware response = await handler(request) File "/usr/src/homeassistant/homeassistant/helpers/http.py", line 73, in handle result = await handler(request, **request.match_info) File "/usr/src/homeassistant/homeassistant/components/http/decorators.py", line 81, in with_admin return await func(self, request, *args, **kwargs) File "/usr/src/homeassistant/homeassistant/components/config/core.py", line 38, in post res = await check_config.async_check_ha_config_file(request.app[KEY_HASS])

Of course I introduced more problems by upgrading HA to 2024.6.2 when playing with integrations - now I have no clue what might have caused this issue…

EDIT:
I can confirm that reverting back from CORE 2024.6.2 to CORE 2024.6.1 brings back the integration and it is working fine.
So I can confirm, that at least in my situation it is latest CORE update 2024.6.2 that was to blame. Heads up.

EDIT2:
So it was not the HA CORE 2024.6.2 fault.
Looks like adding second usb-serial device to my HA has broke it.
I have just tried to readd CXA61 via second serial to the same HA host, and it started again.
Actually upgrading to 2024.6.2 resolved my issue this time (after disconnecting second serial).
Is there a way to have 2 integrations for 2 audio devices connected through serial-usb adapter?

Just a question … do you have the standard integration or mine (which includes bass/treble/balance controls). I have not upgraded yet precisely because I have a total custom where I have those controls. Just want to be sure it isn;t something I did.

Doesn’t look like it from the errors, just usb to serial error but you never know.

I have installed integrarion from HACS - the original version.
I will be upgrading to yours soon.

Mine is a total hack for the Dayton Audio device. It has been discussed and the author (rightly so) thinks bass/treble/balance should be in the core media player so that everyone can enjoy such things.

I just use personal version until that happens.

1 Like

Hi - I am trying to figure out how to configure/program the DAX88 with HA over our ethernet network, using an IP address as the “port”, but I’m not sure how to do so. I have HACS installed, and I was able to download the “Xantech/Dayton Audio/Sonance Multi-Zone Amp Control for Home Assistant” package.

I went into the “Terminal” and changed directory to the “config” folder, and then edited the configuration.yaml file to add the following code:

media_player:

platform: xantech
type: dax88
port: socket://192.168.1.242:443
zones:
11:
name: “Living Front”
12:
name: “Living Back”
13:
name: “Living Center”
14:
name: “Kitchen”
15:
name: “Master Bedroom”
16:
name: “Basement Porch”
17:
name: “Living Subwoofer”
18:
name: “ZONE8”
sources:
1:
name: “input1”
2:
name: “input2”
3:
name: “Input3”
4:
name: “Input4”
5:
name: “HDTV”
6:
name: “Sonos”
7:
name: “Input7”
8:
name: "Wi-Fi"

I can go to “Quick reload” under the “Settings” menu, and the yaml seems to load just fine (I don’t get any warnings). Then, I added the “Media Control” card to one of my Dashboards, but it only shows our Sonos (it was one of the options I had to pick under the “Entity” drop down menu when adding the card).

At this point, I’m not sure what to do to get a list of speaker sets, their volumes, and the power button to the right (I’m assuming this is the ability to wake/sleep each speaker set) like others are showing in this thread. I get the feeling that I need to change something and/or install a different media player, but I’m not sure which one, how to get it, or how to install.

Any help would be greatly appreciated.

I think I made some progress here with the programming of the configuration.yaml.

When using port “888” as suggested here: GitHub - rsnodgrass/hass-xantech: Xantech Multi-Zone Matrix Audio for Home Assistant

I get an error that the “zones” cannot load.

When checking for the communicating ports using nmap, I get the following list of “open” ports: 53, 80, 443, 8899, 49152.

When I change the “port” in the configuration.yaml file to one of those above, the system now seems to recognize each “zone”. Although, there is a “Failed updating” error during startup (and thereafter).

And if I try to click the speaker in the Entities settings to turn on one of the zones, I get another error that says “failed to call service” “unknown error”.

The error logs show the following:

At this point I’m completely stuck. Perhaps this is not compatible over our ethernet connection? Any help would be appreciated.

I have Dax88 Dayton that has 6 + 2 Zones. We are using the Ethernet port to communicate with it via its own app for now.
Does HA work with Ethernet port or we must use the Serial converter cable?
Thank you

Just got my Dax88 running using hass-xantech connected to a Rpi running ser2net. Dumping configs here in case anyone finds them useful. I got stuck for a while because I didn’t realize the Dax88 zone numbering starts at 11.

/etc/ser2net/ser2net.yaml on Raspberry Pi:

%YAML 1.1
---

connection: &dax88
    accepter: telnet,tcp,8888
    enable: on
    options:
      kickolduser: true
      telnet-brk-on-sync: true
    connector: serialdev,/dev/ttyUSB0,9600n81,local

admin: &dax88admin
  accepter: telnet,tcp,8889

Addition to HA configuration.yaml:

media_player:
  - platform: xantech
    type: dax88
    port: socket://<your-pi-ip-here>:8888/
    zones:
      11:
        name: "Side Room"
      12:
        name: "Kitchen"
      13:
        name: "Living Room"
    sources:
      1:
        name: "Mixer"
      8:
        name: "Wi-Fi"

This is also assuming a fixed IP for the Rpi… I feel like there has to be a way to reverse-engineer the Matrio app for direct network control, but rs232 is working for me so probably won’t investigate.

@mkgs - thanks for posting!

I installed the ser2net by running the command “apk add ser2net” in the terminal. I then created a directory “ser2net” and the file “ser2net.yaml” in that folder, and copy-pasted the code you provided above. Anything else I need to do to get the ser2net service running?

I also copy-pasted the HA information in the configuration.yaml file, except that I used the IP address 192.168.1.242 (which is the IP address for the DAX88 on our network).

On reboot, I get the following error:

When I change the port to “80” in each of the ser2net.yaml file (acceptor line) and the configuration.yaml file, HA seems to recognize the DAX88, but I’m still getting the errors per my prior post where it says “Failed updating Xantech Houes Audio”. Perhaps the ser2net is not working?

Is there something else you needed to do to get everything configured? I don’t think my DAX88 is currently listening on port 8888 - at least not on our network. Maybe this is the serial port that ser2net is supposed to bridge?

FYI - all the devices on our network are assigned a static IP address through our router.

You’re going to need a USB to serial RS232 cable, and either:

a) your HA machine connected directly to the Dax88 rs232 port. No ser2net needed. Your “port” in the configuration.yaml should be “/dev/ttyUSB0”. Or,

b) another machine, a Raspberry Pi in my case, connected to the Dax88 rs232 port. This machine needs to run ser2net. Your HA machine will essentially use this as a proxy to forward commands to the Dax88.

Been watching this thread as I wanted to replace my Aton DLA-6 (IR only, not returning states). Had an opportunity to grab an almost new Xantech MRAUDIO8X8 for 100$ so I’m in the process of adding the device to HA.

Here’s how far I got with the installation:

  • Unit lights up and doesn’t show any signs of failure
  • Connected a set of speakers in zone 1 + RCA source.
  • USB-Serial cable detected correctly/Connected to front serial port (also tried back port)

  • Installed HACS+repository

image

  • Installed Monoprice integration successfully (Do I have to? does a successful installation = working cable?) /dev/ttyUSB3 works as well.

Added YAML config

media_player:
  - platform: xantech
    type: xantech8
    port: /dev/ttyUSB3
    zones:
      11:
        name: "DECK"
      12:
        name: "SPA"
      13:
        name: "POOL"
      14:
        name: "GAZEBO"
    sources:
      1:
        name: "MEDIASERVER"

Entities get created:

but when I try to turn on:

I suspect the USB-Serial cable may be the root cause

https://www.aliexpress.com/item/1005003328051887.html

but before I order one of these (please share thoughts on which model to order):

https://www.amazon.ca/-/fr/gp/product/B0759HSLP1/
https://www.amazon.ca/gp/product/B0758B874Y

let me know if I am missing something obvious and/or if you have any troubleshoting ideas.

thank you!

Finally ordered the recommended cable:

https://www.amazon.ca/-/fr/gp/product/B0759HSLP1/

But still getting the same error messages.

I see a support note regarding the use of the DB15 port instead of DB9

"Some Xantech MX88 models only support RS232 control using the DB15 output on the rear. "

but this seems to be specific to the MX88 and I own a MRAUDIO8X8

back


front

Any assistance or troubleshooting tips would be greatly appreciated.

Thank you

Don’t know if it will solve your issue but I had a similar/same error so I changed the zones from 11, 12, 13… to 1, 2, 3…etc. It seemed to solve my issue, no idea why as it seems to works for others, might be worth a go to see if it helps ?

Thanks for your feedback,
I saw this recommendation somewhere in the threads so I did try it already. No success.
Just out of curiosity, which brand/model are you using? Also, did you have to install the Monoprice integration in parallel or just the HACS/Xantech custom integration along with the configuration.yaml parameters?
Last one: are you using the short/long port name ? Thx again.

I’m using the Xantech MRC88. I have not installed the Monoprice integration, only the Xantech one from HACS and the yaml configuration.
I’m controlling mine using a Global Cache IP2SL, using the following in my port config:
port: socket://192.168.1.xxx:4999

1 Like

Hi all. Thanks so for the xantech integration. I had no trouble connecting it to my DAX88 using the USB / Serial cable that came with the receiver.

One thing I’m hoping y’all can chime in on. The interaction with the device is quite slow / laggy. Changing the volume (for example) takes maybe half a second. I was expecting with a hard-wire like this there would be almost no delay.

Thanks for any observations.