Rotel RSP-1570 Surround Sound processor - Remote control

I’ll look into it. It looks as though all I need to do is create a repository that conforms to the required structure and mine isn’t far off anyway. It’s not immediately clear to me from the docs how I actually get it added into HACS but I can cross that bridge when I come to it. Maybe I’ll start by downloading it as a user to see how I get on.

At the moment I’m working on having it added as an official component. They have suggested a bunch of changes and I haven’t had time to implement them yet but I’m keen to get it integrated. I’m assuming that would be preferable to HACS?

Sharing my Lovelace card for the Rotel RSP-1570, for others with this unit:
image

cards:
  - elements:
      - content: |-
          <font color= white>
          {% if is_state('media_player.rotel_rsp_1570', 'on') %} {{
          state_attr('media_player.rotel_rsp_1570', 'source') }}  {% if
          state_attr('media_player.rotel_rsp_1570', 'is_volume_muted') == false
          %}VOLUME: {{ state_attr('media_player.rotel_rsp_1570', 'volume')
          }}

          {% else %}     MUTE ON

          {% endif %}{{state_attr('media_player.rotel_rsp_1570', 'info') }} {%
          if is_state('binary_sensor.rsp1570_input_hdmi', 'on')   %}HDMI{% endif
          %}{% if is_state('binary_sensor.rsp1570_input_coaxial', 'on')
          %}Coaxial{% endif %} {% if
          is_state('binary_sensor.rsp1570_input_optical', 'on') %}Optical{%
          endif %} {% if is_state('binary_sensor.rsp1570_input_analog', 'on')
          %}Analog{% endif %} {% endif %}</font>
        style:
          '--ha-card-background': var(--my-card-background)
          left: 40%
          top: 45%
        type: 'custom:hui-markdown-card'
      - entity: binary_sensor.rsp1570_speaker_front_left
        style:
          left: 3%
          top: 25%
        type: state-icon
      - entity: binary_sensor.rsp1570_speaker_center
        style:
          left: 8%
          top: 25%
        type: state-icon
      - entity: binary_sensor.rsp1570_speaker_front_right
        style:
          left: 13%
          top: 25%
        type: state-icon
      - entity: binary_sensor.rsp1570_speaker_surround_left
        style:
          left: 3%
          top: 75%
        type: state-icon
      - entity: binary_sensor.rsp1570_speaker_surround_right
        style:
          left: 13%
          top: 75%
        type: state-icon
    image: /local/lovelace-ui/RSP-1570_Display.png
    style: |
      ha-card {
      --ha-card-background: black;
      --my-card-background: black
      }
    type: picture-elements
  - entity: media_player.rotel_rsp_1570
    hide:
      controls: true
      power_state: false
      source: true
    icon: 'mdi:audio-video'
    max_volume: 80
    shortcuts:
      buttons:
        - data:
            command_name: SOURCE_VIDEO_3
            entity_id: media_player.rotel_rsp_1570
          id: media_player.rotel_send_command
          name: TV
          type: service
        - data:
            command_name: SOURCE_VIDEO_2
            entity_id: media_player.rotel_rsp_1570
          icon: 'mdi:playstation'
          id: media_player.rotel_send_command
          name: PS4
          type: service
        - data:
            command_name: SOURCE_CD
            entity_id: media_player.rotel_rsp_1570
          id: media_player.rotel_send_command
          name: Music/Radio
          type: service
      columns: 3
    style: |
      ha-card {
        --ha-card-background: #D8DDE0
      }
    type: 'custom:mini-media-player'
  - entities:
      - entities:
          - cards:
              - cards:
                  - cards:
                      - color: var(--my-rotel-btn-color)
                        color_type: card
                        icon: 'mdi:diameter-outline'
                        styles:
                          card:
                            - width: 50px
                            - height: 50px
                            - border-radius: 50px
                          icon:
                            - color: var(--my-rotel-icon-color)
                        tap_action:
                          action: call-service
                          service: media_player.rotel_reconnect
                          service_data:
                            entity_id: media_player.rotel_rsp_1570
                        type: 'custom:button-card'
                      - color: var(--my-rotel-btn-color)
                        color_type: card
                        icon: 'mdi:volume-plus'
                        styles:
                          card:
                            - width: 50px
                            - height: 50px
                            - border-radius: 50px
                          icon:
                            - color: var(--my-rotel-icon-color)
                        tap_action:
                          action: call-service
                          service: media_player.rotel_send_command
                          service_data:
                            command_name: VOLUME_UP
                            entity_id: media_player.rotel_rsp_1570
                        type: 'custom:button-card'
                      - color: var(--my-rotel-btn-color)
                        color_type: card
                        icon: 'mdi:arrow-split-horizontal'
                        styles:
                          card:
                            - width: 50px
                            - height: 50px
                            - border-radius: 50px
                          icon:
                            - color: var(--my-rotel-icon-color)
                        tap_action:
                          action: call-service
                          service: media_player.rotel_send_command
                          service_data:
                            command_name: STEREO___BYPASS_TOGGLE
                            entity_id: media_player.rotel_rsp_1570
                        type: 'custom:button-card'
                      - color: var(--my-rotel-btn-color)
                        color_type: card
                        icon: 'mdi:arrow-up-drop-circle-outline'
                        styles:
                          card:
                            - width: 50px
                            - height: 50px
                            - border-radius: 50px
                          icon:
                            - color: var(--my-rotel-icon-color)
                        tap_action:
                          action: service
                          service: media_player.rotel_send_command
                          service_data:
                            command_name: TREBLE_UP
                            entity_id: media_player.rotel_rsp_1570
                        type: 'custom:button-card'
                      - color: var(--my-rotel-btn-color)
                        color_type: card
                        icon: 'mdi:arrow-up-drop-circle'
                        styles:
                          card:
                            - width: 50px
                            - height: 50px
                            - border-radius: 50px
                          icon:
                            - color: var(--my-rotel-icon-color)
                        tap_action:
                          action: call-service
                          service: media_player.rotel_send_command
                          service_data:
                            command_name: BASS_UP
                            entity_id: media_player.rotel_rsp_1570
                        type: 'custom:button-card'
                    type: horizontal-stack
                  - cards:
                      - color_type: blank-card
                        styles:
                          card:
                            - width: 50px
                            - height: 50px
                            - box-shadow: none
                            - background: none
                        type: 'custom:button-card'
                      - color: var(--my-rotel-btn-color)
                        color_type: card
                        icon: 'mdi:volume-minus'
                        styles:
                          card:
                            - width: 50px
                            - height: 50px
                            - border-radius: 50px
                          icon:
                            - color: var(--my-rotel-icon-color)
                        tap_action:
                          action: call-service
                          service: media_player.rotel_send_command
                          service_data:
                            command_name: VOLUME_DOWN
                            entity_id: media_player.rotel_rsp_1570
                        type: 'custom:button-card'
                      - color: var(--my-rotel-btn-color)
                        color_type: card
                        icon: 'mdi:glass-cocktail'
                        styles:
                          card:
                            - width: 50px
                            - height: 50px
                            - border-radius: 50px
                          icon:
                            - color: var(--my-rotel-icon-color)
                        tap_action:
                          action: call-service
                          service: media_player.rotel_send_command
                          service_data:
                            command_name: PARTY_MODE_TOGGLE
                            entity_id: media_player.rotel_rsp_1570
                        type: 'custom:button-card'
                      - color: var(--my-rotel-btn-color)
                        color_type: card
                        icon: 'mdi:arrow-down-drop-circle-outline'
                        styles:
                          card:
                            - width: 50px
                            - height: 50px
                            - border-radius: 50px
                          icon:
                            - color: var(--my-rotel-icon-color)
                        tap_action:
                          action: call-service
                          service: media_player.rotel_send_command
                          service_data:
                            command_name: TREBLE_DOWN
                            entity_id: media_player.rotel_rsp_1570
                        type: 'custom:button-card'
                      - color: var(--my-rotel-btn-color)
                        color_type: card
                        icon: 'mdi:arrow-down-drop-circle'
                        styles:
                          card:
                            - width: 50px
                            - height: 50px
                            - border-radius: 50px
                          icon:
                            - color: var(--my-rotel-icon-color)
                        tap_action:
                          action: call-service
                          service: media_player.rotel_send_command
                          service_data:
                            command_name: BASS_DOWN
                            entity_id: media_player.rotel_rsp_1570
                        type: 'custom:button-card'
                    type: horizontal-stack
                line_color: '#FF6383'
                line_width: 8
                name: My buttons
                type: vertical-stack
              - cards:
                  - cards:
                      - color: var(--my-rotel-btn-color)
                        color_type: card
                        icon: 'mdi:menu-open'
                        name: OSD
                        styles:
                          card:
                            - width: 50px
                            - height: 50px
                            - border-radius: 50px
                          icon:
                            - color: var(--my-rotel-icon-color)
                          name:
                            - color: var(--my-rotel-icon-color)
                        tap_action:
                          action: call-service
                          service: media_player.rotel_send_command
                          service_data:
                            command_name: OSD_MENU
                            entity_id: media_player.rotel_rsp_1570
                        type: 'custom:button-card'
                      - color: var(--my-rotel-btn-color)
                        color_type: emty-card
                        styles:
                          card:
                            - width: 50px
                            - height: 50px
                            - box-shadow: none
                            - background: none
                        type: 'custom:button-card'
                      - color: var(--my-rotel-btn-color)
                        color_type: card
                        icon: 'mdi:arrow-up-bold-outline'
                        styles:
                          card:
                            - width: 50px
                            - height: 50px
                          icon:
                            - color: var(--my-rotel-icon-color)
                        tap_action:
                          action: call-service
                          service: media_player.rotel_send_command
                          service_data:
                            command_name: ENTER
                            entity_id: media_player.rotel_rsp_1570
                        type: 'custom:button-card'
                      - color: var(--my-rotel-btn-color)
                        color_type: emty-card
                        styles:
                          card:
                            - width: 50px
                            - height: 50px
                            - box-shadow: none
                            - background: none
                        type: 'custom:button-card'
                    type: horizontal-stack
                  - cards:
                      - color: var(--my-rotel-btn-color)
                        color_type: emty-card
                        styles:
                          card:
                            - width: 50px
                            - height: 50px
                            - box-shadow: none
                            - background: none
                        type: 'custom:button-card'
                      - color: var(--my-rotel-btn-color)
                        color_type: card
                        icon: 'mdi:arrow-left-bold-outline'
                        styles:
                          card:
                            - width: 50px
                            - height: 50px
                          icon:
                            - color: var(--my-rotel-icon-color)
                        tap_action:
                          action: call-service
                          service: media_player.rotel_send_command
                          service_data:
                            command_name: CURSOR_LEFT
                            entity_id: media_player.rotel_rsp_1570
                        type: 'custom:button-card'
                      - color: var(--my-rotel-btn-color)
                        color_type: card
                        name: Enter
                        styles:
                          card:
                            - width: 50px
                            - height: 50px
                          name:
                            - color: var(--my-rotel-icon-color)
                        tap_action:
                          action: call-service
                          service: media_player.rotel_send_command
                          service_data:
                            command_name: ENTER
                            entity_id: media_player.rotel_rsp_1570
                        type: 'custom:button-card'
                      - color: var(--my-rotel-btn-color)
                        color_type: card
                        icon: 'mdi:arrow-right-bold-outline'
                        styles:
                          card:
                            - width: 50px
                            - height: 50px
                          icon:
                            - color: var(--my-rotel-icon-color)
                        tap_action:
                          action: call-service
                          service: media_player.rotel_send_command
                          service_data:
                            command_name: CURSOR_RIGHT
                            entity_id: media_player.rotel_rsp_1570
                        type: 'custom:button-card'
                    type: horizontal-stack
                  - cards:
                      - color: var(--my-rotel-btn-color)
                        color_type: emty-card
                        styles:
                          card:
                            - width: 50px
                            - height: 50px
                            - box-shadow: none
                            - background: none
                        type: 'custom:button-card'
                      - color: var(--my-rotel-btn-color)
                        color_type: emty-card
                        styles:
                          card:
                            - width: 50px
                            - height: 50px
                            - box-shadow: none
                            - background: none
                        type: 'custom:button-card'
                      - color: var(--my-rotel-btn-color)
                        color_type: card
                        icon: 'mdi:arrow-down-bold-outline'
                        styles:
                          card:
                            - width: 50px
                            - height: 50px
                          icon:
                            - color: var(--my-rotel-icon-color)
                        tap_action:
                          action: call-service
                          service: media_player.rotel_send_command
                          service_data:
                            command_name: ENTER
                            entity_id: media_player.rotel_rsp_1570
                        type: 'custom:button-card'
                      - color: null
                        color_type: emty-card
                        styles:
                          card:
                            - width: 50px
                            - height: 50px
                            - box-shadow: none
                            - background: none
                        type: 'custom:button-card'
                    type: horizontal-stack
                type: vertical-stack
            parameters:
              draggable: true
              hide: false
              pagination:
                type: bullets
              scrollbar: null
              snapOnRelease: true
              spaceBetween: 8
            path: /local/custom-lovelace/swipe-card
            type: 'custom:swipe-card'
        head:
          label: Sound settings
          type: section
        open: false
        type: 'custom:fold-entity-row'
    show_header_toggle: false
    style: |
      ha-card {
        --ha-card-background: #D8DDE0;
        --my-rotel-btn-color: #FFFCF7;
        --my-rotel-icon-color: black
      }
    type: entities
