esphome-docs/guides/cli.rst
Alex Mekkering 0f0297760c
Add support for command-line-substitutions (#538)
* Add support for command-line-substitutions

* Provide an example of the use of multiple command-line substitutions

* Fix code block indentation

* Elaborate on command line options and refer to substitutions

* Fix bar lengths
2020-06-21 15:32:51 -03:00

212 lines
5.1 KiB
ReStructuredText

Command Line Interface
======================
.. seo::
:description: Documentation for the command line interface of ESPHome.
Base Usage
----------
ESPHome's command line interface always has the following format
.. code-block:: console
esphome [OPTIONS] <CONFIGURATION...> <COMMAND> [ARGUMENTS]
.. note::
You can specify multiple configuration files in the command line interface,
just list all files in front of the <COMMAND> like so:
.. code-block:: console
esphome livingroom.yaml kitchen.yaml run
``--verbose`` Option
--------------------
.. option:: -v|--verbose
Enable verbose esphome logs.
``--quiet`` Option
------------------
.. option:: -q|--quiet
Disable all esphome logs.
``--substitution`` Option
-------------------------
*(can be issued multiple times)*
.. option:: -s|--substitution KEY VALUE
Defines or overrides substitution KEY with value VALUE.
Please see :ref:`command line substitutions <command-line-substitutions>` for details.
``run`` Command
---------------
The ``esphome <CONFIG> run`` command is the most common command for ESPHome. It
* Validates the configuration
* Compiles a firmware
* Uploads the firmware (over OTA or USB)
* Starts the log view
.. program:: esphome run
.. option:: --upload-port UPLOAD_PORT
Manually specify the upload port/ip to use. For example ``/dev/cu.SLAB_USBtoUART``.
.. option:: --no-logs
Disable starting log view.
.. option:: --topic TOPIC
Manually set the topic to subscribe to for MQTT logs (defaults to the one in the configuration).
.. option:: --username USERNAME
Manually set the username to subscribe with for MQTT logs (defaults to the one in the configuration).
.. option:: --password PASSWORD
Manually set the password to subscribe with for MQTT logs (defaults to the one in the configuration).
.. option:: --client-id CLIENT_ID
Manually set the client ID to subscribe with for MQTT logs (defaults to a randomly chosen one).
.. option:: --host-port HOST_PORT
Specify the host port to use for legacy Over the Air uploads.
``config`` Command
------------------
.. program:: esphome config
The ``esphome <CONFIG> config`` validates the configuration and displays the validation result.
``compile`` Command
-------------------
.. program:: esphome compile
The ``esphome <CONFIG> compile`` validates the configuration and compiles the firmware.
.. option:: --only-generate
If set, only generates the C++ source code and does not compile the firmware.
``upload`` Command
------------------
.. program:: esphome upload
The ``esphome <CONFIG> upload`` validates the configuration and uploads the most recent firmware build.
.. option:: --upload-port UPLOAD_PORT
Manually specify the upload port/ip to use. For example ``/dev/cu.SLAB_USBtoUART``.
.. option:: --host-port HOST_PORT
Specify the host port to use for legacy Over the Air uploads.
``clean-mqtt`` Command
----------------------
.. program:: esphome clean-mqtt
The ``esphome <CONFIG> clean-mqtt`` cleans retained MQTT discovery messages from the MQTT broker.
See :ref:`mqtt-using_with_home_assistant`.
.. option:: --topic TOPIC
Manually set the topic to clean retained messages from (defaults to the MQTT discovery topic of the
node).
.. option:: --username USERNAME
Manually set the username to subscribe with.
.. option:: --password PASSWORD
Manually set the password to subscribe with.
.. option:: --client-id CLIENT_ID
Manually set the client ID to subscribe with.
``wizard`` Command
------------------
.. program:: esphome wizard
The ``esphome <CONFIG> wizard`` command starts the esphome configuration creation wizard.
``mqtt-fingerprint`` Command
----------------------------
.. program:: esphome mqtt-fingerprint
The ``esphome <CONFIG> mqtt-fingerprint`` command shows the MQTT SSL fingerprints of the remote used
for SSL MQTT connections. See :ref:`mqtt-ssl_fingerprints`.
``version`` Command
-------------------
.. program:: esphome version
The ``esphome <CONFIG> version`` command shows the current ESPHome version and exits.
``clean`` Command
-----------------
.. program:: esphome clean
The ``esphome <CONFIG> clean`` command cleans all build files and can help with some build issues.
``hass-config`` Command
-----------------------
.. program:: esphome hass-config
The ``esphome <CONFIG> hass-config`` command shows an auto-generated Home Assistant configuration for the ESPHome
node configuration file. This is useful if you're not using MQTT discovery.
``dashboard`` Command
---------------------
.. program:: esphome dashboard
The ``esphome <CONFIG> dashboard`` command starts the esphome dashboard server for using esphome
through a graphical user interface.
.. option:: --port PORT
Manually set the HTTP port to open connections on (defaults to 6052)
.. option:: --username USERNAME
The optional username to require for authentication.
.. option:: --password PASSWORD
The optional password to require for authentication.
.. option:: --open-ui
If set, opens the dashboard UI in a browser once the server is up and running.