core: Onkyo mediaplayer intergration generates errors

The problem

the logger generates errors:

UnboundLocalError: local variable ‘video_information_raw’ referenced before assignment

What is version of Home Assistant Core has the issue?

core-2021.3.4

What type of installation are you running?

Home Assistant Container

Integration causing the issue

onkyo

Link to integration documentation on our website

https://www.home-assistant.io/integrations/onkyo/

Anything in the logs that might be useful for us?

Logger: homeassistant.helpers.entity
Source: components/onkyo/media_player.py:346
First occurred: 22:28:25 (15 occurrences)
Last logged: 22:30:45

Update for media_player.tx_nr525_00xxb0xxx324 fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 277, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 473, in async_device_update
    raise exc
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/onkyo/media_player.py", line 346, in update
    self._parse_video_information(video_information_raw)
UnboundLocalError: local variable 'video_information_raw' referenced before assignment

commit #46228 has fixed #46130 but introduced this error

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 15 (2 by maintainers)

Most upvoted comments

Awesome! That seems to do the trick, thanks @mahk8! @quadhammer I did a bit different trick, and hopefully you can follow the same: Instead of modifying existing component, I copied the onkyo component to my config/custom_components/ directory. From: https://github.com/home-assistant/core/tree/dev/homeassistant/components/onkyo. And assigned values of empty list to audio_information_raw/video_information_raw values as suggested by @mahk8

After HA restart, it surely took the ‘custom’ component, the only disadvantage at this point is this warning: No 'version' key in the manifest file for custom integration 'onkyo'. As of Home Assistant 2021.6, this integration will no longer be loaded. Please report this to the maintainer of 'onkyo'

But I hope before 2021.6 is released, this workaround will not be needed. And if so… I suppose adding simple ‘version’ key to manifest file should do the trick as well. Hope that helps.

I have the same issue. Registering for notifications.

No need to reply to do that, you can just use the “subscribe” button on the right side ->

If you’ve created your own custom version and you’ve copied the original source directory then just add the following line to the manifest.json file. Insert the “version” key after the “name” key and make sure everything lines up.

"version": "0.0.0",

This should get rid of the “version key” nag and allows the custom integration to load.

Check the following link for explanation: https://developers.home-assistant.io/docs/creating_integration_manifest/#version

Until the author fixes this issue, you can get rid of those pesky error message by add the following to “/usr/src/homeassistant/homeassistant/components/onkyo/media_player.py” so to initialise the audio_information_raw and video_information_raw before it uses it.

Place it before line 314 in the file and line up the indentation. Should look something like…

        current_source_raw = self.command("input-selector query")
        audio_information_raw = []
        video_information_raw = []
`


I’m still not getting sources updating even with the latest build of Home Assistant.

Logger: homeassistant.components.media_player
Source: /usr/local/lib/python3.8/asyncio/events.py:81
Integration: Media player (documentation, issues)
First occurred: 1:59:46 PM (1 occurrences)
Last logged: 1:59:46 PM

Setup of media_player platform onkyo is taking over 10 seconds.
Logger: homeassistant.helpers.entity
Source: components/onkyo/media_player.py:346
First occurred: 2:00:01 PM (17 occurrences)
Last logged: 2:01:41 PM

Update for media_player.prepro fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 292, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 490, in async_device_update
    raise exc
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/onkyo/media_player.py", line 346, in update
    self._parse_audio_information(audio_information_raw)
UnboundLocalError: local variable 'audio_information_raw' referenced before assignment

System Health

version core-2021.4.4
installation_type Home Assistant OS
dev false
hassio true
docker true
virtualenv false
python_version 3.8.7
os_name Linux
os_version 5.4.109
arch x86_64
timezone Australia/Brisbane
Home Assistant Community Store
GitHub API ok
Github API Calls Remaining 4648
Installed Version 1.11.3
Stage running
Available Repositories 777
Installed Repositories 26
Home Assistant Cloud
logged_in false
can_reach_cert_server ok
can_reach_cloud_auth ok
can_reach_cloud ok
Home Assistant Supervisor
host_os Home Assistant OS 5.13
update_channel stable
supervisor_version supervisor-2021.03.9
docker_version 19.03.15
disk_total 30.8 GB
disk_used 9.4 GB
healthy true
supported true
board ova
supervisor_api ok
version_api ok
installed_addons Samba share (9.3.1), Mosquitto broker (5.1.1), Duck DNS (1.12.5), Node-RED (8.2.1), Dropbox Sync (1.3.0), ESPHome (1.16.2), Zigbee2mqtt (1.18.1-1), WireGuard (0.5.1), AdGuard Home (4.0.0), File editor (5.2.0), Network UPS Tools (0.6.2), Let’s Encrypt (4.11.0), Z-Wave JS to MQTT (0.11.0)
Lovelace
dashboards 2
resources 19
views 17
mode storage