https://github.com/alexxit/sshcommand
Run any SSH command on remote server from Home Assistant service call
https://github.com/alexxit/sshcommand
home-assistant
Last synced: 25 days ago
JSON representation
Run any SSH command on remote server from Home Assistant service call
- Host: GitHub
- URL: https://github.com/alexxit/sshcommand
- Owner: AlexxIT
- License: mit
- Created: 2020-03-14T16:56:56.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2024-12-07T07:28:11.000Z (5 months ago)
- Last Synced: 2025-03-30T00:10:05.811Z (about 1 month ago)
- Topics: home-assistant
- Language: Python
- Homepage: https://github.com/AlexxIT/Blog
- Size: 32.2 KB
- Stars: 105
- Watchers: 5
- Forks: 8
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# SSHCommand for Home Assistant
Run any SSH command on remote server from [Home Assistant](https://www.home-assistant.io/) service call. For example, the command on the main host from the docker container.
## Installation
[HACS](https://hacs.xyz/) custom repository: `AlexxIT/SSHCommand`.
[](https://my.home-assistant.io/redirect/hacs_repository/?owner=AlexxIT&repository=SSHCommand&category=Integration)
Or manually copy `ssh_command` folder from [latest release](https://github.com/AlexxIT/SSHCommand/releases/latest) to `/config/custom_components` folder.
## Configuration
Add integration via Home Assistant UI or `configuration.yaml`.
[](https://my.home-assistant.io/redirect/config_flow_start/?domain=ssh_command)
## Usage
New service `ssh_command.exec_command`:
```yaml
script:
run_on_host:
alias: Run shell command on host
sequence:
- service: ssh_command.exec_command
data:
host: 192.168.1.123
port: 22
user: pi
pass: raspberry
command: ls -la
```Advanced usage:
```yaml
script:
run_on_host:
alias: Run shell command on host
sequence:
- service: ssh_command.exec_command
data:
host: 192.168.1.123 # required hostname
user: pi # required username
pass: secret # optional password
private_key: /config/ssh/id_rsa # optional private key filename
passphrase: secret # optional private key passphrase
timeout: 5 # optional timeout
command: # also support multiple commands
- touch somefile.tmp
- ls -la
```If you want use secrets or change default values, add them to `configuration.yaml`:
```yaml
ssh_command:
host: 192.168.1.123
port: 22
user: pi
pass: !secret ssh_parssword
```