type: 'custom:vertical-stack-in-card'

Do you still use your excellent code? I do, but HA has way back started throwing warnings for a lot of parameters like

2021-06-21 13:09:46 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'None' has no attribute 'SW' when rendering '{{ state_attr('media_player.rotel_rsp_1570', 'speaker_icons').SW }}'

Any chance the code will be updated?

Hi,

Nice to hear from you again.

I don’t actively use the Rotel any more but I do still have it and I’d be happy to look into this. Just to manage expectations I probably won’t have a lot of time before the weekend though.

In the meantime, could you let me know what version of the library you have installed (pip show rsp1570serial-pp81381), the version of Python and the version of Home Assistant please?

I did actually do more work on the integration and the library and I definitely have a fully working version. I was hoping to submit it to be included in HA but they asked for a bunch of changes and once I’d done those they were insisting on config flow and I lost interest for a bit. I’ve half implemented config flow so maybe one day I’ll finish that off and submit it to HACS.

I have a nasty feeling that your HA has picked up new versions of the library as I was working on the above and I haven’t been careful enough with backward compatibility. If that’s the case then one answer would be to downgrade the library but I’d rather get you going on the latest version.

All the best!

Phil

P.S. Your Lovelace card above looks excellent!

You looking into it, its highly appreciated!

