demolud2
(Maciek)
July 6, 2024, 6:17pm
1
Hi,
it happened out of nowhere. I can’t even recall if there was any restart of HA - but I assume this must have triggered it.
I am using command line to control Onkyo receiver. Until recently I run a script which would turn on the receiver and dial radio station from TuneIn.
It stopper working. I get error:
[Errno 2] No such file or directory: onkyo
In logs I can see:
File "/usr/local/lib/python3.12/subprocess.py", line 1955, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'onkyo'
My command line is defined in configuration.yaml:
shell_command:
onkyo_command: onkyo --host {{ ip }} {{ cmd }}
when I check for onkyo via terminal I can see:
~ ls -l /usr/bin/on*
-rwxr-xr-x 1 root root 209 Jul 6 17:01 /usr/bin/onkyo
Would you have any idea how do I resolve this?
Regards,
Maciek
Hi there
I’m facing exactly the same issue. It worked for many years and suddenly stopped working since a few a days.
Errno 2] No such file or directory: ‘onkyo’
koying
(Chris B)
July 7, 2024, 11:14am
3
I guess this is due to that change:
home-assistant:dev
← arturpragacz:onkyo/async-push
opened 02:31PM - 20 Jun 24 UTC
## Proposed change
<!--
Describe the big picture of your changes here to com… municate to the
maintainers why we should accept this pull request. If it fixes a bug
or resolves a feature request, be sure to link to that issue in the
additional information section.
-->
Switch to library [pyeiscp](https://github.com/winterscar/python-eiscp/tree/master).
Convert the integration to local_push, making it tremendously more responsive.
### Background
Recently, while fixing bug #119949, I couldn't help but notice that Onkyo integration is in a really rough state.
I did some research and it turns out, that there have been numerous attempts to modernize it over the past several years (the last one being #59518), however they all fizzled out.
The major issue was that they tended to be too ambitious, trying to fix too many things at the same time.
This PR, while based on the previous efforts, tries to be more constrained in its approach, only switching out the library to a more modern one. Everything else should stay compatible and there should be no breaking changes introduced.
Given the scope of the changes required I decided to add myself to codeowners. If that is inappropriate, let me know.
## Type of change
<!--
What type of change does your PR introduce to Home Assistant?
NOTE: Please, check only 1! box!
If your PR requires multiple boxes to be checked, you'll most likely need to
split it into multiple PRs. This makes things easier and faster to code review.
-->
- [x] Dependency upgrade
- [ ] Bugfix (non-breaking change which fixes an issue)
- [ ] New integration (thank you!)
- [ ] New feature (which adds functionality to an existing integration)
- [ ] Deprecation (breaking change to happen in the future)
- [ ] Breaking change (fix/feature causing existing functionality to break)
- [ ] Code quality improvements to existing code or addition of tests
## Additional information
<!--
Details are important, and help maintainers processing your PR.
Please be sure to fill out additional details, if applicable.
-->
- This PR fixes or closes issue: fixes #
- This PR is related to issue:
- Link to documentation pull request:
## Checklist
<!--
Put an `x` in the boxes that apply. You can also fill these out after
creating the PR. If you're unsure about any of them, don't hesitate to ask.
We're here to help! This is simply a reminder of what we are going to look
for before merging your code.
-->
- [x] The code change is tested and works locally.
- [x] Local tests pass. **Your PR cannot be merged unless tests pass**
- [x] There is no commented out code in this PR.
- [x] I have followed the [development checklist][dev-checklist]
- [x] I have followed the [perfect PR recommendations][perfect-pr]
- [x] The code has been formatted using Ruff (`ruff format homeassistant tests`)
- [ ] Tests have been added to verify that the new code works.
If user exposed functionality or configuration variables are added/changed:
- [ ] Documentation added/updated for [www.home-assistant.io][docs-repository]
If the code communicates with devices, web services, or third-party tools:
- [x] The [manifest file][manifest-docs] has all fields filled out correctly.
Updated and included derived files by running: `python3 -m script.hassfest`.
- [x] New or updated dependencies have been added to `requirements_all.txt`.
Updated by running `python3 -m script.gen_requirements_all`.
- [ ] For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.
- [ ] Untested files have been added to `.coveragerc`.
<!--
This project is very active and we have a high turnover of pull requests.
Unfortunately, the number of incoming pull requests is higher than what our
reviewers can review and merge so there is a long backlog of pull requests
waiting for review. You can help here!
By reviewing another pull request, you will help raise the code quality of
that pull request and the final review will be faster. This way the general
pace of pull request reviews will go up and your wait time will go down.
When picking a pull request to review, try to choose one that hasn't yet
been reviewed.
Thanks for helping out!
-->
To help with the load of incoming pull requests:
- [ ] I have reviewed two other [open pull requests][prs] in this repository.
[prs]: https://github.com/home-assistant/core/pulls?q=is%3Aopen+is%3Apr+-author%3A%40me+-draft%3Atrue+-label%3Awaiting-for-upstream+sort%3Acreated-desc+review%3Anone+-status%3Afailure
<!--
Thank you for contributing <3
Below, some useful links you could explore:
-->
[dev-checklist]: https://developers.home-assistant.io/docs/development_checklist/
[manifest-docs]: https://developers.home-assistant.io/docs/creating_integration_manifest/
[quality-scale]: https://developers.home-assistant.io/docs/integration_quality_scale_index/
[docs-repository]: https://github.com/home-assistant/home-assistant.io
[perfect-pr]: https://developers.home-assistant.io/docs/review-process/#creating-the-perfect-pr
A side-effect is likely that you lost the onkyo
command inside HA.
I guess it wasn’t documented as a breaking change because one wasn’t supposed to use that command in the first place
demolud2
(Maciek)
July 7, 2024, 2:16pm
4
Thanks. How do I utilize this now for managing my Onkyo?
koying
(Chris B)
July 7, 2024, 2:27pm
5
My guess is that you can’t beyond what is documented.
If you are desperate, you can create a custom component from an earlier version of the integration
As recent HA releases do removal of integrations not maintained anymore, or just not in-line with the architecture decisions (see architecture/adr at master · home-assistant/architecture · GitHub for the up-to-date list), some users are left wondering what to do about that integration that is working for them, but which is not available anymore.
The response is clear: make a custom component out of the latest available code.
Now, that in itself might comes in 2 flavors:
The happy one: someo…
Any reason you’re not simply using the built-in integration?
demolud2
(Maciek)
July 8, 2024, 10:14am
8
Yes. I was never able to run a station on TuneIn.
As far as I could see in Integration description NET radio is not supported for play_media function.
Unless there is a way I do not know?
Yeah, play_media can currently only be used for normal radio, not NET radio. But if it is possible to send the proper codes manually, then it should also be in principle possible to support it in the integration.
demolud2
(Maciek)
July 9, 2024, 6:18am
10
Would you have an example of how to send follwing sequence of codes using the standard integration:
ZPW01
ZLKV15
SLZ2B
NSV0E0
NLSI00001
NLSI00008
with some delay between them?
Regards,
Maciek
1 Like
Just want to share an alternative method to bring back the now missing onkyo dependency.
By following this advice I was able to re-install the required onkyo-eiscp dependency without the need to create a custom component.
It’s a little complicated, but hey…
You need to add the following repository to your AddOn reps:
After adding it, you will be presented with some AddOns, the one you wan t is custom_deps.
Install it.
After that you can add custom dependencies to your HAos. It is, as the title of the repo suggests, an AddOn for developers to quickly test some deps.
I truely don’t know, if this survives a restart, but I assume. At least I don’t remember adding things after a restart while using …
Fingers crossed the solution will stand the test of time
1 Like
ptiza
January 27, 2025, 11:36pm
13
Continuing the discussion from [Errno 2] No such file or directory :
You can just replace the onkyo command by a script using the new pyeiscp library, create e.g. run_eiscp.py
in /config/python_scripts/
:
import argparse
import asyncio
import pyeiscp
async def main(args):
conn = await pyeiscp.Connection.create(
host=args.host,
port=args.port,
loop=None,
update_callback=None,
connect_callback=None,
)
conn.send(args.command)
if __name__ == "__main__":
parser = argparse.ArgumentParser(
prog="eiscp_send", description="Send eiscp commands to Onkyo receiver."
)
parser.add_argument("-r", "--host", default="127.0.0.1", help="IP of AVR")
parser.add_argument("--port", default=60128, help="Port of AVR")
parser.add_argument("command")
args = parser.parse_args()
asyncio.run(main(args))
This script works similar to the onkyo cli tool, it just needs the IP of the AVR and the command as argument.
You can define the shell command in configuration.yaml:
shell_command:
run_eiscp_command: 'python /config/python_scripts/run_eiscp.py -r {{ host }} {{ command }}'
Commands are defined here:
"""All supported commands for the Onkyo recievers"""
# Generated
# by generate_commands_module.py
# from eiscp-commands.yaml
# at 2019-06-16 18:16:40.906934
from collections import OrderedDict
from .utils import ValueRange
COMMANDS = OrderedDict([('main', OrderedDict([('PWR', {'values': OrderedDict([('00', {'name': ('standby',
'off'),
'description': 'sets System Standby'}),
('01', {'name': 'on', 'description': 'sets System On'}),
('ALL', {'name': 'standby-all',
'description': 'All Zone(including Main Zone) Standby'}),
('QSTN', {'name': 'query',
'description': 'gets the System Power Status'})]),
'name': 'system-power',
'description': 'System Power Command'}),
('AMT', {'values': OrderedDict([('00', {'name': 'off',
This file has been truncated. show original
and can be sent via format:
master-volume.level-down
to lower volume
or audio-muting.toggle
to toggle mute.
This is known to lead to serious system instability in many cases. Please do not do this.
And if you do, don’t expect any support.
Also the library will be changed soon(ish), so this will stop working then.
ptiza
January 28, 2025, 3:26pm
15
What do you mean by “serious system instability”? Could you elaborate?
I built a remote dashboard that issues main.setup.menu.left
, main.setup.menu.right
etc commands in the above way to replace the physical remote.
I have not encountered any issues with it yet.
Doing this is currently impossible with the current state of Onkyo integration.
Every time you issue a command, you open and close a completely new connection. This is obviously bad.
There have been reports, where doing this resulted in substantial instability, because Home Assistant was effectively getting DoSed. More details, if you are interested, available here .
ptiza
January 28, 2025, 8:47pm
17
Every time you issue a command, you open and close a completely new connection. This is obviously bad.
I agree it is not optimal, but that’s just the way TCP works… If you issue GET requests with e.g. curl you are basically doing the same thing. Ideal scenario would be that these commands are issued by the same TCP connection HA uses, but as that is not possible currently, a workaround is necessary.
There have been reports, where doing this resulted in substantial instability, because Home Assistant was effectively getting DoSed. More details, if you are interested, available here.
Interesting, thanks for the hint. I have a VSX-832 and I am running HA 2024.12.3 and I am not able to reproduce this.
If I spam my AVR with watch -n 0.2 python run_eiscp.py -r avr main.temperature-data=query
, the integration does respond a bit slow while the command is running, but as soon as I stop, the integration responds fast again.