There are some limitations to using the Home Assistant shell and you will find that there is no package manager so you are limited to the built in commands. Then we will create a new shell command called my_first_shell_command. To assign this terminal command to a function in Home Assistant, first we will add the shell integration to our configuration.yaml file. Add the shell integrationįirst we will add the following basic shell command to create a new file within the Home Assistant container in order to demonstrate the basic use of the integration. This allows you to take control of remote Linux-based machines or the main local system shell if you have one available. When executing shell commands in Home Assistant, the execution will occur from the bash shell within the container and not the main system shell.įor some applications it may be adequate to execute commands from the Home Assistant CLI, however the real power of this integration comes when you combine it with SSH. This makes the installation process much easier and allows Home Assistant to run alongside other systems with no disruption or conflict. In most cases Home Assistant installations run from within a Docker container. These commands should be typed at the Home Assistant prompt.
If you are using Windows then you can use a terminal program like PuTTY.įor this tutorial I shall be using a remote Raspberry Pi for the remote host that I wish to control.
Note that I am using Mac OS X on my main computer so I will be using the built-in terminal. In order to make things clearer in the tutorial, we can differentiate between commands to be typed into your Home Assistant terminal, commands to be typed into your remote host / external container terminal and commands to be typed into your main system terminal. I would also recommend taking a look at my other tutorials on automation and scripts.Ī basic understand of Linux terminal commands would also be advantageous as there is quite a lot to do in the terminal! Don’t worry if you are still learning, everything is detailed here and you can just copy and paste the commands. If you are new to Home Assistant or you are not yet familiar with editing YAML files then you should definitely check out my beginners tutorial on YAML first.
You will also need the SSH & Web Terminal add-on installed.
You should have Home Assistant installed and running and a basic understanding of YAML including how to edit configuration.yaml.