I had to write in a version number in the manifest.json-file for not getting an error message. If you decide to maintain this code, maybe get it into HACS so future changes is easily picked up by the users.

Here is my system:

version: core-2021.6.6
installation_type: Home Assistant OS
dev: false
hassio: true
docker: true
virtualenv: false
python_version: 3.8.9
os_name: Linux
os_version: 5.10.17-v7
arch: armv7l

host_os: Home Assistant OS 6.0
update_channel: stable
supervisor_version: supervisor-2021.06.3
docker_version: 20.10.6
disk_total: 116.5 GB
disk_used: 9.3 GB
healthy: true
supported: true
board: rpi3
supervisor_api: ok
version_api: ok

OK, great. You’re on Python 3.8 which is what I’ve been using for all of my most recent development. Plus the latest HA which makes life easier too.

You didn’t mention which version of rsp1570serial-pp81381 is in your manifest.json file? Is it 0.1.1?

Also, can I assume that the version of media_player.py that you have is consistent with the version in my hassdev repository?

Re HACS. I’m working on another project and I’ve been trying to make it HACS compliant. If that is successful (so far so good) then I’ll definitely do the same for this one.

My installed sp1570serial-pp81381 manifest.json` file did not have an version entry att all (so I just vrote in “version”: “v0.0.0”,), donwloaded from hassdev/dothomeassistant/custom_components/rotel_rsp1570 at master · pp81381/hassdev · GitHub
The media_player.py is also from this package

Ah, I see what you mean. At some point HA insisted on a version for the custom component itself in the manifest so you added one. I was actually asking about the requirements entry in the manifest but I’m pretty sure that you’ll be using 0.1.1.

FYI, I had a quick look this evening and have been able to get a test environment up and running and recreate the problem you describe above. If I’m right then those warnings occur when the Amp is turned off but the states work OK when the Amp is on?

I hopefully have time to spend a bit more time on this at the weekend and merge the latest changes into the hassdev repository. It should be easy but I’ll probably need to remove the config flow stuff for now as it is quite experimental.

Just to warn you, I renamed the “domain” from rotel_rsp1570 to just rotel on the recommendation of the HA devs. That will mean that you’ll need to make some changes to your config files with the new version. I’ll explain when I push out the new version.

I have checked in some updates that might help. At a minimum you need to update manifest.json and media_player.py but I’d just overwrite the whole thing.

Hopefully, all you will need to do to make it work is add a unique_id attribute into the configuration.yaml entry for the amplifier. I have tried to make the new version as back-compatible as possible so I’m hoping that you won’t need to change the state names in any of your other entities. If dependencies stop working then take a look at the state names in the HA Developer tab to see whether they have changed and let me know.

The update should fix the warnings from the display icons when the amp is turned off. It is quite likely to fix them at startup too but there is still a risk that your sensors initialise after the Rotel component and you still get one set of warnings. I have an idea to fix this but it will require changing all of the icon state names so I thought that I would put this version out first to see how you get on.

Note that some states can still come through as None by design. For example, something like display_volume. If you are still getting warnings that you don’t like then try using the template extensions like states() and is_state() documented here.

(Note also that the display icons won’t currently work with the template extensions. The fix I mention above would solve that but for now I do my best to make sure that they are never None.)

Please let me know how it goes!

I have updated the files and restarted HA twice, with the Rotel off and then on.
Both times no error or warnings occurred, and at first glance all works fine. Really appreciate your work.

Cheers!

@pp81381 Sorry for bother you again with this integration.
Any change you can take a look at this error after updating to Home Assistant 2023.9.1

2023-09-09 10:02:57.421 ERROR (MainThread) [homeassistant.components.media_player] Error adding entities for domain media_player with platform rotel_rsp1570
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/serial/urlhandler/protocol_socket.py", line 63, in open
self._socket = socket.create_connection(self.from_url(self.portstr), timeout=POLL_TIMEOUT)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/socket.py", line 851, in create_connection
raise exceptions[0]
File "/usr/local/lib/python3.11/socket.py", line 836, in create_connection
sock.connect(sa)
ConnectionResetError: [Errno 104] Connection reset by peer
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 507, in async_add_entities
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 752, in _async_add_entity
await entity.add_to_platform_finish()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1001, in add_to_platform_finish
await self.async_added_to_hass()
File "/config/custom_components/rotel_rsp1570/media_player.py", line 260, in async_added_to_hass
await self.open_connection()
File "/config/custom_components/rotel_rsp1570/media_player.py", line 281, in open_connection
await conn.open()
File "/usr/local/lib/python3.11/site-packages/rsp1570serial/connection.py", line 29, in open
self.reader, self.writer = await open_serial_connection(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/serial_asyncio/__init__.py", line 504, in open_serial_connection
transport, _ = await create_serial_connection(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/serial_asyncio/__init__.py", line 448, in create_serial_connection
serial_instance = serial.serial_for_url(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/serial/__init__.py", line 90, in serial_for_url
instance.open()
File "/usr/local/lib/python3.11/site-packages/serial/urlhandler/protocol_socket.py", line 66, in open
raise SerialException("Could not open port {}: {}".format(self.portstr, msg))
serial.serialutil.SerialException: Could not open port socket://192.168.0.3:50000: [Errno 104] Connection reset by peer
2023-09-09 10:02:57.539 ERROR (MainThread) [homeassistant.components.media_player] Error while setting up rotel_rsp1570 platform for media_player
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/serial/urlhandler/protocol_socket.py", line 63, in open
self._socket = socket.create_connection(self.from_url(self.portstr), timeout=POLL_TIMEOUT)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/socket.py", line 851, in create_connection
raise exceptions[0]
File "/usr/local/lib/python3.11/socket.py", line 836, in create_connection
sock.connect(sa)
ConnectionResetError: [Errno 104] Connection reset by peer
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 367, in _async_setup_platform
await asyncio.gather(*pending)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 507, in async_add_entities
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 752, in _async_add_entity
await entity.add_to_platform_finish()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1001, in add_to_platform_finish
await self.async_added_to_hass()
File "/config/custom_components/rotel_rsp1570/media_player.py", line 260, in async_added_to_hass
await self.open_connection()
File "/config/custom_components/rotel_rsp1570/media_player.py", line 281, in open_connection
await conn.open()
File "/usr/local/lib/python3.11/site-packages/rsp1570serial/connection.py", line 29, in open
self.reader, self.writer = await open_serial_connection(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/serial_asyncio/__init__.py", line 504, in open_serial_connection
transport, _ = await create_serial_connection(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/serial_asyncio/__init__.py", line 448, in create_serial_connection
serial_instance = serial.serial_for_url(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/serial/__init__.py", line 90, in serial_for_url
instance.open()
File "/usr/local/lib/python3.11/site-packages/serial/urlhandler/protocol_socket.py", line 66, in open
raise SerialException("Could not open port {}: {}".format(self.portstr, msg))
serial.serialutil.SerialException: Could not open port socket://192.168.0.3:50000: [Errno 104] Connection reset by peer

Hi - hope all goes well!

I’ll try to reproduce it. Apologies but it might not be instant because I will need to update HA and connect it up to the Rotel again. It may need to wait until next weekend.

Are you sure that it is a problem with the custom component though? The message is about connectivity:

Could not open port socket://192.168.0.3:50000: [Errno 104] Connection reset by peer

Do you have an IP to serial converter connected to your Rotel? Might the issue be something to do with that? Could it have been allocated a new IP address perhaps?

I’ll have a look at the component anyway. It might benefit from newer versions of dependencies etc.

As long as my old Rotel is alive, I’ll be a happy camper :blush:
Yes, I have a serial converter plugged into the Rotel. I’ll check it out.

No worries. After several restarts of HA in looks like it up and working again. :+1:

Ah, that’s great. Enjoy!

Hi @pp81381, i’m also using your custom component and it was working like a charm. :smiley:

Unfortunately there was an change in core-2023.11.0 which i think did break the serial communication. :frowning:

Refactor frame.get_integration_frame (@emontnemery - #101322)

I now see the following error in the log:

2023-11-12 10:15:20.709 ERROR (MainThread) [homeassistant] Error doing job: Exception in callback SerialTransport._call_connection_lost(None) 
Traceback (most recent call last): 
File "/usr/src/homeassistant/homeassistant/util/async_.py", line 119, in check_loop 
integration_frame = get_integration_frame() 
                    ^^^^^^^^^^^^^^^^^^^^^^^ 
File "/usr/src/homeassistant/homeassistant/helpers/frame.py", line 61, in get_integration_frame 
raise MissingIntegrationFrame 
homeassistant.helpers.frame.MissingIntegrationFrame 

During handling of the above exception, another exception occurred: 

Traceback (most recent call last): 
File "/usr/local/lib/python3.11/asyncio/events.py", line 80, in _run 
self._context.run(self._callback, *self._args) 
File "/usr/local/lib/python3.11/site-packages/serial_asyncio/__init__.py", line 417, in _call_connection_lost 
self._serial.close() 
File "/usr/local/lib/python3.11/site-packages/serial/urlhandler/protocol_socket.py", line 104, in close 
time.sleep(0.3) 
File "/usr/src/homeassistant/homeassistant/util/async_.py", line 168, in protected_loop_func 
check_loop(func, strict=strict) 
File "/usr/src/homeassistant/homeassistant/util/async_.py", line 123, in check_loop 
raise RuntimeError(  # noqa: TRY200 

RuntimeError: Detected blocking call to sleep inside the event loop. Use `await hass.async_add_executor_job()`; This is causing stability issues. Please create a bug report at https://github.com/home-assistant/core/issues?q=is%3Aopen+is%3Aissue 

Do you have any idea how to fix that issue?

Many thanks!

I’ll take a look. I see this message in another of my integrations but it was only happening at shutdown of Home Assistant so I have been putting off looking at it. I’ll definitely update the Rotel integration at the same time.

Many thanks, if i can somehow help, just let me know.

Hi,

The problem was with the pyserial-asyncio package that the rsp1570serial-pp81381 library uses under the hood. Although someone has contributed a fix for the issue, they haven’t released it yet.

Fortunately, the people on the HA Discord server pointed me at pyserial-asyncio-fast. It is a plug for plug replacement and seems to be actively maintained. It is
used by a number of major HA components so I think that it is a good move to switch to it.

I’ve updated rsp1570serial-pp81381 accordingly and pushed out a new version (v0.1.8). I’ve also updated the manifest for the HA integration here to use it. If you have the latest version of the integration then in theory you just need to update your manifest file and restart HA. Otherwise, just copy the whole folder. (Take a backup first.)

I’ve done quite a lot of testing but unfortunately I don’t have my Rotel set up at the moment so I used the emulator for testing. It has served me well in the past but there’s a risk that it doesn’t behave exactly the same as the real thing. Let me know if you have any problems.

1 Like

Hi,

i’ve tested it on my Rotel and it works again perfectly.
Many thanks for fixing that so quickly.

Now my Rotel is under perfect control again. :smiley:

1 Like