Shell commands query

To expand Onkyo component i have to run shell commands.

So for example to set a late night mode i write the following switch

onkyo_audyssey_dynvolume:
    command_on: '/srv/homeassistant/homeassistant_venv/bin/onkyo -n709 audyssey-dynamic-volume=heavy'
    command_off: '/srv/homeassistant/homeassistant_venv/bin/onkyo -n709 audyssey-dynamic-volume=off'

But now i was wondering on 2 things. First off some of these commands have 3 or more options. Lets’s say low, med, high.
So an input select sounds like a more feasible solution here - but is there a way to call s shell script from automation? Without setting up shell switches first?

The second question - there is also a query command. So if we do

#/srv/homeassistant/homeassistant_venv/bin/onkyo -n709 audyssey-dynamic-volume=query

We will get the following output

<eISCP(TX-NR709) 172.16.5.106:60128>: ADVQSTN
('audyssey-dynamic-volume', 'off')

Any ideas how to make HA query the state periodically?

Shell command component will allow you to call your shell command from a script

A command line sensor will query state on a frequency you determine