[Errno 2] No such file or directory

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’

I guess this is due to that change:

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

Thanks. How do I utilize this now for managing my Onkyo?

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

Thank you, it worked.

Regards,

Maciek

Any reason you’re not simply using the built-in integration?

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.

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.

Fingers crossed the solution will stand the test of time :slight_smile:

1 Like

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:

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.

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.

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.