Problem with Shell Command in Hassio

Hi, I may not have an immdeate solution but a very similar issue which I got solved. First: I do also run home-assistant in docker and recently upgraded to version 0.85.0 (kill me I am not sure of the previos version I believe something 0.7x…) before upgrade the shell command:

shell_command:
  set_state_to_vent: '/usr/bin/phantomjs /config/vallox/click_vallox.js http://192.168.70.20 {{ states.input_number.state_vent.state | int }}'

worked flawlessly. Unfortunately phantomjs it seems was removed from the docker container. I had to install it manually and the manual version required an Env-var to be set to work.

for a

sensor:
  - platform: command_line
  
    name: Vallox Gesamt
    command: "export QT_QPA_PLATFORM=offscreen; /usr/bin/phantomjs /config/vallox/read_vallox.js http://192.168.70.20"

this worked flawlessly, for:

shell_command:
  set_state_to_vent: 'export QT_QPA_PLATFORM=offscreen; /usr/bin/phantomjs /config/vallox/click_vallox.js http://192.168.70.20 {{ states.input_number.state_vent.state | int }}'

it resulted in the same issue as above.

Finally I could resolve it for by putting the two commands into a script “click_sh”

shell_command:
  set_state_to_vent: '/config/vallox/click_sh {{ states.input_number.state_vent.state | int }}'

Then I tried to get closer to the root-cause and confirgured a few “nonsense”-commands:

shell_command:
  set_state_to_vent_1: '/bin/echo 1; /bin/echo 1; /bin/echo 1; /bin/echo {{ states.input_number.state_vent.state | int }}' # works
  set_state_to_vent_2: '/bin/echo {{ states.input_number.state_vent.state | int }}' # works
  set_state_to_vent_3: 'export QT_QPA_PLATFORM=offscreen; /bin/echo {{ states.input_number.state_vent.state | int }}' # fails
  set_state_to_vent_4: 'export QT_QPA_PLATFORM=offscreen; /bin/echo 1' #works
  set_state_to_vent_5: '/bin/echo 1' # works
  set_state_to_vent_6: '/bin/echo te_st; /bin/echo {{ states.input_number.state_vent.state | int }}' # works
  set_state_to_vent_7: 'export TEST=1; /bin/echo {{ states.input_number.state_vent.state | int }}' # fails
  set_state_to_vent_8: 'export TEST_T=1; /bin/echo {{ states.input_number.state_vent.state | int }}' # fails
  set_state_to_vent_9: '/bin/echo "_"; /bin/echo {{ states.input_number.state_vent.state | int }}' # works
  set_state_to_vent_10: '/bin/echo "="; /bin/echo {{ states.input_number.state_vent.state | int }}' # works

I have the feeling for me the the error is reproducible if I use the export built in command plus a variable in the command but I am not 100% sure. Here the error for “set_state_to_vent_7”:

2019-01-21 17:19:00 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.140110392039520] Error handling message: {‘type’: ‘call_service’, ‘domain’: ‘shell_command’, ‘service’: ‘set_state_to_vent_7’, ‘service_data’: {}, ‘id’: 17}
Traceback (most recent call last):
File “/usr/src/app/homeassistant/components/websocket_api/decorators.py”, line 17, in _handle_async_response
await func(hass, connection, msg)
File “/usr/src/app/homeassistant/components/websocket_api/commands.py”, line 148, in handle_call_service
connection.context(msg))
File “/usr/src/app/homeassistant/core.py”, line 1121, in async_call
self._execute_service(handler, service_call))
File “/usr/src/app/homeassistant/core.py”, line 1143, in _execute_service
await handler.func(service_call)
File “/usr/src/app/homeassistant/components/shell_command.py”, line 86, in async_service_handler
process = await create_process
File “/usr/local/lib/python3.6/asyncio/subprocess.py”, line 225, in create_subprocess_exec
stderr=stderr, **kwds)
File “uvloop/loop.pyx”, line 2601, in subprocess_exec
File “uvloop/loop.pyx”, line 2561, in __subprocess_run
File “uvloop/handles/process.pyx”, line 588, in uvloop.loop.UVProcessTransport.new
File “uvloop/handles/process.pyx”, line 95, in uvloop.loop.UVProcess._init
FileNotFoundError: [Errno 2] No such file or directory