![]() 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. This indicates that the service we created in Home Assistant has executed the shell command. If the file has been successfully created then the path and filename should be echoed. Once at the Home Assistant command prompt, enter the following command to confirm that the file test.txt has been created. You can also specify the port if different from the default value of 22. If you wish to connect with your system terminal, go ahead and enter the following command replacing your-homeassistant with the IP address of your Home Assistant server. If the option is missing from the sidebar, you will need to install the terminal in the add-ons store. ![]() If you wish to use the web terminal, simply click on terminal from the sidebar to open up the terminal. You can either do this by using your system terminal to connect to Home Assistant or by using the web terminal in Home Assistant. Now we need to access the Home Assistant terminal. ![]() 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 your main system prompt In order to make things clearer in the tutorial, I used colored highlighting to differentiate between which terminal the commands need to be typed in to. You can either work directly on the machine’s command line or SSH in with your main terminal. Remote Terminal – This is the remote Linux system that we wish to control via Home Assistant.Home Assistant Terminal – You can either use the Terminal add-on or you can SSH in with your main system terminal.Main System Terminal – This is the prompt on your main computer (usually the one with a browser that you use to access the Home Assistant GUI).There are three locations where we will need to type commands: 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. Running the remote script from Home Assistant.Copy the key with Home Assistant web terminal.If you are running Home Assistant inside a Docker container, you can also use this method to execute commands outside of the container on the main machine by using SSH. Looking to automatically execute commands on a Raspberry Pi or Linux machine from within Home Assistant? This step-by-step guide will teach you how to send shell commands to any other machine on your network.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |