AlexxIT / SSHCommand

Run any SSH command on remote server from Home Assistant service call
https://github.com/AlexxIT/Blog
MIT License
89 stars 7 forks source link

[Errno None] Unable to connect to port 22 on 192.168.188.99 #15

Closed LucaZiegler closed 1 year ago

LucaZiegler commented 1 year ago

When I am using this command:

service: ssh_command.exec_command
data:
  host: 192.168.188.99
  port: 22
  user: XXX
  pass: XXX
  command: echo '1-1' | sudo tee /sys/bus/usb/drivers/usb/unbind

then I got this error:

websocket_api script: Error executing script. Unexpected error for call_service at pos 1: [Errno None] Unable to connect to port 22 on 192.168.188.99
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 451, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 684, in _async_call_service_step
    await service_task
  File "/usr/src/homeassistant/homeassistant/core.py", line 1787, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1824, in _execute_service
    await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
  File "/config/custom_components/ssh_command/__init__.py", line 21, in exec_command
    client.connect(host, port, username, password)
  File "/usr/local/lib/python3.10/site-packages/paramiko/client.py", line 380, in connect
    raise NoValidConnectionsError(errors)
paramiko.ssh_exception.NoValidConnectionsError: [Errno None] Unable to connect to port 22 on 192.168.188.99

sudo poweroff is working

AlexxIT commented 1 year ago

Just connection error. Not related to integration

LucaZiegler commented 1 year ago

But, "sudo poweroff" works

AlexxIT commented 1 year ago

Anyway error on connection step

Spp595 commented 1 year ago

some problem