diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9f57d37c29..8b1332c41f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,14 +1,4 @@ --- -build: - tags: - - esphomedocs - script: - - make ../esphomelib - - make html - except: - - current - - rc - .deploy: &deploy tags: - esphomedocs @@ -26,12 +16,13 @@ build: - git fetch --force git@github.com:${TARGET_REPO}.git gh-pages:gh-pages - git worktree add _build/html gh-pages - make ../esphomelib - - touch _build/html/.nojekyll - - echo ${CNAME} >_build/html/CNAME - make html - git -C _build/html add --all - git -C _build/html commit -m "Deploy to gh-pages" - git -C _build/html push -f git@github.com:${TARGET_REPO}.git gh-pages + cache: + paths: + - _build/doctrees deploy-release: <<: *deploy diff --git a/Dockerfile b/Dockerfile index 31c49ca72c..dd97e3c54b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,6 +10,12 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ make \ doxygen \ openssh-client \ + software-properties-common \ + && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* + +RUN apt-add-repository ppa:inkscape.dev/stable && \ + apt-get update && apt-get install -y --no-install-recommends \ + inkscape \ && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* RUN pip3 install --no-cache-dir --no-binary :all: \ diff --git a/Makefile b/Makefile index 8e828d870e..38777a2e6c 100644 --- a/Makefile +++ b/Makefile @@ -32,9 +32,10 @@ $(ESPHOMELIB_PATH): git clone --branch $(ESPHOMELIB_TAG) https://github.com/OttoWinter/esphomelib.git $(ESPHOMELIB_PATH); \ fi -deploy: cleanhtml doxyg html $(ESPHOMELIB_PATH) - touch "$(BUILDDIR)/html/.nojekyll" - echo "$(CNAME)" >"$(BUILDDIR)/html/CNAME" +convertimages: + python3 svg2png.py + +deploy: cleanhtml doxyg html $(ESPHOMELIB_PATH) convertimages git -C "$(BUILDDIR)/html" add --all && git -C "$(BUILDDIR)/html" commit -m "Deploy to gh-pages" @printf "Run \033[0;36mcd $(BUILDDIR)/html && git push origin gh-pages\033[0m to deploy\n" diff --git a/conf.py b/conf.py index 6da0f8ba49..db615ec942 100644 --- a/conf.py +++ b/conf.py @@ -45,6 +45,7 @@ 'disqus', 'github', 'seo', + 'githubpages', 'sitemap', ] @@ -67,6 +68,7 @@ # General information about the project. project = 'esphomelib' copyright = '2018, Otto Winter' +html_show_copyright = False author = 'Otto Winter' # The version info for the project you're documenting, acts as replacement for @@ -94,9 +96,9 @@ # default_role = 'cpp:any' # The name of the Pygments (syntax highlighting) style to use. -pygments_style = 'sphinx' +pygments_style = 'xcode' -# highlight_language = 'yaml' +highlight_language = 'yaml' primary_domain = None @@ -210,3 +212,4 @@ 'Miscellaneous'), ] html_baseurl = os.getenv('BASE_URL', 'https://esphomelib.com') +linkcheck_ignore = [r'https://github.com/.*', r'https://discord.gg/.*'] diff --git a/esphomeyaml/changelog/index.rst b/esphomeyaml/changelog/index.rst index 46f7c87b6e..38405d810c 100644 --- a/esphomeyaml/changelog/index.rst +++ b/esphomeyaml/changelog/index.rst @@ -94,7 +94,7 @@ New Features - The current esphomelib version and compilation time are now printed on each boot (:libpr:`189`, :yamlpr:`159`): - .. code:: bash + .. code-block:: text [13:57:33][I][application:092]: You're running esphomelib v1.9.0 compiled on Nov 3 2018, 13:55:11 diff --git a/esphomeyaml/changelog/v1.7.0.rst b/esphomeyaml/changelog/v1.7.0.rst index bce2cb389e..6ff77023cf 100644 --- a/esphomeyaml/changelog/v1.7.0.rst +++ b/esphomeyaml/changelog/v1.7.0.rst @@ -94,7 +94,7 @@ Breaking Changes parameter. The accuracy now defaults to ``HIGH``. - The ``inverted`` option of binary sensors has been moved into the ``filters:`` section. So instead of - .. code:: yaml + .. code-block:: yaml binary_sensor: - platform: ... @@ -103,7 +103,7 @@ Breaking Changes you would now write: - .. code:: yaml + .. code-block:: yaml binary_sensor: - platform: ... diff --git a/esphomeyaml/changelog/v1.8.0.rst b/esphomeyaml/changelog/v1.8.0.rst index fd92f02bbe..dc12697d2b 100644 --- a/esphomeyaml/changelog/v1.8.0.rst +++ b/esphomeyaml/changelog/v1.8.0.rst @@ -121,7 +121,7 @@ Other notable changes - In actions, instead of - .. code:: yaml + .. code-block:: yaml on_...: then: @@ -130,7 +130,7 @@ Other notable changes You can now write: - .. code:: yaml + .. code-block:: yaml on_...: then: @@ -138,7 +138,7 @@ Other notable changes Or even shorter: - .. code:: yaml + .. code-block:: yaml on_...: - switch.turn_on: my_switch diff --git a/esphomeyaml/components/ads1115.rst b/esphomeyaml/components/ads1115.rst index b1de82cd2a..f825f28d8f 100644 --- a/esphomeyaml/components/ads1115.rst +++ b/esphomeyaml/components/ads1115.rst @@ -19,7 +19,7 @@ To use this hub, first setup the :ref:`I²C Bus ` and connect the sensor to .. _Adafruit: https://www.adafruit.com/product/1085 -.. code:: yaml +.. code-block:: yaml ads1115: - address: 0x48 diff --git a/esphomeyaml/components/binary_sensor/esp32_ble_tracker.rst b/esphomeyaml/components/binary_sensor/esp32_ble_tracker.rst index 069513dbd0..62a16f493f 100644 --- a/esphomeyaml/components/binary_sensor/esp32_ble_tracker.rst +++ b/esphomeyaml/components/binary_sensor/esp32_ble_tracker.rst @@ -3,7 +3,7 @@ ESP32 Bluetooth Low Energy Device .. seo:: :description: Instructions for setting up BLE binary sensors for the ESP32. - :image: bluetooth.svg + :image: bluetooth.png The ``esp32_ble_tracker`` binary sensor platform lets you track the presence of a bluetooth low energy device. @@ -12,7 +12,7 @@ bluetooth low energy device. :align: center :width: 80.0% -.. code:: yaml +.. code-block:: yaml # Example configuration entry esp32_ble_tracker: @@ -44,7 +44,7 @@ to track. Most devices show this screen in some setting menu. If you don't know however, you can use the ``esp32_ble_tracker`` hub without any binary sensors attached and read through the logs to see discovered Bluetooth Low Energy devices. -.. code:: yaml +.. code-block:: yaml # Example configuration entry for finding MAC addresses esp32_ble_tracker: diff --git a/esphomeyaml/components/binary_sensor/esp32_touch.rst b/esphomeyaml/components/binary_sensor/esp32_touch.rst index 6087ebe90e..d39d1dff71 100644 --- a/esphomeyaml/components/binary_sensor/esp32_touch.rst +++ b/esphomeyaml/components/binary_sensor/esp32_touch.rst @@ -3,7 +3,7 @@ ESP32 Touch Pad Binary Sensor .. seo:: :description: Instructions for setting up the touch pad on the ESP32. - :image: touch.svg + :image: touch.png The ``esp32_touch`` binary sensor platform lets you use the touch peripheral of the ESP32 to detect if a certain pin is being "touched". @@ -17,7 +17,7 @@ an ``OFF`` state. :align: center :width: 80.0% -.. code:: yaml +.. code-block:: yaml # Example configuration entry esp32_touch: @@ -72,7 +72,7 @@ to output measured values using the ``setup_mode:`` configuration option. Next, for the touch pads you want to observe. Also put some threshold in the configuration as seen below to make the validator happy, we are going to find good thresholds in a moment anyway. -.. code:: yaml +.. code-block:: yaml # Example configuration entry for finding threshold values esp32_touch: diff --git a/esphomeyaml/components/binary_sensor/gpio.rst b/esphomeyaml/components/binary_sensor/gpio.rst index adcc83a45a..577dd233d6 100644 --- a/esphomeyaml/components/binary_sensor/gpio.rst +++ b/esphomeyaml/components/binary_sensor/gpio.rst @@ -3,7 +3,7 @@ GPIO Binary Sensor .. seo:: :description: Instructions for setting up GPIO binary sensors with esphomelib. - :image: pin.svg + :image: pin.png The GPIO Binary Sensor platform allows you to use any input pin on your device as a binary sensor. @@ -12,7 +12,7 @@ device as a binary sensor. :align: center :width: 80.0% -.. code:: yaml +.. code-block:: yaml # Example configuration entry binary_sensor: @@ -35,7 +35,7 @@ Configuration variables: For some applications such as reed switches you need to set the pin mode to ``INPUT_PULLUP`` like this: - .. code:: yaml + .. code-block:: yaml binary_sensor: - platform: gpio @@ -50,7 +50,7 @@ Inverting Values Use the ``inverted`` property of the :ref:`Pin Schema ` to invert the binary sensor: -.. code:: yaml +.. code-block:: yaml # Example configuration entry binary_sensor: @@ -66,7 +66,7 @@ Debouncing Values Some binary sensors are a bit unstable and quickly transition between the ON and OFF state while they're pressed. To fix this and debounce the signal, use the :ref:`binary sensor filters `: -.. code:: yaml +.. code-block:: yaml # Example configuration entry binary_sensor: @@ -80,7 +80,7 @@ Above example will only make the signal go high if the button has stayed high fo Alternatively, below configuration will make the binary sensor publish an ON value immediately, but will wait 10ms before publishing an OFF value: -.. code:: yaml +.. code-block:: yaml # Example configuration entry binary_sensor: diff --git a/esphomeyaml/components/binary_sensor/index.rst b/esphomeyaml/components/binary_sensor/index.rst index 7c01f77d99..114bb25cc6 100644 --- a/esphomeyaml/components/binary_sensor/index.rst +++ b/esphomeyaml/components/binary_sensor/index.rst @@ -3,7 +3,7 @@ Binary Sensor Component .. seo:: :description: Information about the base representation of all binary sensors. - :image: folder-open.svg + :image: folder-open.png With esphomelib you can use different types of binary sensors. They will automatically appear in the Home Assistant front-end and have several @@ -19,7 +19,7 @@ All binary sensors have a platform and an optional device class. By default, the binary will chose the appropriate device class itself, but you can always override it. -.. code:: yaml +.. code-block:: yaml binary_sensor: - platform: ... @@ -58,7 +58,7 @@ Binary Sensor Filters With binary sensor filters you can customize how esphomelib handles your binary sensor values even more. They are similar to :ref:`Sensor Filters `. -.. code:: yaml +.. code-block:: yaml binary_sensor: - platform: ... @@ -110,7 +110,7 @@ You can access the current state of the binary sensor in :ref:`lambdas `. This automation will be triggered when a button press ends, or in other words on the falling edge of the signal. -.. code:: yaml +.. code-block:: yaml binary_sensor: - platform: gpio @@ -149,7 +149,7 @@ This automation will be triggered when a button is pressed down for a time perio ``min_length`` to ``max_length``. Any click longer or shorter than this will not trigger the automation. The automation is therefore also triggered on the falling edge of the signal. -.. code:: yaml +.. code-block:: yaml binary_sensor: - platform: gpio @@ -175,7 +175,7 @@ This automation will be triggered when a button is pressed down twice, with the ``min_length`` and ``max_length``. When a second leading edge then happens within ``min_length`` and ``max_length``, the automation is triggered. -.. code:: yaml +.. code-block:: yaml binary_sensor: - platform: gpio @@ -200,7 +200,7 @@ Configuration variables: This automation will be triggered when a button is pressed in a user-specified sequence. -.. code:: yaml +.. code-block:: yaml binary_sensor: - platform: gpio @@ -238,7 +238,7 @@ You can use an ``OFF`` timing at the end of the timing sequence to differentiate kinds of presses. For example the configuration below will differentiate between double, long and short presses. -.. code:: yaml +.. code-block:: yaml on_multi_click: - timing: @@ -269,7 +269,7 @@ advanced stuff (see the full :doc:`API Reference ` for - ``publish_state()``: Manually cause the binary sensor to publish and store a state from anywhere in the program. - .. code:: yaml + .. code-block:: yaml // Within lambda, publish an OFF state. id(my_binary_sensor).publish_state(false); @@ -279,7 +279,7 @@ advanced stuff (see the full :doc:`API Reference ` for - ``.state``: Retrieve the current state of the binary sensor. - .. code:: yaml + .. code-block:: yaml // Within lambda, get the binary sensor state and conditionally do something if (id(my_binary_sensor).state) { diff --git a/esphomeyaml/components/binary_sensor/nextion.rst b/esphomeyaml/components/binary_sensor/nextion.rst index ccc6b9c98a..e8195be522 100644 --- a/esphomeyaml/components/binary_sensor/nextion.rst +++ b/esphomeyaml/components/binary_sensor/nextion.rst @@ -11,7 +11,7 @@ pressed on, and will turn off as soon as the finger is released. See :doc:`/esphomeyaml/components/display/nextion` for setting up the display -.. code:: yaml +.. code-block:: yaml # Example configuration entry display: diff --git a/esphomeyaml/components/binary_sensor/pn532.rst b/esphomeyaml/components/binary_sensor/pn532.rst index 21b03d215f..e76735f970 100644 --- a/esphomeyaml/components/binary_sensor/pn532.rst +++ b/esphomeyaml/components/binary_sensor/pn532.rst @@ -14,7 +14,7 @@ unique id (``uid``) is currently being detected by the PN532 or not. See :doc:`/esphomeyaml/components/pn532` for instructions for setting up the connection to the PN532. -.. code:: yaml +.. code-block:: yaml # Example configuration entry spi: diff --git a/esphomeyaml/components/binary_sensor/rdm6300.rst b/esphomeyaml/components/binary_sensor/rdm6300.rst index 4fc4b169ed..4349cec09b 100644 --- a/esphomeyaml/components/binary_sensor/rdm6300.rst +++ b/esphomeyaml/components/binary_sensor/rdm6300.rst @@ -14,7 +14,7 @@ unique id (``uid``) is currently being detected by the RDM6300 or not. See :doc:`/esphomeyaml/components/rdm6300` for instructions for setting up the connection to the RDM6300. -.. code:: yaml +.. code-block:: yaml # Example configuration entry uart: diff --git a/esphomeyaml/components/binary_sensor/remote_receiver.rst b/esphomeyaml/components/binary_sensor/remote_receiver.rst index 882ac5158e..1c30c4eba8 100644 --- a/esphomeyaml/components/binary_sensor/remote_receiver.rst +++ b/esphomeyaml/components/binary_sensor/remote_receiver.rst @@ -3,14 +3,14 @@ Remote Receiver Binary Sensor .. seo:: :description: Instructions for setting up remote receiver binary sensors for infrared and RF codes. - :image: remote.svg + :image: remote.png The ``remote_receiver`` binary sensor lets you track when a button on a remote control is pressed. Each time the pre-defined signal is received, the binary sensor will briefly go ON and then immediately OFF. -.. code:: yaml +.. code-block:: yaml # Example configuration entry remote_receiver: @@ -45,7 +45,7 @@ Configuration variables: For the Sonoff RF Bridge you can use `this hack `__ created by the Github user wildwiz. Then use this configuration for the remote receiver/transmitter hubs: - .. code:: yaml + .. code-block:: yaml remote_receiver: pin: 4 diff --git a/esphomeyaml/components/binary_sensor/status.rst b/esphomeyaml/components/binary_sensor/status.rst index 27624520f5..25f7ebabf2 100644 --- a/esphomeyaml/components/binary_sensor/status.rst +++ b/esphomeyaml/components/binary_sensor/status.rst @@ -3,7 +3,7 @@ Status Binary Sensor .. seo:: :description: Instructions for setting up MQTT status binary sensors. - :image: server-network.svg + :image: server-network.png The Status Binary Sensor exposes the node state (if it’s connected to MQTT or not) for Home Assistant. It uses the :ref:`MQTT birth and last will messages ` @@ -13,7 +13,7 @@ to do this. :align: center :width: 80.0% -.. code:: yaml +.. code-block:: yaml # Example configuration entry binary_sensor: diff --git a/esphomeyaml/components/binary_sensor/template.rst b/esphomeyaml/components/binary_sensor/template.rst index 1094d086bf..a58e8f36bc 100644 --- a/esphomeyaml/components/binary_sensor/template.rst +++ b/esphomeyaml/components/binary_sensor/template.rst @@ -3,7 +3,7 @@ Template Binary Sensor .. seo:: :description: Instructions for setting up template binary sensors. - :image: description.svg + :image: description.png The ``template`` binary sensor platform allows you to define any :ref:`lambda template ` and construct a binary sensor out if it. @@ -11,7 +11,7 @@ and construct a binary sensor out if it. For example, below configuration would turn the state of an ultrasonic sensor into a binary sensor. -.. code:: yaml +.. code-block:: yaml # Example configuration entry binary_sensor: diff --git a/esphomeyaml/components/cover/index.rst b/esphomeyaml/components/cover/index.rst index 5e640d38cc..0fb9f10ddd 100644 --- a/esphomeyaml/components/cover/index.rst +++ b/esphomeyaml/components/cover/index.rst @@ -3,7 +3,7 @@ Cover Component .. seo:: :description: Instructions for setting up base covers in esphomelib. - :image: folder-opn.svg + :image: folder-opn.png The ``cover`` component is a generic representation of covers in esphomelib/yaml. A cover can (currently) either be *closed* or *open* and supports three types of @@ -16,7 +16,7 @@ commands: *open*, *close* and *stop*. This action opens the cover with the given ID when executed. -.. code:: yaml +.. code-block:: yaml on_...: then: @@ -26,7 +26,7 @@ This action opens the cover with the given ID when executed. This action can also be expressed in :ref:`lambdas `: - .. code:: cpp + .. code-block:: cpp id(cover_1).open(); @@ -37,7 +37,7 @@ This action opens the cover with the given ID when executed. This action closes the cover with the given ID when executed. -.. code:: yaml +.. code-block:: yaml on_...: then: @@ -47,7 +47,7 @@ This action closes the cover with the given ID when executed. This action can also be expressed in :ref:`lambdas `: - .. code:: cpp + .. code-block:: cpp id(cover_1).close(); @@ -58,7 +58,7 @@ This action closes the cover with the given ID when executed. This action stops the cover with the given ID when executed. -.. code:: yaml +.. code-block:: yaml on_...: then: @@ -68,7 +68,7 @@ This action stops the cover with the given ID when executed. This action can also be expressed in :ref:`lambdas `: - .. code:: cpp + .. code-block:: cpp id(cover_1).stop(); @@ -82,7 +82,7 @@ advanced stuff (see the full :doc:`API Reference ` for more in - ``publish_state()``: Manually cause the cover to publish a new state and store it internally. If it's different from the last internal state, it's additionally published to the frontend. - .. code:: yaml + .. code-block:: yaml // Within lambda, make the cover report a specific state id(my_cover).publish_state(cover::COVER_OPEN); @@ -90,7 +90,7 @@ advanced stuff (see the full :doc:`API Reference ` for more in - ``state``: Retrieve the current state of the cover. - .. code:: yaml + .. code-block:: yaml if (id(my_cover).state == cover::COVER_OPEN) { // Cover is open diff --git a/esphomeyaml/components/cover/template.rst b/esphomeyaml/components/cover/template.rst index 0f0b4972b5..061d36fbd4 100644 --- a/esphomeyaml/components/cover/template.rst +++ b/esphomeyaml/components/cover/template.rst @@ -3,7 +3,7 @@ Template Cover .. seo:: :description: Instructions for setting up template covers in esphomelib. - :image: description.svg + :image: description.png The ``template`` cover platform allows you to create simple covers out of just a few actions and a value lambda. Once defined, it will automatically appear in Home Assistant @@ -13,7 +13,7 @@ as a cover and can be controlled through the frontend. :align: center :width: 75.0% -.. code:: yaml +.. code-block:: yaml # Example configuration entry cover: diff --git a/esphomeyaml/components/dallas.rst b/esphomeyaml/components/dallas.rst index 706cd0a5f0..b7791051db 100644 --- a/esphomeyaml/components/dallas.rst +++ b/esphomeyaml/components/dallas.rst @@ -17,7 +17,7 @@ sensors are connected to should have an external pullup resistor of about 4.7KΩ. For this, connect a resistor of *about* 4.7KΩ (values around that like 1Ω will, if you don't have massively long wires, work fine in most cases) between ``3.3V`` and the data pin. -.. code:: yaml +.. code-block:: yaml # Example configuration entry dallas: diff --git a/esphomeyaml/components/debug.rst b/esphomeyaml/components/debug.rst index bca6cbc033..7f62b110ba 100644 --- a/esphomeyaml/components/debug.rst +++ b/esphomeyaml/components/debug.rst @@ -3,7 +3,7 @@ Debug Component .. seo:: :description: Instructions for setting up the debug component in esphomelib - :image: bug-report.svg + :image: bug-report.png The ``debug`` component can be used to debug problems with esphomelib. At startup, it prints a bunch of useful information like reset reason, free heap size, esphomelib version and so on. @@ -13,7 +13,7 @@ a bunch of useful information like reset reason, free heap size, esphomelib vers Example debug component output. -.. code:: yaml +.. code-block:: yaml # Example configuration entry debug: diff --git a/esphomeyaml/components/deep_sleep.rst b/esphomeyaml/components/deep_sleep.rst index 2a845c6382..0f218ef3c0 100644 --- a/esphomeyaml/components/deep_sleep.rst +++ b/esphomeyaml/components/deep_sleep.rst @@ -3,7 +3,7 @@ Deep Sleep Component .. seo:: :description: Instructions for setting up the deep sleep support for minimizing power consumption on ESPs. - :image: hotel.svg + :image: hotel.png The ``deep_sleep`` component can be used to automatically enter a deep sleep mode on the ESP8266/ESP32 after a certain amount of time. This is especially useful with nodes that operate @@ -23,7 +23,7 @@ to wake up on any RTC pin (``GPIO0``, ``GPIO2``, ``GPIO4``, ``GPIO12``, ``GPIO13 While in deep sleep mode, the node will not do any work and not respond to any network traffic, even Over The Air updates. -.. code:: yaml +.. code-block:: yaml # Example configuration entry deep_sleep: @@ -60,7 +60,7 @@ Advanced features: from the node to be displayed as "unavailable" while the node is in deep sleep mode. To disable availability reporting and not have any "unavailable" values, set ``birth_message`` and ``will_message`` to empty values: - .. code:: yaml + .. code-block:: yaml mqtt: # ... @@ -92,7 +92,7 @@ when the deep sleep should start? There are three ways of handling this using th This action makes the given deep sleep component enter deep sleep immediately. -.. code:: yaml +.. code-block:: yaml on_...: then: @@ -107,7 +107,7 @@ This action makes the given deep sleep component enter deep sleep immediately. This action prevents the given deep sleep component from entering deep sleep. Useful for -.. code:: yaml +.. code-block:: yaml on_...: then: @@ -126,7 +126,7 @@ Useful for Remember to turn "OTA mode" off again after the OTA update by sending a MQTT message with the payload ``OFF``. - .. code:: yaml + .. code-block:: yaml deep_sleep: # ... diff --git a/esphomeyaml/components/display/index.rst b/esphomeyaml/components/display/index.rst index e3d24df0fd..5b8298912d 100644 --- a/esphomeyaml/components/display/index.rst +++ b/esphomeyaml/components/display/index.rst @@ -3,7 +3,7 @@ Display Component .. seo:: :description: Instructions for setting up the display integration. - :image: folder-open.svg + :image: folder-open.png The ``display`` component houses esphomelib's powerful rendering and display engine. Fundamentally, there are these types of displays: @@ -38,7 +38,7 @@ option called ``lambda:`` which will be called every time esphomelib wants to re In there, you can write code like in any :ref:`lambda ` in esphomeyaml. Display lambdas are additionally passed a variable called ``it`` which represents the rendering engine object. -.. code:: yaml +.. code-block:: yaml display: - platform: ... @@ -70,7 +70,7 @@ Basic Shapes Now that you know a bit more about esphomelib's coordinate system, let's draw some basic shapes like lines, rectangles and circles: -.. code:: yaml +.. code-block:: yaml display: - platform: ... @@ -92,7 +92,7 @@ All the above methods can optionally also be called with an argument at the end color to draw. Currently, only ``COLOR_ON`` (the default if color is not given) and ``COLOR_OFF`` are supported because esphomelib only has implemented binary displays. -.. code:: yaml +.. code-block:: yaml display: - platform: ... @@ -111,7 +111,7 @@ esphomelib only has implemented binary displays. Additionally, you have access to two helper methods which will fetch the width and height of the display: -.. code:: yaml +.. code-block:: yaml display: - platform: ... @@ -136,7 +136,7 @@ at **any** size! Granted the reason for it is actually not having to worry about To use fonts you first have to define a font object in your esphomeyaml configuration file. Just grab a ``.ttf`` file from somewhere on the Internet and create a ``font:`` section in your configuration: -.. code:: yaml +.. code-block:: yaml font: - file: "Comic Sans MS.ttf" @@ -172,7 +172,7 @@ Configuration variables: Then, in your display code just reference the font like so: -.. code:: yaml +.. code-block:: yaml display: - platform: ... @@ -188,7 +188,7 @@ When you enter ``[0,10]`` you're really telling esphomelib that it should positi at ``[0,10]``. When using a different alignment, like ``TOP_RIGHT``, the text will be positioned left of the anchor pointed, so that, as the name implies, the anchor point is a the *top right* corner of the text. -.. code:: yaml +.. code-block:: yaml display: - platform: ... @@ -202,7 +202,7 @@ pointed, so that, as the name implies, the anchor point is a the *top right* cor As with basic shapes, you can also specify a color for the text: -.. code:: yaml +.. code-block:: yaml display: - platform: ... @@ -225,7 +225,7 @@ is way better documented :) ``printf`` can do way more stuff than you will probably ever need, but it's also quite simple for the basic stuff. For example, a printf call can look like this: -.. code:: yaml +.. code-block:: yaml sensor: - platform: ... @@ -267,7 +267,7 @@ Another interesting format string is ``%7.2f``, which would become the right-jus You can even have as many format strings as you want in a single printf call. Just make sure the put the arguments after the format string in the right order. -.. code:: yaml +.. code-block:: yaml display: - platform: ... @@ -282,7 +282,7 @@ The last printf tip for use in displays I will discuss here is how to display bi you want to be efficient you can use an *inline if* too. With the ``%s`` print specifier you can tell it to use any string you pass it, like ``"ON"`` or ``"OFF"``. -.. code:: yaml +.. code-block:: yaml binary_sensor: - platform: ... @@ -316,7 +316,7 @@ With esphomelib you can also display the current time using the NTP protocol. Pl Images ^^^^^^ -.. code:: yaml +.. code-block:: yaml image: - file: "image.png" @@ -339,7 +339,7 @@ Configuration variables: And then later in code: -.. code:: yaml +.. code-block:: yaml display: - platform: ... diff --git a/esphomeyaml/components/display/lcd_gpio.rst b/esphomeyaml/components/display/lcd_gpio.rst index 431bfbc93b..847088df97 100644 --- a/esphomeyaml/components/display/lcd_gpio.rst +++ b/esphomeyaml/components/display/lcd_gpio.rst @@ -21,7 +21,7 @@ commonly sold with a PCF8574 chip which only need two lines to the ESP, for that :align: center :width: 60.0% -.. code:: yaml +.. code-block:: yaml # Example configuration entry display: @@ -71,7 +71,7 @@ Each of the three methods (``print``, ``printf`` and ``strftime``) all optionall beginning which can be used to print the text at a specific position. These arguments are set to ``0`` (column) and ``0`` (row) by default which means the character at the top left. -.. code:: yaml +.. code-block:: yaml display: - platform: lcd_gpio # or lcd_pcf8574 diff --git a/esphomeyaml/components/display/lcd_pcf8574.rst b/esphomeyaml/components/display/lcd_pcf8574.rst index d2c70cb11c..c8e0773493 100644 --- a/esphomeyaml/components/display/lcd_pcf8574.rst +++ b/esphomeyaml/components/display/lcd_pcf8574.rst @@ -23,7 +23,7 @@ As the communication with the :ref:`I²C Bus `, you need to have an ``i2c:` :align: center :width: 60.0% -.. code:: yaml +.. code-block:: yaml # Example configuration entry i2c: diff --git a/esphomeyaml/components/display/max7219.rst b/esphomeyaml/components/display/max7219.rst index e0807389c2..6e0282ab9d 100644 --- a/esphomeyaml/components/display/max7219.rst +++ b/esphomeyaml/components/display/max7219.rst @@ -24,7 +24,7 @@ You can even daisy-chain multiple MAX7219s by connecting the DOUT of the previou next DIN. With more than ~3 chips the 3.3V will probably not be enough, so then you will have to potentially use a logic level converted. -.. code:: yaml +.. code-block:: yaml # Example configuration entry spi: @@ -75,7 +75,7 @@ the end of the first MAX7219, you would write ``it.print(7, "0");``. Also note that the ``.`` (dot) character is special because when esphomelib encounters it in the string the dot segment of the previous position will be enabled. -.. code:: yaml +.. code-block:: yaml display: - platform: max7219 diff --git a/esphomeyaml/components/display/nextion.rst b/esphomeyaml/components/display/nextion.rst index 13240f14ca..1641033822 100644 --- a/esphomeyaml/components/display/nextion.rst +++ b/esphomeyaml/components/display/nextion.rst @@ -24,7 +24,7 @@ As the communication with the MH-Z19 is done using UART, you need to have an :re in your configuration with ``rx_pin`` both the ``tx_pin`` set to the respective pins on the display. Additionally, you need to set the baud rate to 9600. -.. code:: yaml +.. code-block:: yaml # Example configuration entry uart: @@ -62,7 +62,7 @@ First, you need to use the `Nextion Editor ` - `Simple Nextion Library `__ by `Bentley Born `__ -- `Official Nextion Library `__ by `iTead `__ +- `Official Nextion Library `__ by `iTead `__ - `Edit this page on GitHub `__ .. disqus:: diff --git a/esphomeyaml/components/display/ssd1306_i2c.rst b/esphomeyaml/components/display/ssd1306_i2c.rst index 71a582fc39..8839fc2120 100644 --- a/esphomeyaml/components/display/ssd1306_i2c.rst +++ b/esphomeyaml/components/display/ssd1306_i2c.rst @@ -21,7 +21,7 @@ Connect D0 to the SCL pin you chose for the :ref:`I²C Bus `, and connect D VCC to 3.3V and GND to GND. Optionally you can also connect the ``RESET`` pin to a pin on the ESP which may improve reliability. -.. code:: yaml +.. code-block:: yaml # Example configuration entry i2c: @@ -66,7 +66,7 @@ See Also - :doc:`index` - :doc:`API Reference ` -- `SSD1306 Library `__ by `Adafruit `__ +- `SSD1306 Library `__ by `Adafruit `__ - `Edit this page on GitHub `__ .. disqus:: diff --git a/esphomeyaml/components/display/ssd1306_spi.rst b/esphomeyaml/components/display/ssd1306_spi.rst index 338e72fe2e..4d75172f18 100644 --- a/esphomeyaml/components/display/ssd1306_spi.rst +++ b/esphomeyaml/components/display/ssd1306_spi.rst @@ -22,7 +22,7 @@ to some GPIO pins on the ESP. For power, connect VCC to 3.3V and GND to GND. Optionally you can also connect the ``RESET`` pin to a pin on the ESP which may improve reliability. -.. code:: yaml +.. code-block:: yaml # Example configuration entry spi: @@ -71,7 +71,7 @@ See Also - :doc:`index` - :doc:`API Reference ` -- `SSD1306 Library `__ by `Adafruit `__ +- `SSD1306 Library `__ by `Adafruit `__ - `Edit this page on GitHub `__ .. disqus:: diff --git a/esphomeyaml/components/display/waveshare_epaper.rst b/esphomeyaml/components/display/waveshare_epaper.rst index 98dc4bcde7..e842b0b4e4 100644 --- a/esphomeyaml/components/display/waveshare_epaper.rst +++ b/esphomeyaml/components/display/waveshare_epaper.rst @@ -47,7 +47,7 @@ configuration. :align: center :width: 60.0% -.. code:: yaml +.. code-block:: yaml # Example configuration entry spi: diff --git a/esphomeyaml/components/esp32_ble_beacon.rst b/esphomeyaml/components/esp32_ble_beacon.rst index 5d2a49e13a..dd1da7ca3c 100644 --- a/esphomeyaml/components/esp32_ble_beacon.rst +++ b/esphomeyaml/components/esp32_ble_beacon.rst @@ -3,14 +3,14 @@ ESP32 Bluetooth Low Energy Beacon .. seo:: :description: Instructions for setting up Bluetooth Low Energy iBeacons using the BLE feature on ESP32s. - :image: bluetooth.svg + :image: bluetooth.png The ``esp32_ble_beacon`` component creates a Bluetooth Low Energy Beacon with your ESP32 device. Beacons are BLE devices that repeatedly just send out a pre-defined packet of data. This packet can then be received by devices like smartphones and can then be used to track a phone's location. -.. code:: yaml +.. code-block:: yaml # Example configuration entry esp32_ble_beacon: diff --git a/esphomeyaml/components/esp32_ble_tracker.rst b/esphomeyaml/components/esp32_ble_tracker.rst index 83e69edd0a..7bd0d14bde 100644 --- a/esphomeyaml/components/esp32_ble_tracker.rst +++ b/esphomeyaml/components/esp32_ble_tracker.rst @@ -3,7 +3,7 @@ ESP32 Bluetooth Low Energy Tracker Hub .. seo:: :description: Instructions for setting up ESP32 bluetooth low energy device trackers using esphomelib. - :image: bluetooth.svg + :image: bluetooth.png The ``esp32_ble_tracker`` component creates a global hub so that you can track bluetooth low energy devices using your ESP32 node. @@ -11,7 +11,7 @@ energy devices using your ESP32 node. See :ref:`Setting up devices ` for information on how you can find out the MAC address of a device and track it using esphomelib. -.. code:: yaml +.. code-block:: yaml # Example configuration entry esp32_ble_tracker: diff --git a/esphomeyaml/components/esp32_touch.rst b/esphomeyaml/components/esp32_touch.rst index 8de673099b..eeb89cba2c 100644 --- a/esphomeyaml/components/esp32_touch.rst +++ b/esphomeyaml/components/esp32_touch.rst @@ -3,12 +3,12 @@ ESP32 Touch Pad Hub .. seo:: :description: Instructions for setting up the touch pad feature on the ESP32. - :image: touch.svg + :image: touch.png The ``esp32_touch`` component creates a global hub for detecting touches on the eight touch pads of the ESP32 as :doc:`binary senors `. -.. code:: yaml +.. code-block:: yaml # Example configuration entry esp32_touch: @@ -42,13 +42,13 @@ Advanced options (the defaults are usually quite good, but if you're having accu time for all touch pads. A longer conversion time means that more charge/discharge cycles of the touch pad can be performed, therefore increasing accuracy. Default is about 8ms, the maximum amount. - **low_voltage_reference** (*Optional*): The low voltage reference to use for the charge cycles. See - the `esp-idf docs `__ + the `esp-idf docs `__ for a nice explanation of this. One of ``0.5V``, ``0.6V``, ``0.7V``, ``0.8V``. Default is ``0.5V``. - **high_voltage_reference** (*Optional*): The high voltage reference to use for the charge cycles. See - the `esp-idf docs `__ + the `esp-idf docs `__ for a nice explanation of this. One of ``2.4V``, ``2.5V``, ``2.6V``, ``2.7V``. Default is ``2.7V``. - **voltage_attenuation** (*Optional*): The voltage attenuation to use for the charge cycles. See - the `esp-idf docs `__ + the `esp-idf docs `__ for a nice explanation of this. One of ``1.5V``, ``1V``, ``0.5V``, ``0V``. Default is ``0V``. See Also diff --git a/esphomeyaml/components/esphomeyaml.rst b/esphomeyaml/components/esphomeyaml.rst index ffd80e70db..5cc5392ff7 100644 --- a/esphomeyaml/components/esphomeyaml.rst +++ b/esphomeyaml/components/esphomeyaml.rst @@ -3,14 +3,14 @@ esphomeyaml Core Configuration .. seo:: :description: Instructions for setting up the core esphomeyaml configuration. - :image: cloud-circle.svg + :image: cloud-circle.png Here you specify some core information that esphomeyaml needs to create firmwares. Most importantly, this is the section of the configuration where you specify the **name** of the node, the **platform** and **board** you’re using. -.. code:: yaml +.. code-block:: yaml # Example configuration entry esphomeyaml: @@ -67,7 +67,7 @@ using this configuration option. First, you can configure the use of either the latest esphomelib stable release (``latest``), the latest development code from GitHub (``dev``), or a specific version number (``1.8.0``). -.. code:: yaml +.. code-block:: yaml # Example configuration entry esphomeyaml: @@ -85,7 +85,7 @@ Alternatively, if you want to develop for esphomelib, you can download the `latest code from GitHub `, extract the contents, and point esphomeyaml to your local copy. Then you can modify the esphomelib to your needs or to fix bugs. -.. code:: yaml +.. code-block:: yaml # Example configuration entry esphomeyaml: @@ -96,7 +96,7 @@ and point esphomeyaml to your local copy. Then you can modify the esphomelib to And last, you can make esphomeyaml use a specific branch/commit/tag from a remote git repository: -.. code:: yaml +.. code-block:: yaml # Example configuration entry esphomeyaml: @@ -125,7 +125,7 @@ initializing the WiFi driver and so on. Unfortunately, every arduino framework v has its own quirks and bugs, especially concerning WiFi performance. With the ``arduino_version`` option you can tell esphomeyaml which arduino framework to use for compiling. -.. code:: yaml +.. code-block:: yaml # Example configuration entry esphomeyaml: @@ -167,7 +167,7 @@ For the ESP32, there's currently only one arduino framework version: This automation will be triggered when the ESP boots up. By default, it is executed after everything else is already set up. You can however change this using the ``priority`` parameter. -.. code:: yaml +.. code-block:: yaml esphomeyaml: # ... @@ -206,7 +206,7 @@ too many WiFi/MQTT connection attempts, Over-The-Air updates being applied or th It's not guaranteed that all components are in a connected state when this automation is triggered. For example, the MQTT client may have already disconnected. -.. code:: yaml +.. code-block:: yaml esphomeyaml: # ... @@ -223,7 +223,7 @@ Configuration variables: See :ref:`Automation `. This automation will be triggered on every ``loop()`` iteration (usually around every 16 milliseconds). -.. code:: yaml +.. code-block:: yaml esphomeyaml: # ... diff --git a/esphomeyaml/components/fan/binary.rst b/esphomeyaml/components/fan/binary.rst index fcc2f43e27..1727728f27 100644 --- a/esphomeyaml/components/fan/binary.rst +++ b/esphomeyaml/components/fan/binary.rst @@ -3,7 +3,7 @@ Binary Fan .. seo:: :description: Instructions for setting up binary fans. - :image: fan.svg + :image: fan.png The ``binary`` fan platform lets you represent any binary :ref:`output` as a fan. @@ -11,7 +11,7 @@ The ``binary`` fan platform lets you represent any binary :ref:`output` as a fan :align: center :width: 80.0% -.. code:: yaml +.. code-block:: yaml # Example configuration entry fan: diff --git a/esphomeyaml/components/fan/index.rst b/esphomeyaml/components/fan/index.rst index 537dad95c6..e9b9312533 100644 --- a/esphomeyaml/components/fan/index.rst +++ b/esphomeyaml/components/fan/index.rst @@ -3,7 +3,7 @@ Fan Component .. seo:: :description: Instructions for setting up the base fan component. - :image: folder-open.svg + :image: folder-open.png With the ``fan`` domain you can create components that appear as fans in the Home Assistant frontend. A fan can be switched ON or OFF, optionally @@ -19,7 +19,7 @@ oscillate output. Base Fan Configuration ---------------------- -.. code:: yaml +.. code-block:: yaml fan: - platform: ... @@ -45,7 +45,7 @@ Configuration variables: Toggles the ON/OFF state of the fan with the given ID when executed. -.. code:: yaml +.. code-block:: yaml on_...: then: @@ -58,7 +58,7 @@ Toggles the ON/OFF state of the fan with the given ID when executed. Turns the fan with the given ID off when executed. -.. code:: yaml +.. code-block:: yaml on_...: then: @@ -71,7 +71,7 @@ Turns the fan with the given ID off when executed. Turns the fan with the given ID off when executed. -.. code:: yaml +.. code-block:: yaml on_...: then: diff --git a/esphomeyaml/components/fan/speed.rst b/esphomeyaml/components/fan/speed.rst index f72854250a..b31a7f23cc 100644 --- a/esphomeyaml/components/fan/speed.rst +++ b/esphomeyaml/components/fan/speed.rst @@ -3,7 +3,7 @@ Speed Fan .. seo:: :description: Instructions for setting up speed-controllable fans. - :image: fan.svg + :image: fan.png The ``speed`` fan platform lets you represent any float :ref:`output` as a fan that supports speed settings. @@ -12,7 +12,7 @@ supports speed settings. :align: center :width: 80.0% -.. code:: yaml +.. code-block:: yaml # Example configuration entry fan: diff --git a/esphomeyaml/components/i2c.rst b/esphomeyaml/components/i2c.rst index 16c4725a31..f4e92d7cae 100644 --- a/esphomeyaml/components/i2c.rst +++ b/esphomeyaml/components/i2c.rst @@ -5,13 +5,13 @@ I²C Bus .. seo:: :description: Instructions for setting up the i2c bus to communicate with 2-wire devices in esphomelib - :image: i2c.svg + :image: i2c.png :keywords: i2c, iic, bus This component sets up the i²c bus for your ESP32 or ESP8266. In order for those components to work correctly, you need to define the i²c bus in your configuration. -.. code:: yaml +.. code-block:: yaml # Example configuration entry i2c: diff --git a/esphomeyaml/components/light/binary.rst b/esphomeyaml/components/light/binary.rst index 52acb35658..57ade694ed 100644 --- a/esphomeyaml/components/light/binary.rst +++ b/esphomeyaml/components/light/binary.rst @@ -3,7 +3,7 @@ Binary Light .. seo:: :description: Instructions for setting up binary ON/OFF lights in esphomelib. - :image: lightbulb.svg + :image: lightbulb.png The ``binary`` light platform creates a simple ON/OFF-only light from a :ref:`binary output component `. @@ -12,7 +12,7 @@ The ``binary`` light platform creates a simple ON/OFF-only light from a :align: center :width: 40.0% -.. code:: yaml +.. code-block:: yaml # Example configuration entry light: diff --git a/esphomeyaml/components/light/cwww.rst b/esphomeyaml/components/light/cwww.rst index ca601ad7b1..78660e8c96 100644 --- a/esphomeyaml/components/light/cwww.rst +++ b/esphomeyaml/components/light/cwww.rst @@ -3,13 +3,13 @@ Cold White + Warm White Light .. seo:: :description: Instructions for setting up Cold White + Warm White lights. - :image: brightness-medium.svg + :image: brightness-medium.png The ``cwww`` light platform creates an Cold-White+Warm-White light from 2 :ref:`float output components ` (one for each channel). The two channels will be mixed using the color temperature configuration options. -.. code:: yaml +.. code-block:: yaml # Example configuration entry light: diff --git a/esphomeyaml/components/light/fastled_clockless.rst b/esphomeyaml/components/light/fastled_clockless.rst index fab18bf507..4613423508 100644 --- a/esphomeyaml/components/light/fastled_clockless.rst +++ b/esphomeyaml/components/light/fastled_clockless.rst @@ -3,7 +3,7 @@ FastLED Clockless Light .. seo:: :description: Instructions for setting up FastLED addressable lights like NEXTION. - :image: color_lens.svg + :image: color_lens.png The ``fastled_clockless`` light platform allows you to create RGB lights in esphomelib for a :ref:`number of supported chipsets `. @@ -15,7 +15,7 @@ Clockless FastLED lights differ from the :align: center :width: 60.0% -.. code:: yaml +.. code-block:: yaml # Example configuration entry light: diff --git a/esphomeyaml/components/light/fastled_spi.rst b/esphomeyaml/components/light/fastled_spi.rst index f4a8061327..8863044b88 100644 --- a/esphomeyaml/components/light/fastled_spi.rst +++ b/esphomeyaml/components/light/fastled_spi.rst @@ -3,7 +3,7 @@ FastLED SPI Light .. seo:: :description: Instructions for setting up other FastLED addressable lights. - :image: color_lens.svg + :image: color_lens.png The ``fastled_spi`` light platform allows you to create RGB lights in esphomelib for a :ref:`number of supported chipsets `. @@ -16,7 +16,7 @@ whereas the clockless lights only need a single pin. :align: center :width: 60.0% -.. code:: yaml +.. code-block:: yaml # Example configuration entry light: diff --git a/esphomeyaml/components/light/index.rst b/esphomeyaml/components/light/index.rst index 28444de670..5383813da8 100644 --- a/esphomeyaml/components/light/index.rst +++ b/esphomeyaml/components/light/index.rst @@ -3,7 +3,7 @@ Light Component .. seo:: :description: Instructions for setting up lights and light effects in esphomelib. - :image: folder-open.svg + :image: folder-open.png The ``light`` domain in esphomeyaml lets you create lights that will automatically be shown in Home Assistant’s frontend and have many @@ -16,7 +16,7 @@ features such as RGB colors, transitions, flashing and effects. This action toggles a light with the given ID when executed. -.. code:: yaml +.. code-block:: yaml on_...: then: @@ -35,7 +35,7 @@ Configuration options: This action can also be expressed in :ref:`lambdas `: - .. code:: cpp + .. code-block:: cpp auto call = id(light_1).toggle(); // perform action: @@ -48,7 +48,7 @@ Configuration options: This action turns a light with the given ID on when executed. -.. code:: yaml +.. code-block:: yaml on_...: then: @@ -93,7 +93,7 @@ Configuration options: This action can also be expressed in :ref:`lambdas `: - .. code:: cpp + .. code-block:: cpp auto call = id(light_1).turn_on(); // set parameters (optional) @@ -111,7 +111,7 @@ Configuration options: This action turns a light with the given ID off when executed. -.. code:: yaml +.. code-block:: yaml on_...: then: @@ -131,7 +131,7 @@ Configuration options: This action can also be expressed in :ref:`lambdas `: - .. code:: cpp + .. code-block:: cpp auto call = id(light_1).turn_off(); // set parameters (optional) @@ -152,7 +152,7 @@ With esphomelib's light effects system you're basically creating a bunch of entr Home Assistant. If you wish to have several variants of the same effect you can of course also create multiple entries with each having a unique name like so: -.. code:: yaml +.. code-block:: yaml light: - platform: ... @@ -172,7 +172,7 @@ Random Effect This effect makes a transition (of length ``transition_length``) to a randomly-chosen color every ``update_interval``. -.. code:: yaml +.. code-block:: yaml light: - platform: ... @@ -196,7 +196,7 @@ Strobe Effect This effect cycles through a list of colors with specific durations. -.. code:: yaml +.. code-block:: yaml light: - platform: ... @@ -239,7 +239,7 @@ Flicker Effect This effect "hovers" around the active color of the light and flickers each color channel a bit. -.. code:: yaml +.. code-block:: yaml light: - platform: ... @@ -264,7 +264,7 @@ Lambda Effect This effect allows you to write completely custom light effects yourself using :ref:`lambdas `. -.. code:: yaml +.. code-block:: yaml light: - platform: ... @@ -302,7 +302,7 @@ FastLED Rainbow Effect A light effect for individually-addressable LEDs that creates a moving rainbow over the whole LED strip using the HSV color wheel. -.. code:: yaml +.. code-block:: yaml light: - platform: fastled_... @@ -327,7 +327,7 @@ FastLED Color Wipe Effect A light effect for individually-addressable LEDs that continuously introduces new colors at the beginning of the strip and shifts them forward every ``add_led_interval``. -.. code:: yaml +.. code-block:: yaml light: - platform: fastled_... @@ -371,7 +371,7 @@ FastLED Scan Effect Create a single, fast-moving dot moving back and forth an individually-addressable LED strip. The color is chosen by the currently active light color. -.. code:: yaml +.. code-block:: yaml light: - platform: fastled_... @@ -395,7 +395,7 @@ A light effect for individually-addressable LED strips that randomly chooses som up for a moment, like a stars twinkling in the night's sky. The color of the pixels will be chosen by the currently active light color. -.. code:: yaml +.. code-block:: yaml light: - platform: fastled_... @@ -420,7 +420,7 @@ FastLED Random Twinkle Effect A light effect similar to ``fastled_twinkle``, but using random colors for each twinkle animation. -.. code:: yaml +.. code-block:: yaml light: - platform: fastled_... @@ -447,7 +447,7 @@ FastLED Fireworks Effect A light effect for individually-addressable LED strips that randomly sparks some fireworks at random positions and lets the sparkles cascade over the LED strip. -.. code:: yaml +.. code-block:: yaml light: - platform: fastled_... @@ -480,7 +480,7 @@ FastLED Flicker Effect An effect similar to the ``flicker`` effect, but for individually-addressable LED strips. This effect flickers each LED by its own random amount around the currently active light color. -.. code:: yaml +.. code-block:: yaml light: - platform: fastled_... diff --git a/esphomeyaml/components/light/monochromatic.rst b/esphomeyaml/components/light/monochromatic.rst index fddc877fcd..1167452aa5 100644 --- a/esphomeyaml/components/light/monochromatic.rst +++ b/esphomeyaml/components/light/monochromatic.rst @@ -3,7 +3,7 @@ Monochromatic Light .. seo:: :description: Instructions for setting up monochromatic (brightness-only) lights. - :image: brightness-medium.svg + :image: brightness-medium.png The ``monochromatic`` light platform creates a simple brightness-only light from an :ref:`float output component `. @@ -18,7 +18,7 @@ The ``monochromatic`` light platform creates a simple brightness-only light from :align: center :width: 40.0% -.. code:: yaml +.. code-block:: yaml # Example configuration entry light: diff --git a/esphomeyaml/components/light/rgb.rst b/esphomeyaml/components/light/rgb.rst index 8fa28ce1fd..286c966e3b 100644 --- a/esphomeyaml/components/light/rgb.rst +++ b/esphomeyaml/components/light/rgb.rst @@ -18,7 +18,7 @@ The ``rgb`` light platform creates an RGB light from 3 :ref:`float output compon :align: center :width: 40.0% -.. code:: yaml +.. code-block:: yaml # Example configuration entry light: diff --git a/esphomeyaml/components/light/rgbw.rst b/esphomeyaml/components/light/rgbw.rst index 3f0ddf4ad7..0fdefaec1e 100644 --- a/esphomeyaml/components/light/rgbw.rst +++ b/esphomeyaml/components/light/rgbw.rst @@ -7,7 +7,7 @@ RGBW Light The ``rgbw`` light platform creates an RGBW light from 4 :ref:`float output components ` (one for each channel). -.. code:: yaml +.. code-block:: yaml # Example configuration entry light: diff --git a/esphomeyaml/components/light/rgbww.rst b/esphomeyaml/components/light/rgbww.rst index 89bfd8cc40..fc4e13d513 100644 --- a/esphomeyaml/components/light/rgbww.rst +++ b/esphomeyaml/components/light/rgbww.rst @@ -9,7 +9,7 @@ The ``rgbww`` light platform creates an RGBWW (cold white + warm white) light from 5 :ref:`float output components ` (one for each channel). The cold white and warm white channels will be mixed using the color temperature configuration options. -.. code:: yaml +.. code-block:: yaml # Example configuration entry light: diff --git a/esphomeyaml/components/logger.rst b/esphomeyaml/components/logger.rst index fa33f9394f..bc94c5a90a 100644 --- a/esphomeyaml/components/logger.rst +++ b/esphomeyaml/components/logger.rst @@ -3,14 +3,14 @@ Logger Component .. seo:: :description: Instructions for setting up the central logging component in esphomelib. - :image: file-document-box.svg + :image: file-document-box.png The logger component automatically logs all log messages through the serial port and through MQTT topics. By default, all logs with a severity higher than ``DEBUG`` will be shown. Decreasing the log level can help with the performance of the application and memory size. -.. code:: yaml +.. code-block:: yaml # Example configuration entry logger: @@ -64,7 +64,7 @@ the tag for MQTT components is ``mqtt.component``. Next, we can manually set the log levels in the configuration like this: -.. code:: yaml +.. code-block:: yaml logger: level: VERBOSE @@ -87,7 +87,7 @@ Print a formatted message to the logs. In the ``format`` option, you can use ``printf``-style formatting (see :ref:`display-printf`). -.. code:: yaml +.. code-block:: yaml on_...: then: diff --git a/esphomeyaml/components/mqtt.rst b/esphomeyaml/components/mqtt.rst index fdff7a415d..45e67ffe51 100644 --- a/esphomeyaml/components/mqtt.rst +++ b/esphomeyaml/components/mqtt.rst @@ -12,7 +12,7 @@ just be able to copy over the `MQTT section `__ of your Home Assistant configuration. -.. code:: yaml +.. code-block:: yaml # Example configuration entry mqtt: @@ -72,7 +72,7 @@ MQTTMessage With the MQTT Message schema you can tell esphomeyaml how a specific MQTT message should be sent. It is used in several places like last will and birth messages or MQTT log options. -.. code:: yaml +.. code-block:: yaml # Simple: some_option: topic/to/send/to @@ -115,7 +115,7 @@ broker (like `mosquitto `__) and point both your Home Assistant installation and esphomelib to that broker. Next, enable discovery in your Home Assistant configuration with the following: -.. code:: yaml +.. code-block:: yaml # Example Home Assistant configuration.yaml entry mqtt: @@ -136,7 +136,7 @@ esphomeyaml anymore. To fix this, esphomeyaml has a simple helper script that purges stale retained messages for you: -.. code:: bash +.. code-block:: bash esphomeyaml configuration.yaml clean-mqtt @@ -184,7 +184,7 @@ broker to send a message ``/status`` with payload You can change these messages by overriding the ``birth_message`` and ``will_message`` with the following options. -.. code:: yaml +.. code-block:: yaml mqtt: # ... @@ -217,13 +217,13 @@ and with some computing power the fingerprint can be faked. To get this fingerprint, first put the broker and port options in the configuration and then run the ``mqtt-fingerprint`` script of esphomeyaml to get the certificate: -.. code:: bash +.. code-block:: bash esphomeyaml livingroom.yaml mqtt-fingerprint > SHA1 Fingerprint: a502ff13999f8b398ef1834f1123650b3236fc07 > Copy above string into mqtt.ssl_fingerprints section of livingroom.yaml -.. code:: yaml +.. code-block:: yaml mqtt: # ... @@ -238,7 +238,7 @@ MQTT Component Base Configuration All components in esphomelib that do some sort of communication through MQTT can have some overrides for specific options. -.. code:: yaml +.. code-block:: yaml name: "Component Name" # Optional variables: @@ -286,7 +286,7 @@ With this configuration option you can write complex automations whenever an MQT message on a specific topic is received. To use the message content, use a :ref:`lambda ` template, the message payload is available under the name ``x`` inside that lambda. -.. code:: yaml +.. code-block:: yaml mqtt: # ... @@ -304,11 +304,14 @@ Configuration variables: - **qos** (*Optional*, integer): The MQTT Quality of Service to subscribe to the topic with. Defaults to 0. +- **payload** (*Optional*, string): Optionally set a payload to match. Only if exactly the payload + you specify with this option is received, the automation will be executed. + .. note:: You can even specify multiple ``on_message`` triggers by using a YAML list: - .. code:: yaml + .. code-block:: yaml mqtt: on_message: @@ -323,7 +326,7 @@ Configuration variables: This action can also be used in :ref:`lambdas `: - .. code:: cpp + .. code-block:: cpp App.get_mqtt_client()->subscribe("the/topic", [=](const std::string &payload) { // do something with payload @@ -345,7 +348,7 @@ Basically, you can access elements by typing ``x["THE_KEY"]`` and save them into Please note that it's a good idea to check if the key exists in the Json Object by calling ``containsKey`` first as the ESP will crash if an element that does not exist is accessed. -.. code:: yaml +.. code-block:: yaml mqtt: # ... @@ -386,7 +389,7 @@ Configuration variables: This action can also be used in :ref:`lambdas `: - .. code:: cpp + .. code-block:: cpp App.get_mqtt_client()->subscribe_json("the/topic", [=](JsonObject &root) { // do something with JSON-decoded value root @@ -399,7 +402,7 @@ Configuration variables: Publish an MQTT message on a topic using this action in automations. -.. code:: yaml +.. code-block:: yaml on_...: then: @@ -431,13 +434,13 @@ Configuration options: This action can also be written in :ref:`lambdas `: - .. code:: yaml + .. code-block:: yaml mqtt: # Give the mqtt component an ID id: mqtt_client - .. code:: cpp + .. code-block:: cpp id(mqtt_client).publish("the/topic", "The Payload"); @@ -453,7 +456,7 @@ In the ``payload`` option you have access to a ``root`` object which will repres of the JSON message. You can assign values to keys by using the ``root["KEY_NAME"] = VALUE;`` syntax as seen below. -.. code:: yaml +.. code-block:: yaml on_...: then: @@ -482,13 +485,13 @@ Configuration options: This action can also be written in :ref:`lambdas `: - .. code:: yaml + .. code-block:: yaml mqtt: # Give the mqtt component an ID id: mqtt_client - .. code:: cpp + .. code-block:: cpp id(mqtt_client).publish_json("the/topic", [=](JsonObject &root) { root["something"] = id(my_sensor).value; diff --git a/esphomeyaml/components/my9231.rst b/esphomeyaml/components/my9231.rst index ad6f03cc2f..3c107d4df6 100644 --- a/esphomeyaml/components/my9231.rst +++ b/esphomeyaml/components/my9231.rst @@ -3,7 +3,7 @@ MY9231/MY9291 LED driver Component .. seo:: :description: Instructions for setting up MY9231 and MY9291 LED drives in esphomelib. - :image: my9231.svg + :image: my9231.png :keywords: MY9231, MY9291, Sonoff B1, Ai-thinker AiLight WiFi light bulb, Arilux E27 Smart Bulb The MY9231/MY9291 component represents a MY9231/MY9291 LED diver chain @@ -40,7 +40,7 @@ global ``my9231`` hub and give it an id, and then define the internal data will not reflect this state. Thus, the first fade is wrong, as well as the MQTT state. -.. code:: yaml +.. code-block:: yaml # Example configuration entry my9231: @@ -83,7 +83,7 @@ about flashing Sonoff devices, see: chain of two MY9321 chips that are connected to GPIO12 and GPIO14. A complete configuration for a Sonoff B1 looks like: -.. code:: yaml +.. code-block:: yaml esphomeyaml: name: diff --git a/esphomeyaml/components/ota.rst b/esphomeyaml/components/ota.rst index b0fa19b233..f14ab47a66 100644 --- a/esphomeyaml/components/ota.rst +++ b/esphomeyaml/components/ota.rst @@ -3,7 +3,7 @@ OTA Update Component .. seo:: :description: Instructions for setting up Over-The-Air (OTA) updates for ESPs to upload firmwares remotely. - :image: system-update.svg + :image: system-update.png :keywords: Xiaomi, Mi Flora, BLE, Bluetooth With the OTA (Over The Air) update component you can upload your @@ -32,7 +32,7 @@ this and will go over into a safe mode after 10 unsuccessful boot attempts. In that mode, all components are disabled and only Serial Logging+WiFi+OTA are initialized, so that you can upload a new binary. -.. code:: yaml +.. code-block:: yaml # Example configuration entry ota: diff --git a/esphomeyaml/components/output/esp8266_pwm.rst b/esphomeyaml/components/output/esp8266_pwm.rst index 5e2b22c489..0a123a9885 100644 --- a/esphomeyaml/components/output/esp8266_pwm.rst +++ b/esphomeyaml/components/output/esp8266_pwm.rst @@ -16,7 +16,7 @@ limitations. If you need a stable PWM signal, it’s definitely recommended to use the successor of the ESP8266, the ESP32, and its :doc:`ESP32 LEDC PWM ` instead. -.. code:: yaml +.. code-block:: yaml # Example configuration entry output: diff --git a/esphomeyaml/components/output/gpio.rst b/esphomeyaml/components/output/gpio.rst index 153d971a6b..df6899073d 100644 --- a/esphomeyaml/components/output/gpio.rst +++ b/esphomeyaml/components/output/gpio.rst @@ -3,13 +3,13 @@ GPIO Output .. seo:: :description: Instructions for setting up binary outputs for GPIO pins. - :image: pin.svg + :image: pin.png The GPIO output component is quite simple: It exposes a single GPIO pin as an output component. Note that output components are **not** switches and will not show up in Home Assistant. See :doc:`GPIO Switch `. -.. code:: yaml +.. code-block:: yaml # Example configuration entry output: diff --git a/esphomeyaml/components/output/index.rst b/esphomeyaml/components/output/index.rst index 08c3f71a44..9d78ee672c 100644 --- a/esphomeyaml/components/output/index.rst +++ b/esphomeyaml/components/output/index.rst @@ -5,7 +5,7 @@ Output Component .. seo:: :description: Instructions for setting up generic outputs in esphomelib - :image: folder-open.svg + :image: folder-open.png Each platform of the ``output`` domain exposes some output to esphomelib. These are grouped into two categories: ``binary`` outputs @@ -19,7 +19,7 @@ Base Output Configuration Each output platform extends this configuration schema. -.. code:: yaml +.. code-block:: yaml # Example configuration entry output: @@ -50,7 +50,7 @@ Configuration variables: This action turns the output with the given ID on when executed. -.. code:: yaml +.. code-block:: yaml on_...: then: @@ -60,7 +60,7 @@ This action turns the output with the given ID on when executed. This action can also be expressed in :ref:`lambdas `: - .. code:: cpp + .. code-block:: cpp id(relay_1).turn_on(); @@ -71,7 +71,7 @@ This action turns the output with the given ID on when executed. This action turns the output with the given ID off when executed. -.. code:: yaml +.. code-block:: yaml on_...: then: @@ -81,7 +81,7 @@ This action turns the output with the given ID off when executed. This action can also be expressed in :ref:`lambdas `: - .. code:: cpp + .. code-block:: cpp id(relay_1).turn_off(); @@ -93,7 +93,7 @@ This action turns the output with the given ID off when executed. This action sets the float output to the given level when executed. Note: This only works with floating point outputs like ESP8266 PWM or LEDC. -.. code:: yaml +.. code-block:: yaml on_...: then: @@ -105,7 +105,7 @@ works with floating point outputs like ESP8266 PWM or LEDC. This action can also be expressed in :ref:`lambdas `: - .. code:: cpp + .. code-block:: cpp // range is 0.0 (off) to 1.0 (on) id(relay_1).set_level(0.5); diff --git a/esphomeyaml/components/output/ledc.rst b/esphomeyaml/components/output/ledc.rst index 1f364e6ea5..9e54a0572b 100644 --- a/esphomeyaml/components/output/ledc.rst +++ b/esphomeyaml/components/output/ledc.rst @@ -6,10 +6,10 @@ ESP32 LEDC Output :image: pwm.png The LEDC output component exposes a `LEDC PWM -channel `__ +channel `__ of the ESP32 as an output component. -.. code:: yaml +.. code-block:: yaml # Example configuration entry output: @@ -27,7 +27,7 @@ Configuration variables: therefore also the same frequency. Defaults to 1000Hz. - **bit_depth** (*Optional*, int): The bit depth to use for the LEDC channel. Defaults to 12. - **channel** (*Optional*, int): Manually set the `LEDC - channel `__ + channel `__ to use. Two adjacent channels share the same timer. Defaults to an automatic selection. - All other options from :ref:`Output `. @@ -40,7 +40,7 @@ See Also - :doc:`/esphomeyaml/components/fan/speed` - :doc:`/esphomeyaml/components/power_supply` - :doc:`API Reference ` -- `esp-idf LEDC API docs `__ +- `esp-idf LEDC API docs `__ - `Edit this page on GitHub `__ .. disqus:: diff --git a/esphomeyaml/components/output/my9231.rst b/esphomeyaml/components/output/my9231.rst index b7da82510c..8b6e7aca25 100644 --- a/esphomeyaml/components/output/my9231.rst +++ b/esphomeyaml/components/output/my9231.rst @@ -3,12 +3,12 @@ MY9231/MY9291 Output .. seo:: :description: Instructions for setting up MY931 and MY9231 outputs. - :image: my9231.svg + :image: my9231.png The MY931/MY9291 output component exposes a MY931/MY9291 channel of a global :doc:`/esphomeyaml/components/my9231` as a float output. -.. code:: yaml +.. code-block:: yaml # Example configuration entry my9231: diff --git a/esphomeyaml/components/output/pca9685.rst b/esphomeyaml/components/output/pca9685.rst index a6db27effd..67f2461b15 100644 --- a/esphomeyaml/components/output/pca9685.rst +++ b/esphomeyaml/components/output/pca9685.rst @@ -15,7 +15,7 @@ output. PCA9685 16-Channel PWM Driver. -.. code:: yaml +.. code-block:: yaml # Example configuration entry pca9685: diff --git a/esphomeyaml/components/pca9685.rst b/esphomeyaml/components/pca9685.rst index 9a2e849a6e..e20ce71576 100644 --- a/esphomeyaml/components/pca9685.rst +++ b/esphomeyaml/components/pca9685.rst @@ -7,7 +7,7 @@ PCA9685 PWM Component :keywords: PCA9685 The PCA9685 component represents a PCA9685 12-bit PWM driver -(`datasheet `__, +(`datasheet `__, `adafruit `__) in esphomelib. It uses :ref:`I²C Bus ` for communication. @@ -15,7 +15,7 @@ To use the channels of this components, you first need to setup the global ``pca9685`` hub and give it an id, and then define the :doc:`individual output channels `. -.. code:: yaml +.. code-block:: yaml # Example configuration entry pca9685: diff --git a/esphomeyaml/components/pcf8574.rst b/esphomeyaml/components/pcf8574.rst index 21e03866cc..edc6de1ed4 100644 --- a/esphomeyaml/components/pcf8574.rst +++ b/esphomeyaml/components/pcf8574.rst @@ -27,7 +27,7 @@ not work. .. _Sparkfun: https://www.sparkfun.com/products/retired/8130 -.. code:: yaml +.. code-block:: yaml # Example configuration entry pcf8574: diff --git a/esphomeyaml/components/pn532.rst b/esphomeyaml/components/pn532.rst index 23c0a01b33..63765e897f 100644 --- a/esphomeyaml/components/pn532.rst +++ b/esphomeyaml/components/pn532.rst @@ -22,7 +22,7 @@ As the communication with the PN532 is done using SPI for this integration, you the board to the SPI mode (usually by setting the first one to OFF and the second one to ON). Additionally, you need to have an :ref:`spi bus ` in your configuration with both the **miso_pin** and **mosi_pin** set. -.. code:: yaml +.. code-block:: yaml # Example configuration entry spi: @@ -71,7 +71,7 @@ if the tag is re-read many times. The parameter ``x`` this trigger provides is of type ``std::string`` and is the tag UID in the format ``74-10-37-94``. The configuration below will for example publish the tag ID on the MQTT topic ``pn532/tag``. -.. code:: yaml +.. code-block:: yaml pn532: # ... diff --git a/esphomeyaml/components/power_supply.rst b/esphomeyaml/components/power_supply.rst index 8569ba4155..f64bd2a2df 100644 --- a/esphomeyaml/components/power_supply.rst +++ b/esphomeyaml/components/power_supply.rst @@ -3,7 +3,7 @@ Power Supply Component .. seo:: :description: Instructions for setting up power supplies which will automatically turn on together with outputs. - :image: power.svg + :image: power.png :keywords: power, ATX The ``power_supply`` component allows you to have a high power mode for @@ -16,7 +16,7 @@ will automatically switch on if any of the outputs are on. Furthermore, it also has a cooldown time that keeps the power supply on for a while after the last output has been disabled. -.. code:: yaml +.. code-block:: yaml # Example configuration entry power_supply: @@ -53,7 +53,7 @@ pin up when high power mode is needed. Most ATX power supplies however operate with an active-low configuration. Therefore their output needs to be inverted. -.. code:: yaml +.. code-block:: yaml power_supply: - id: 'atx_power_supply' diff --git a/esphomeyaml/components/rdm6300.rst b/esphomeyaml/components/rdm6300.rst index 0b871e6a8b..6a87230ff4 100644 --- a/esphomeyaml/components/rdm6300.rst +++ b/esphomeyaml/components/rdm6300.rst @@ -22,7 +22,7 @@ As the communication with the RDM6300 is done using UART, you need to have an :ref:`UART bus ` in your configuration with the ``rx_pin`` connected to the data pin of the RDM6300 and with the baud rate set to 9600 -.. code:: yaml +.. code-block:: yaml # Example configuration entry uart: diff --git a/esphomeyaml/components/remote_receiver.rst b/esphomeyaml/components/remote_receiver.rst index 753bbd5b8b..63fca29c39 100644 --- a/esphomeyaml/components/remote_receiver.rst +++ b/esphomeyaml/components/remote_receiver.rst @@ -3,7 +3,7 @@ Remote Receiver Component .. seo:: :description: Instructions for setting up remote receivers in esphomelib. - :image: remote.svg + :image: remote.png :keywords: RF, infrared The ``remote_receiver`` component lets you receive and decode any remote signal, these can @@ -14,7 +14,7 @@ receive, decode and dump all remote codes, and individual :doc:`remote receiver binary sensors ` which will trigger when they hear their own configured signal. -.. code:: yaml +.. code-block:: yaml # Example configuration entry remote_receiver: diff --git a/esphomeyaml/components/remote_transmitter.rst b/esphomeyaml/components/remote_transmitter.rst index fb37833876..03c9e53c3d 100644 --- a/esphomeyaml/components/remote_transmitter.rst +++ b/esphomeyaml/components/remote_transmitter.rst @@ -3,7 +3,7 @@ Remote Transmitter Component .. seo:: :description: Instructions for setting up remote transmitters in esphomelib - :image: remote.svg + :image: remote.png :keywords: RF, infrared The ``remote_transmitter`` component lets you send infrared messages to control @@ -18,7 +18,7 @@ Use-cases are for example infrared remotes or 433MHz signals. This component is *much* more accurate on the ESP32, since that chipset has a dedicated peripheral for sending exact signal sequences. -.. code:: yaml +.. code-block:: yaml # Example configuration entry remote_transmitter: diff --git a/esphomeyaml/components/sensor/adc.rst b/esphomeyaml/components/sensor/adc.rst index 03b889e256..a068c50bd1 100644 --- a/esphomeyaml/components/sensor/adc.rst +++ b/esphomeyaml/components/sensor/adc.rst @@ -3,7 +3,7 @@ Analog To Digital Sensor .. seo:: :description: Instructions for setting up built-in analog voltage sensors. - :image: flash.svg + :image: flash.png The Analog To Digital (``adc``) Sensor allows you to use the built-in ADC in your device to measure a voltage on certain pins. On the ESP8266 @@ -14,7 +14,7 @@ GPIO39 can be used. :align: center :width: 80.0% -.. code:: yaml +.. code-block:: yaml # Example configuration entry sensor: @@ -50,7 +50,7 @@ On the ESP32, the voltage measured with the ADC caps out at 1.1V by default as t or the attenuation of the ADC is set to ``0db`` by default. To measure voltages higher than 1.1V, set ``attenuation`` to one of the `following values -`__: +`__: - ``0db`` for a full-scale voltage of 1.1V (default) - ``2.5db`` for a full-scale voltage of 1.5V @@ -67,7 +67,7 @@ where you want to shut down the chip if the voltage is low when using a battery. To measure the VCC voltage, set ``pin:`` to ``VCC`` and make sure nothing is connected to the ``A0`` pin. -.. code:: yaml +.. code-block:: yaml sensor: - platform: adc diff --git a/esphomeyaml/components/sensor/ads1115.rst b/esphomeyaml/components/sensor/ads1115.rst index f97e0b9fc4..53758a2fe7 100644 --- a/esphomeyaml/components/sensor/ads1115.rst +++ b/esphomeyaml/components/sensor/ads1115.rst @@ -24,7 +24,7 @@ voltage to Home Assistant. :align: center :width: 80.0% -.. code:: yaml +.. code-block:: yaml ads1115: - address: 0x48 diff --git a/esphomeyaml/components/sensor/bh1750.rst b/esphomeyaml/components/sensor/bh1750.rst index 224baf8656..d6cbac7ca5 100644 --- a/esphomeyaml/components/sensor/bh1750.rst +++ b/esphomeyaml/components/sensor/bh1750.rst @@ -24,7 +24,7 @@ your configuration for this sensor to work. :align: center :width: 80.0% -.. code:: yaml +.. code-block:: yaml # Example configuration entry sensor: diff --git a/esphomeyaml/components/sensor/ble_rssi.rst b/esphomeyaml/components/sensor/ble_rssi.rst index e1a2629e4c..3d56f1c704 100644 --- a/esphomeyaml/components/sensor/ble_rssi.rst +++ b/esphomeyaml/components/sensor/ble_rssi.rst @@ -3,14 +3,14 @@ ESP32 Bluetooth Low Energy RSSI Sensor .. seo:: :description: Instructions for setting up RSSI sensors for the ESP32 BLE. - :image: bluetooth.svg + :image: bluetooth.png :keywords: ESP32 The ``ble_rssi`` sensor platform lets you track the RSSI value or signal strength of a BLE device. See :ref:`the binary sensor setup ` for instructions for setting up this platform. -.. code:: yaml +.. code-block:: yaml # Example configuration entry esp32_ble_tracker: diff --git a/esphomeyaml/components/sensor/bme280.rst b/esphomeyaml/components/sensor/bme280.rst index 204fb72b2f..1ccb21141c 100644 --- a/esphomeyaml/components/sensor/bme280.rst +++ b/esphomeyaml/components/sensor/bme280.rst @@ -19,7 +19,7 @@ required to be set up in your configuration for this sensor to work. .. _Adafruit: https://www.adafruit.com/product/2652 -.. code:: yaml +.. code-block:: yaml # Example configuration entry sensor: diff --git a/esphomeyaml/components/sensor/bme680.rst b/esphomeyaml/components/sensor/bme680.rst index d4a8d516e0..e1a98ab247 100644 --- a/esphomeyaml/components/sensor/bme680.rst +++ b/esphomeyaml/components/sensor/bme680.rst @@ -19,7 +19,7 @@ your configuration for this sensor to work. .. _Adafruit: https://www.adafruit.com/product/3660 -.. code:: yaml +.. code-block:: yaml # Example configuration entry sensor: diff --git a/esphomeyaml/components/sensor/bmp085.rst b/esphomeyaml/components/sensor/bmp085.rst index d6b1ef376a..91993bf3ca 100644 --- a/esphomeyaml/components/sensor/bmp085.rst +++ b/esphomeyaml/components/sensor/bmp085.rst @@ -24,7 +24,7 @@ your configuration for this sensor to work. :align: center :width: 80.0% -.. code:: yaml +.. code-block:: yaml # Example configuration entry sensor: diff --git a/esphomeyaml/components/sensor/bmp280.rst b/esphomeyaml/components/sensor/bmp280.rst index a82a8350e2..bf6e5d17ca 100644 --- a/esphomeyaml/components/sensor/bmp280.rst +++ b/esphomeyaml/components/sensor/bmp280.rst @@ -19,7 +19,7 @@ required to be set up in your configuration for this sensor to work. .. _Adafruit: https://www.adafruit.com/product/2651 -.. code:: yaml +.. code-block:: yaml # Example configuration entry sensor: diff --git a/esphomeyaml/components/sensor/cse7766.rst b/esphomeyaml/components/sensor/cse7766.rst index ea231bf8f9..1ed0d08925 100644 --- a/esphomeyaml/components/sensor/cse7766.rst +++ b/esphomeyaml/components/sensor/cse7766.rst @@ -3,7 +3,7 @@ CSE7766 Power Sensor .. seo:: :description: Instructions for setting up CSE7766 power sensors for the Sonoff Pow R2 - :image: cse7766.svg + :image: cse7766.png :keywords: cse7766, Sonoff Pow R2 .. warning:: @@ -19,7 +19,7 @@ As the communication with the CSE7766 done using UART, you need to have an :ref:`UART bus ` in your configuration with the ``rx_pin`` connected to the CSE7766. Additionally, you need to set the baud rate to 4800. -.. code:: yaml +.. code-block:: yaml # Example configuration entry # Disable logging over USB diff --git a/esphomeyaml/components/sensor/custom.rst b/esphomeyaml/components/sensor/custom.rst index b0f5996284..d02759d157 100644 --- a/esphomeyaml/components/sensor/custom.rst +++ b/esphomeyaml/components/sensor/custom.rst @@ -3,7 +3,7 @@ Custom Sensor Component .. seo:: :description: Instructions for setting up Custom C++ sensors with esphomelib. - :image: language-cpp.svg + :image: language-cpp.png :keywords: C++, Custom .. warning:: @@ -27,15 +27,16 @@ esphomelib can use 2. go over how to register the sensor so that it will be show Since the creation of this guide, the BMP180 has been officially supported by the :doc:`BMP085 component `. The code still applies though. -This guide will require at least a bit of knowledge of C++, so be prepared for that. If you have any problems, -I'm here to help :) https://discord.gg/KhAMKrd +This guide will require at least a bit of knowledge of C++, so be prepared for that. If you've already written +code for an Arduino, you have already written C++ code :) (Arduino uses a slightly customized version of C++). +If you have any problems, I'm here to help: https://discord.gg/KhAMKrd Step 1: Custom Sensor Definition -------------------------------- At this point, you might have a main source file like this: -.. code:: cpp +.. code-block:: cpp // ... using namespace esphomelib; @@ -57,7 +58,7 @@ At this point, you might have a main source file like this: To create your own custom sensor, you just have define a C++ class that extends ``Component`` and ``Sensor`` like this: -.. code:: cpp +.. code-block:: cpp using namespace esphomelib; @@ -79,7 +80,7 @@ To create your own custom sensor, you just have define a C++ class that extends Additionally, you need to change an internal flag that changes how esphomeyaml compiles files. The only downside is that this will make build times *a tiny bit* slower: -.. code:: yaml +.. code-block:: yaml esphomeyaml: # ... @@ -99,7 +100,7 @@ to do in an Arduino sketch. Let's now also take a closer look at this line, which you might not be too used to when writing pure C code: -.. code:: cpp +.. code-block:: cpp class CustomSensor : public Component, public sensor::Sensor { @@ -112,7 +113,7 @@ values to the frontend (like MQTT). As most sensors really just setup some pins and then check the sensor every x seconds, there's another abstraction that we'll use to simplify our code: ``PollingSensorComponent``. -.. code:: cpp +.. code-block:: cpp class CustomSensor : public sensor::PollingSensorComponent { public: @@ -138,7 +139,7 @@ in the Internet. Let's also now make our sensor actually *output* values (42 for now): -.. code:: cpp +.. code-block:: cpp // class CustomSensor ... // ... previous code @@ -164,6 +165,8 @@ so esphomelib can't know about it. Let's change that. In your global ``setup()`` method, after you've setup all other components, do the following: +.. code-block:: yaml + .. code:: cpp void setup() { @@ -189,14 +192,14 @@ Let's go through the code for registering our custom sensor. First, we're creati instance with the update interval of 5000ms using the ``new`` C++ syntax (important!) and assigning it to a variable ``custom_sensor`` (using C++11 ``auto`` type specifier to make it simpler). -.. code:: cpp +.. code-block:: cpp auto *custom_sensor = new CustomSensor(5000); Next, we *register* the component in esphomelib's Application instance so that it can call the component's ``setup()`` and ``loop()``. -.. code:: cpp +.. code-block:: cpp App.register_component(custom_sensor); @@ -221,7 +224,7 @@ library by Adafruit. First we'll need to add the library to our platformio dependencies. To do so, put the following in the ``common`` section of your ``platformio.ini``: -.. code:: ini +.. code-block:: ini [common] lib_deps = Adafruit BMP085 Library @@ -230,7 +233,7 @@ the ``common`` section of your ``platformio.ini``: Next, include the library at the top of you main sketch file (``/src/main.cpp``): -.. code:: cpp +.. code-block:: cpp #include "esphomelib/application.h" #include @@ -241,7 +244,7 @@ Next, include the library at the top of you main sketch file (``/src/ Then update our sensor for BMP180 support: -.. code:: cpp +.. code-block:: cpp // ... @@ -297,7 +300,7 @@ we want to expose. Let's look at what that could look like in code: -.. code:: cpp +.. code-block:: cpp // An empty sensor subclass that will "proxy" the temperature values diff --git a/esphomeyaml/components/sensor/dallas.rst b/esphomeyaml/components/sensor/dallas.rst index 1fe836a72d..e43bd17ab7 100644 --- a/esphomeyaml/components/sensor/dallas.rst +++ b/esphomeyaml/components/sensor/dallas.rst @@ -26,7 +26,7 @@ To initialize a sensor, first supply either ``address`` **or** ``index`` to iden :align: center :width: 80.0% -.. code:: yaml +.. code-block:: yaml # Example configuration entry dallas: @@ -67,7 +67,7 @@ level ` must be set to at least ``debug``!). Note that you don't need to define the individual sensors just yet, as the scanning will happen even with no sensors connected. For example with this configuration: -.. code:: yaml +.. code-block:: yaml # Example configuration entry dallas: @@ -81,7 +81,7 @@ You will find something like this: Now we can add the individual sensors to our configuration: -.. code:: yaml +.. code-block:: yaml # Example configuration entry dallas: diff --git a/esphomeyaml/components/sensor/dht.rst b/esphomeyaml/components/sensor/dht.rst index f2c1c97ecd..774739bba8 100644 --- a/esphomeyaml/components/sensor/dht.rst +++ b/esphomeyaml/components/sensor/dht.rst @@ -33,7 +33,7 @@ if you're having issues try the 4.7kΩ recommended by the manufacturer) between :align: center :width: 80.0% -.. code:: yaml +.. code-block:: yaml # Example configuration entry sensor: diff --git a/esphomeyaml/components/sensor/dht12.rst b/esphomeyaml/components/sensor/dht12.rst index 63da3cb223..c38046a089 100644 --- a/esphomeyaml/components/sensor/dht12.rst +++ b/esphomeyaml/components/sensor/dht12.rst @@ -22,7 +22,7 @@ The ``dht12`` Temperature+Humidity sensor allows you to use your DHT12 :align: center :width: 80.0% -.. code:: yaml +.. code-block:: yaml # Example configuration entry sensor: diff --git a/esphomeyaml/components/sensor/duty_cycle.rst b/esphomeyaml/components/sensor/duty_cycle.rst index 0ab62c94b4..bcd074e80d 100644 --- a/esphomeyaml/components/sensor/duty_cycle.rst +++ b/esphomeyaml/components/sensor/duty_cycle.rst @@ -3,7 +3,7 @@ Duty Cycle Sensor .. seo:: :description: Instructions for setting up duty cycle sensors in esphomelib - :image: percent.svg + :image: percent.png The duty cycle sensor allows you to measure for what percentage of time a signal on a GPIO pin is HIGH or LOW. @@ -15,7 +15,7 @@ For example, you can measure if a status LED of a pool controller is permanently :align: center :width: 80.0% -.. code:: yaml +.. code-block:: yaml # Example configuration entry sensor: diff --git a/esphomeyaml/components/sensor/esp32_hall.rst b/esphomeyaml/components/sensor/esp32_hall.rst index 8efeb91b27..231bf7ff61 100644 --- a/esphomeyaml/components/sensor/esp32_hall.rst +++ b/esphomeyaml/components/sensor/esp32_hall.rst @@ -3,7 +3,7 @@ ESP32 Hall Sensor .. seo:: :description: Instructions for setting up the integrated hall-effect sensor of the ESP32. - :image: magnet.svg + :image: magnet.png :keywords: esp32, hall The ``esp32_hall`` sensor platform allows you to use the integrated @@ -19,7 +19,7 @@ by the hall sensor. :align: center :width: 80.0% -.. code:: yaml +.. code-block:: yaml # Example configuration entry sensor: diff --git a/esphomeyaml/components/sensor/hdc1080.rst b/esphomeyaml/components/sensor/hdc1080.rst index a1e93b966f..470becf52a 100644 --- a/esphomeyaml/components/sensor/hdc1080.rst +++ b/esphomeyaml/components/sensor/hdc1080.rst @@ -25,7 +25,7 @@ required to be set up in your configuration for this sensor to work. :align: center :width: 80.0% -.. code:: yaml +.. code-block:: yaml # Example configuration entry sensor: diff --git a/esphomeyaml/components/sensor/hlw8012.rst b/esphomeyaml/components/sensor/hlw8012.rst index ad0d27a3f3..14501e5952 100644 --- a/esphomeyaml/components/sensor/hlw8012.rst +++ b/esphomeyaml/components/sensor/hlw8012.rst @@ -3,7 +3,7 @@ HLW8012 Power Sensor .. seo:: :description: Instructions for setting up HLW8012 power sensors for the Sonoff Pow R1 - :image: hlw8012.svg + :image: hlw8012.png :keywords: HLW8012, Sonoff Pow R1 The ``hlw8012`` sensor platform allows you to use your HLW8012 voltage/current and power sensors @@ -17,7 +17,7 @@ the SEL pin, one can choose between which mode to use. esphomelib will continuously cycle the state of the SEL pin to measure current *and* voltage, though both cannot be measured at the same exact points in time. -.. code:: yaml +.. code-block:: yaml # Example configuration entry sensor: diff --git a/esphomeyaml/components/sensor/hmc5883l.rst b/esphomeyaml/components/sensor/hmc5883l.rst index c0b2561f68..7eb58b0cb0 100644 --- a/esphomeyaml/components/sensor/hmc5883l.rst +++ b/esphomeyaml/components/sensor/hmc5883l.rst @@ -14,7 +14,7 @@ required to be set up in your configuration for this sensor to work. .. _Adafruit: https://www.adafruit.com/product/1746 -.. code:: yaml +.. code-block:: yaml # Example configuration entry sensor: diff --git a/esphomeyaml/components/sensor/htu21d.rst b/esphomeyaml/components/sensor/htu21d.rst index 44315444a3..45933e39fa 100644 --- a/esphomeyaml/components/sensor/htu21d.rst +++ b/esphomeyaml/components/sensor/htu21d.rst @@ -7,7 +7,7 @@ HTU21D Temperature+Humidity Sensor :keywords: HTU21D The HTU21D Temperature+Humidity sensor allows you to use your HTU21D -(`datasheet `__, +(`datasheet `__, `adafruit `__) sensors with esphomelib. The :ref:`I²C Bus ` is required to be set up in your configuration for this sensor to work. @@ -28,7 +28,7 @@ required to be set up in your configuration for this sensor to work. The **SI7021** sensor also works with this integration. -.. code:: yaml +.. code-block:: yaml # Example configuration entry sensor: diff --git a/esphomeyaml/components/sensor/hx711.rst b/esphomeyaml/components/sensor/hx711.rst index 2d0f02680e..e5aadb5b45 100644 --- a/esphomeyaml/components/sensor/hx711.rst +++ b/esphomeyaml/components/sensor/hx711.rst @@ -3,7 +3,7 @@ HX711 Load Cell Amplifier .. seo:: :description: Instructions for setting up HX711 load cell amplifiers with esphomelib - :image: hx711.svg + :image: hx711.png :keywords: HX711 The ``hx711`` sensor platform allows you to use your HX711 @@ -22,7 +22,7 @@ load cell amplifier Connect ``GND`` to ``GND``, ``VCC`` to ``3.3V`` and the other three ``MISO`` (or ``SO`` for short), ``CS`` and ``CLOCK`` (or ``SCK``) to free GPIO pins. -.. code:: yaml +.. code-block:: yaml # Example configuration entry sensor: @@ -58,7 +58,7 @@ To calibrate the sensor: Once you've done those steps, you can use the ``map`` function to map the incoming value to the calibrated one: -.. code:: yaml +.. code-block:: yaml # Example configuration entry sensor: diff --git a/esphomeyaml/components/sensor/ina219.rst b/esphomeyaml/components/sensor/ina219.rst index d76e34c1e6..e80b7e2ac3 100644 --- a/esphomeyaml/components/sensor/ina219.rst +++ b/esphomeyaml/components/sensor/ina219.rst @@ -25,7 +25,7 @@ required to be set up in your configuration for this sensor to work. :align: center :width: 80.0% -.. code:: yaml +.. code-block:: yaml # Example configuration entry sensor: diff --git a/esphomeyaml/components/sensor/ina3221.rst b/esphomeyaml/components/sensor/ina3221.rst index 66cac134a3..7a9e5a7818 100644 --- a/esphomeyaml/components/sensor/ina3221.rst +++ b/esphomeyaml/components/sensor/ina3221.rst @@ -25,7 +25,7 @@ required to be set up in your configuration for this sensor to work. :align: center :width: 80.0% -.. code:: yaml +.. code-block:: yaml # Example configuration entry sensor: diff --git a/esphomeyaml/components/sensor/index.rst b/esphomeyaml/components/sensor/index.rst index 90b4654dc3..5eb96ecaa8 100644 --- a/esphomeyaml/components/sensor/index.rst +++ b/esphomeyaml/components/sensor/index.rst @@ -3,7 +3,7 @@ Sensor Component .. seo:: :description: Instructions for setting up sensor components in esphomelib. - :image: folder-open.svg + :image: folder-open.png esphomelib has support for many different sensors. Each of them is a platform of the ``sensor`` domain and each sensor has several base @@ -19,7 +19,7 @@ optional configuration options. By default, the sensor platform will chose appropriate values for all of these by default, but you can always override them if you want to. -.. code:: yaml +.. code-block:: yaml # Example sensor configuration name: Livingroom Temperature @@ -64,7 +64,7 @@ Automations: If you're trying to setup filters for a sensor that has multiple outputs - for example a DHT22 which reports temperature *and* humidity - put the ``filters`` option into each sensor output like this: - .. code:: yaml + .. code-block:: yaml sensor: - platform: dht @@ -89,7 +89,7 @@ front-end a bit more clean. More sophisticated filters should be done with Home Assistant's `filter sensor `__. -.. code:: yaml +.. code-block:: yaml # Example filters: filters: @@ -183,7 +183,7 @@ unit internally, and I’m not planning on making converting between the two simple (😉), but you can use this filter to convert celsius values to fahrenheit. -.. code:: yaml +.. code-block:: yaml filters: - lambda: return x * (9.0/5.0) + 32.0; @@ -200,7 +200,7 @@ Therefore if you have an ``update_interval`` of 15 seconds, you will only see th every 3 and a half minutes or so. To disable the default filter and publish all raw values directly, put an empty ``filters:`` block in your configuration: -.. code:: yaml +.. code-block:: yaml # Example configuration entry sensor: @@ -223,7 +223,7 @@ This automation will be triggered when a new value that has passed through all f is published. In :ref:`Lambdas ` you can get the value from the trigger with ``x``. -.. code:: yaml +.. code-block:: yaml sensor: - platform: dallas @@ -250,7 +250,7 @@ was outside the range. It will also trigger on startup if the first value receiv Define the range with ``above`` and ``below``. If only one of them is defined, the interval is half-open. So for example ``above: 5`` with no below would mean the range from 5 to positive infinity. -.. code:: yaml +.. code-block:: yaml sensor: - platform: dallas @@ -276,7 +276,7 @@ This automation will be triggered when a new value that has passed through all f is published. In :ref:`Lambdas ` you can get the value from the trigger with ``x``. -.. code:: yaml +.. code-block:: yaml sensor: - platform: dallas @@ -298,7 +298,7 @@ advanced stuff (see the full :doc:`API Reference ` for more i - ``publish_state()``: Manually cause the sensor to push out a value. It will then be processed by the sensor filters, and once done be published to MQTT. - .. code:: yaml + .. code-block:: cpp // Within lambda, push a value of 42.0 id(my_sensor).publish_state(42.0); @@ -306,7 +306,7 @@ advanced stuff (see the full :doc:`API Reference ` for more i - ``.state``: Retrieve the current value of the sensor that has passed through all sensor filters. Is ``NAN`` if no value has gotten through all filters yet. - .. code:: yaml + .. code-block:: cpp // For example, create a custom log message when a value is received: ESP_LOGI("main", "Value of my sensor: %f", id(my_sensor).state); @@ -314,7 +314,7 @@ advanced stuff (see the full :doc:`API Reference ` for more i - ``raw_state``: Retrieve the current value of the sensor that has not passed through any filters Is ``NAN`` if no value if no value has been pushed by the sensor itself yet. - .. code:: yaml + .. code-block:: cpp // For example, create a custom log message when a value is received: ESP_LOGI("main", "Raw Value of my sensor: %f", id(my_sensor).raw_state); diff --git a/esphomeyaml/components/sensor/max6675.rst b/esphomeyaml/components/sensor/max6675.rst index b8623f1068..34dcf24f11 100644 --- a/esphomeyaml/components/sensor/max6675.rst +++ b/esphomeyaml/components/sensor/max6675.rst @@ -26,7 +26,7 @@ Connect ``GND`` to ``GND``, ``VCC`` to ``3.3V`` and the other three ``MISO`` (or :align: center :width: 80.0% -.. code:: yaml +.. code-block:: yaml # Example configuration entry spi: diff --git a/esphomeyaml/components/sensor/mhz19.rst b/esphomeyaml/components/sensor/mhz19.rst index b91ebd98e7..bd2a637451 100644 --- a/esphomeyaml/components/sensor/mhz19.rst +++ b/esphomeyaml/components/sensor/mhz19.rst @@ -22,7 +22,7 @@ to have an :ref:`UART bus ` in your configuration with the ``rx_pin`` conn MH-Z19 and the ``tx_pin`` connected to the RX Pin of the MH-Z19 (it's switched because the TX/RX labels are from the perspective of the MH-Z19). Additionally, you need to set the baud rate to 9600. -.. code:: yaml +.. code-block:: yaml # Example configuration entry uart: diff --git a/esphomeyaml/components/sensor/mpu6050.rst b/esphomeyaml/components/sensor/mpu6050.rst index 8a134a1c85..c616acee0d 100644 --- a/esphomeyaml/components/sensor/mpu6050.rst +++ b/esphomeyaml/components/sensor/mpu6050.rst @@ -29,7 +29,7 @@ new feature. Supporting all possible use-cases would be quite hard. :align: center :width: 80.0% -.. code:: yaml +.. code-block:: yaml # Example configuration entry sensor: diff --git a/esphomeyaml/components/sensor/mqtt_subscribe.rst b/esphomeyaml/components/sensor/mqtt_subscribe.rst index 6eb8f6ca50..5696e1c72e 100644 --- a/esphomeyaml/components/sensor/mqtt_subscribe.rst +++ b/esphomeyaml/components/sensor/mqtt_subscribe.rst @@ -14,7 +14,7 @@ Please note this integration only works with MQTT topics that have numeric data! a message that is not a number is published a warning will be shown. Please use the MQTT subscribe text sensor for importing arbitrary text into the esphomelib ecosystem. -.. code:: yaml +.. code-block:: yaml # Example configuration entry sensor: diff --git a/esphomeyaml/components/sensor/ms5611.rst b/esphomeyaml/components/sensor/ms5611.rst index a9ec892cb0..0212aebdd2 100644 --- a/esphomeyaml/components/sensor/ms5611.rst +++ b/esphomeyaml/components/sensor/ms5611.rst @@ -7,7 +7,7 @@ MS5611 Atmospheric Pressure Sensor :keywords: MS5611 The ``ms5611`` sensor platform allows you to use your MS5611 atmospheric pressure sensors -(`datasheet `__, +(`datasheet `__, `hobbytronics`_) temperature and pressure sensors with esphomelib. The :ref:`I²C ` is required to be set up in your configuration for this sensor to work. @@ -23,7 +23,7 @@ required to be set up in your configuration for this sensor to work. :align: center :width: 80.0% -.. code:: yaml +.. code-block:: yaml # Example configuration entry sensor: diff --git a/esphomeyaml/components/sensor/pmsx003.rst b/esphomeyaml/components/sensor/pmsx003.rst index 7c7e72ae50..97ef469a7e 100644 --- a/esphomeyaml/components/sensor/pmsx003.rst +++ b/esphomeyaml/components/sensor/pmsx003.rst @@ -3,7 +3,7 @@ PMSX003 Particulate Matter Sensor .. seo:: :description: Instructions for setting up PMSX003 Particulate matter sensors - :image: pmsx003.svg + :image: pmsx003.png .. warning:: @@ -25,7 +25,7 @@ value: - ``PMS5003T`` for PMS5003T. These support ``pm_2_5``, ``temperature`` and ``humidity``. - ``PMS5003ST`` for PMS5003ST. These support ``pm_2_5``, ``temperature``, ``humidity`` and ``formaldehyde``. -.. code:: yaml +.. code-block:: yaml # Example configuration entry uart: diff --git a/esphomeyaml/components/sensor/pulse_counter.rst b/esphomeyaml/components/sensor/pulse_counter.rst index 96b980e46e..7e3ecfaa9a 100644 --- a/esphomeyaml/components/sensor/pulse_counter.rst +++ b/esphomeyaml/components/sensor/pulse_counter.rst @@ -3,20 +3,20 @@ Pulse Counter Sensor .. seo:: :description: Instructions for setting up pulse counter sensors. - :image: pulse.svg + :image: pulse.png The pulse counter sensor allows you to count the number of pulses and the frequency of a signal on any pin. On the ESP32, this sensor is even highly accurate because it's using the hardware `pulse counter -peripheral `__ +peripheral `__ on the ESP32. .. figure:: images/pulse-counter.png :align: center :width: 80.0% -.. code:: yaml +.. code-block:: yaml # Example configuration entry sensor: @@ -55,7 +55,7 @@ of “pulses/min”. You can change this by using :ref:`sensor-filters`. For example, if you’re using the pulse counter with a photodiode to count the light pulses on a power meter, you can do the following: -.. code:: yaml +.. code-block:: yaml # Example configuration entry sensor: @@ -71,7 +71,7 @@ See Also - :ref:`sensor-filters` - :doc:`rotary_encoder` -- `esp-idf Pulse Counter API `__. +- `esp-idf Pulse Counter API `__. - :doc:`API Reference ` - `Edit this page on GitHub `__ diff --git a/esphomeyaml/components/sensor/rotary_encoder.rst b/esphomeyaml/components/sensor/rotary_encoder.rst index fef21eced9..78db453eef 100644 --- a/esphomeyaml/components/sensor/rotary_encoder.rst +++ b/esphomeyaml/components/sensor/rotary_encoder.rst @@ -27,7 +27,7 @@ To use rotary encoders in esphomeyaml, first identify the two pins encoding th s These are often called ``CLK`` and ``DT`` as in above image. Note if the values this sensor outputs go in the wrong direction, you can just swap these two pins. -.. code:: yaml +.. code-block:: yaml # Example configuration entry sensor: @@ -58,7 +58,7 @@ In order to not put too much stress on your network connection, you can leverage sensor filters. The following will only send out values if the last input value is at least 0.1s seconds old *or* if the new rotary encoder value has changed by 10 from the previous value. -.. code:: yaml +.. code-block:: yaml # Example configuration entry sensor: diff --git a/esphomeyaml/components/sensor/sht3xd.rst b/esphomeyaml/components/sensor/sht3xd.rst index f4463c3672..fff581ce18 100644 --- a/esphomeyaml/components/sensor/sht3xd.rst +++ b/esphomeyaml/components/sensor/sht3xd.rst @@ -17,7 +17,7 @@ required to be set up in your configuration for this sensor to work. :align: center :width: 80.0% -.. code:: yaml +.. code-block:: yaml # Example configuration entry sensor: diff --git a/esphomeyaml/components/sensor/tcs34725.rst b/esphomeyaml/components/sensor/tcs34725.rst index 55c92bd9cc..9844f6bcc9 100644 --- a/esphomeyaml/components/sensor/tcs34725.rst +++ b/esphomeyaml/components/sensor/tcs34725.rst @@ -23,7 +23,7 @@ required to be set up in your configuration for this sensor to work. :align: center :width: 80.0% -.. code:: yaml +.. code-block:: yaml # Example configuration entry sensor: diff --git a/esphomeyaml/components/sensor/template.rst b/esphomeyaml/components/sensor/template.rst index db60898a98..5bef8348db 100644 --- a/esphomeyaml/components/sensor/template.rst +++ b/esphomeyaml/components/sensor/template.rst @@ -3,12 +3,12 @@ Template Sensor .. seo:: :description: Instructions for setting up template sensors with esphomelib. - :image: description.svg + :image: description.png The ``template`` sensor platform allows you to create a sensor with templated values using :ref:`lambdas `. -.. code:: yaml +.. code-block:: yaml # Example configuration entry sensor: @@ -45,7 +45,7 @@ Configuration variables: You can use the ``publish_state()`` method to set the value of a template sensor from other automations: - .. code:: cpp + .. code-block:: cpp id(my_sensor).publish_state(42.0); diff --git a/esphomeyaml/components/sensor/total_daily_energy.rst b/esphomeyaml/components/sensor/total_daily_energy.rst index 7e7a164422..aee7c9a9e1 100644 --- a/esphomeyaml/components/sensor/total_daily_energy.rst +++ b/esphomeyaml/components/sensor/total_daily_energy.rst @@ -3,7 +3,7 @@ Total Daily Energy Sensor .. seo:: :description: Instructions for setting up sensors that track the total daily energy usage per day and accumulate the power usage. - :image: sigma.svg + :image: sigma.png The ``total_daily_energy`` sensor is a helper sensor that can use the energy value of other sensors like the :doc:`HLW8012 `, :doc:`CSE7766 `, etc and integrate @@ -12,7 +12,7 @@ it over time. So this component allows you to convert readings in ``W`` or ``kW`` to readings of the total daily energy usage in ``Wh`` or ``kWh``. -.. code:: yaml +.. code-block:: yaml # Example configuration entry sensor: diff --git a/esphomeyaml/components/sensor/tsl2561.rst b/esphomeyaml/components/sensor/tsl2561.rst index 11246a748f..e8c3d07fe5 100644 --- a/esphomeyaml/components/sensor/tsl2561.rst +++ b/esphomeyaml/components/sensor/tsl2561.rst @@ -24,7 +24,7 @@ your configuration for this sensor to work. :align: center :width: 80.0% -.. code:: yaml +.. code-block:: yaml # Example configuration entry sensor: @@ -57,7 +57,7 @@ See Also - :ref:`sensor-filters` - :doc:`bh1750` - :doc:`adc` -- `SparkFun TSL2561 Arduino Library `__ by `Sparkfun `__ +- `SparkFun TSL2561 Arduino Library `__ by `Sparkfun `__ - :doc:`API Reference ` - `Edit this page on GitHub `__ diff --git a/esphomeyaml/components/sensor/ultrasonic.rst b/esphomeyaml/components/sensor/ultrasonic.rst index 5e543bd417..2eaf346bff 100644 --- a/esphomeyaml/components/sensor/ultrasonic.rst +++ b/esphomeyaml/components/sensor/ultrasonic.rst @@ -32,7 +32,7 @@ set too high. :align: center :width: 80.0% -.. code:: yaml +.. code-block:: yaml # Example configuration entry sensor: @@ -70,7 +70,7 @@ option kicks in. To remove ``NAN`` values from the sensor stream, use the ``filter_nan`` :ref:`sensor filter `: -.. code:: yaml +.. code-block:: yaml sensor: - platform: ultrasonic diff --git a/esphomeyaml/components/sensor/uptime.rst b/esphomeyaml/components/sensor/uptime.rst index 0fd7a4b826..74205f39b9 100644 --- a/esphomeyaml/components/sensor/uptime.rst +++ b/esphomeyaml/components/sensor/uptime.rst @@ -3,12 +3,12 @@ Uptime Sensor .. seo:: :description: Instructions for setting up a sensor that tracks the uptime of the ESP. - :image: timer.svg + :image: timer.png The ``uptime`` sensor allows you to track the time the ESP has stayed up for in seconds. Time rollovers are automatically handled. -.. code:: yaml +.. code-block:: yaml # Example configuration entry sensor: diff --git a/esphomeyaml/components/sensor/wifi_signal.rst b/esphomeyaml/components/sensor/wifi_signal.rst index f4ba8e0be0..4f9ecb0063 100644 --- a/esphomeyaml/components/sensor/wifi_signal.rst +++ b/esphomeyaml/components/sensor/wifi_signal.rst @@ -3,7 +3,7 @@ WiFi Signal Sensor .. seo:: :description: Instructions for setting up WiFi signal sensors that track the RSSI connection strength value to the network. - :image: network-wifi.svg + :image: network-wifi.png The ``wifi_signal`` sensor platform allows you to read the signal strength of the currently connected :doc:`WiFi Access Point `. @@ -15,7 +15,7 @@ measured in decibels. These values are always negative and the closer they are t :align: center :width: 80.0% -.. code:: yaml +.. code-block:: yaml # Example configuration entry sensor: diff --git a/esphomeyaml/components/sensor/xiaomi_miflora.rst b/esphomeyaml/components/sensor/xiaomi_miflora.rst index a6e41257d4..228c8b6a7f 100644 --- a/esphomeyaml/components/sensor/xiaomi_miflora.rst +++ b/esphomeyaml/components/sensor/xiaomi_miflora.rst @@ -12,7 +12,7 @@ temperature, humidity and optionally the battery level of the MiFlora device eve sends out a BLE broadcast. Note that contrary to other implementations, esphomelib can track as many MiFlora devices at once as you want. -.. code:: yaml +.. code-block:: yaml # Example configuration entry esp32_ble_tracker: @@ -72,7 +72,7 @@ Setting Up Devices To set up Xiaomi MiFlora devices you first need to find their MAC Address so that esphomelib can identify them. So first, create a simple configuration without any ``xiaomi_miflora`` entries like so: -.. code:: yaml +.. code-block:: yaml esp32_ble_tracker: diff --git a/esphomeyaml/components/sensor/xiaomi_mijia.rst b/esphomeyaml/components/sensor/xiaomi_mijia.rst index 6488e0a8f4..5520da32f3 100644 --- a/esphomeyaml/components/sensor/xiaomi_mijia.rst +++ b/esphomeyaml/components/sensor/xiaomi_mijia.rst @@ -22,7 +22,7 @@ MiJia devices at once as you want. :align: center :width: 80.0% -.. code:: yaml +.. code-block:: yaml # Example configuration entry esp32_ble_tracker: @@ -66,7 +66,7 @@ Setting Up Devices To set up Xiaomi MiJia devices you first need to find their MAC Address so that esphomelib can identify them. So first, create a simple configuration without any ``xiaomi_mijia`` entries like so: -.. code:: yaml +.. code-block:: yaml esp32_ble_tracker: diff --git a/esphomeyaml/components/spi.rst b/esphomeyaml/components/spi.rst index 3c8ef1b2a4..f387cae237 100644 --- a/esphomeyaml/components/spi.rst +++ b/esphomeyaml/components/spi.rst @@ -5,7 +5,7 @@ SPI Bus .. seo:: :description: Instructions for setting up an SPI bus in esphomelib - :image: spi.svg + :image: spi.png :keywords: SPI SPI is a very common high-speed protocol for a lot of devices. The SPI bus usually consists of 4 wires: @@ -26,7 +26,7 @@ use for the functions described above. The **CS** pins are then individually man component also accepts a list of buses if you want to have multiple SPI buses with your ESP (though this should rarely be necessary, as the SPI bus can be shared by the devices). -.. code:: yaml +.. code-block:: yaml # Example configuration entry spi: diff --git a/esphomeyaml/components/status_led.rst b/esphomeyaml/components/status_led.rst index 78eecd2296..cb8d70030d 100644 --- a/esphomeyaml/components/status_led.rst +++ b/esphomeyaml/components/status_led.rst @@ -3,7 +3,7 @@ Status LED .. seo:: :description: Instructions for setting up status LEDs in esphomelib to monitor the status of an ESP. - :image: led-on.svg + :image: led-on.png The ``status_led`` hooks into all esphomelib components and can indicate the status of the device. Specifically, it will: @@ -15,7 +15,7 @@ the device. Specifically, it will: recover from the error and continue with all other operations. - Stay off otherwise. -.. code:: yaml +.. code-block:: yaml # Example configuration entry status_led: @@ -33,7 +33,7 @@ Configuration variables: If your LED is in an active-LOW mode (when it's on if the output is enabled), use the ``inverted`` option of the :ref:`Pin Schema `: - .. code:: yaml + .. code-block:: yaml status_led: pin: diff --git a/esphomeyaml/components/stepper/index.rst b/esphomeyaml/components/stepper/index.rst index 30270acce6..1be0b71f22 100644 --- a/esphomeyaml/components/stepper/index.rst +++ b/esphomeyaml/components/stepper/index.rst @@ -3,7 +3,7 @@ Stepper Component .. seo:: :description: Instructions for setting up stepper motor drivers in esphomelib - :image: folder-open.svg + :image: folder-open.png :keywords: stepper motor, stepper driver, a4988 The ``stepper`` component allows you to use stepper motors with esphomelib. @@ -11,7 +11,7 @@ Currently only the A4988 stepper driver (`datasheet `__) is supported. -.. code:: yaml +.. code-block:: yaml # Example configuration entry stepper: @@ -57,7 +57,7 @@ Configuration variables: If the stepper is driving in the wrong direction, you can invert the ``dir_pin``: - .. code:: yaml + .. code-block:: yaml stepper: - platform: a4988 @@ -75,7 +75,7 @@ Configuration variables: To use your stepper motor in :ref:`automations ` or templates, you can use this action to set the target position (in steps). The stepper will always run towards the target position and stop once it has reached the target. -.. code:: yaml +.. code-block:: yaml on_...: then: @@ -102,7 +102,7 @@ Configuration options: This action can also be expressed as a :ref:`lambda `: - .. code:: cpp + .. code-block:: cpp id(my_stepper).set_target(250); @@ -122,7 +122,7 @@ that reporting the position can create unexpected moves of the stepper. For exam current position is at 1000 steps and you "report" a position of 0, the stepper will move 1000 steps forward to match the target again. -.. code:: yaml +.. code-block:: yaml on_...: then: @@ -153,7 +153,7 @@ Configuration options: This action can also be expressed as a :ref:`lambda `: - .. code:: cpp + .. code-block:: cpp id(my_stepper).report_position(250); diff --git a/esphomeyaml/components/switch/gpio.rst b/esphomeyaml/components/switch/gpio.rst index 9de35392a1..3c4ac676ce 100644 --- a/esphomeyaml/components/switch/gpio.rst +++ b/esphomeyaml/components/switch/gpio.rst @@ -3,7 +3,7 @@ GPIO Switch .. seo:: :description: Instructions for setting up GPIO pin switches in esphomelib that control GPIO outputs. - :image: pin.svg + :image: pin.png The ``gpio`` switch platform allows you to use any pin on your node as a switch. You can for example hook up a relay to a GPIO pin and use it @@ -13,7 +13,7 @@ through this platform. :align: center :width: 80.0% -.. code:: yaml +.. code-block:: yaml # Example configuration entry switch: diff --git a/esphomeyaml/components/switch/index.rst b/esphomeyaml/components/switch/index.rst index 171fec568d..7f989f7f5e 100644 --- a/esphomeyaml/components/switch/index.rst +++ b/esphomeyaml/components/switch/index.rst @@ -3,7 +3,7 @@ Switch Component .. seo:: :description: Instructions for setting up generic switches in esphomelib. - :image: folder-open.svg + :image: folder-open.png The ``switch`` domain includes all platforms that should show up like a switch and can only be turned ON or OFF. @@ -13,7 +13,7 @@ switch and can only be turned ON or OFF. Base Switch Configuration ------------------------- -.. code:: yaml +.. code-block:: yaml switch: - platform: ... @@ -37,7 +37,7 @@ Configuration variables: This action toggles a switch with the given ID when executed. -.. code:: yaml +.. code-block:: yaml on_...: then: @@ -50,7 +50,7 @@ This action toggles a switch with the given ID when executed. This action turns a switch with the given ID on when executed. -.. code:: yaml +.. code-block:: yaml on_...: then: @@ -63,7 +63,7 @@ This action turns a switch with the given ID on when executed. This action turns a switch with the given ID off when executed. -.. code:: yaml +.. code-block:: yaml on_...: then: @@ -78,7 +78,7 @@ advanced stuff (see the full :doc:`API Reference ` for more in - ``publish_state()``: Manually cause the switch to publish a new state and store it internally. If it's different from the last internal state, it's additionally published to the frontend. - .. code:: yaml + .. code-block:: yaml // Within lambda, make the switch report a specific state id(my_switch).publish_state(false); @@ -86,7 +86,7 @@ advanced stuff (see the full :doc:`API Reference ` for more in - ``state``: Retrieve the current state of the switch. - .. code:: yaml + .. code-block:: yaml // Within lambda, get the switch state and conditionally do something if (id(my_switch).state) { @@ -99,7 +99,7 @@ advanced stuff (see the full :doc:`API Reference ` for more in Similar to the ``switch.turn_on`` and ``switch.turn_off`` actions, but can be used in complex lambda expressions. - .. code:: yaml + .. code-block:: yaml id(my_switch).write_state(false); id(my_switch).write_state(true); diff --git a/esphomeyaml/components/switch/output.rst b/esphomeyaml/components/switch/output.rst index 37019dc9e4..f56759d3a4 100644 --- a/esphomeyaml/components/switch/output.rst +++ b/esphomeyaml/components/switch/output.rst @@ -3,7 +3,7 @@ Generic Output Switch .. seo:: :description: Instructions for setting up generic output switches in esphomelib that control an output component. - :image: upload.svg + :image: upload.png The ``output`` switch platform allows you to use any output component as a switch. @@ -11,7 +11,7 @@ The ``output`` switch platform allows you to use any output component as a switc :align: center :width: 80.0% -.. code:: yaml +.. code-block:: yaml # Example configuration entry output: diff --git a/esphomeyaml/components/switch/remote_transmitter.rst b/esphomeyaml/components/switch/remote_transmitter.rst index e69196462f..fea0bbfac9 100644 --- a/esphomeyaml/components/switch/remote_transmitter.rst +++ b/esphomeyaml/components/switch/remote_transmitter.rst @@ -3,7 +3,7 @@ Remote Transmitter Switch .. seo:: :description: Instructions for setting up switches that send out pre-defined sequences of IR or RF signals - :image: remote.svg + :image: remote.png :keywords: Infrared, IR, RF, Remote, TX The ``remote_transmitter`` switch platform allows you to create switches @@ -17,7 +17,7 @@ Use cases include, but are not limited to, infrared remotes, 433MHz signals and :align: center :width: 80.0% -.. code:: yaml +.. code-block:: yaml # Example configuration entry remote_transmitter: @@ -53,7 +53,7 @@ Configuration variables: For the Sonoff RF Bridge you can use `this hack `__ created by the Github user wildwiz. Then use this configuration for the remote receiver/transmitter hubs: - .. code:: yaml + .. code-block:: yaml remote_receiver: pin: 4 @@ -72,7 +72,7 @@ Remote Codes Supported remote codes: -.. code:: yaml +.. code-block:: yaml switch: - platform: remote_transmitter @@ -198,7 +198,7 @@ Each remote transmitter uses a different protocol to send its information. So to remote you will first need to "learn" these codes. You will first need to hook up a receiver and sniff the codes using the :doc:`remote receiver component ` like this: -.. code:: yaml +.. code-block:: yaml remote_receiver: pin: GPIO34 @@ -223,7 +223,7 @@ value denotes the output being HIGH for the specified number of microseconds. Now you only need to set up the remote transmitter (which well *send* the code) like this: -.. code:: yaml +.. code-block:: yaml remote_transmitter: pin: GPIO23 @@ -232,7 +232,7 @@ Now you only need to set up the remote transmitter (which well *send* the code) And lastly, we need to set up the switch that, when turned on, will send our pre-defined remote code: -.. code:: yaml +.. code-block:: yaml switch: - platform: remote_transmitter @@ -260,7 +260,7 @@ remote protocol. If you have RF code dumping enabled for the receiver, you will Like before with raw codes, you can then use this code to create switches: -.. code:: yaml +.. code-block:: yaml switch: - platform: remote_transmitter @@ -273,7 +273,7 @@ Alternatively, you can use the information on `this page ` when triggered. -.. code:: yaml +.. code-block:: yaml # Example configuration entry uart: diff --git a/esphomeyaml/components/text_sensor/index.rst b/esphomeyaml/components/text_sensor/index.rst index 10005d2c12..8d4e9e2e84 100644 --- a/esphomeyaml/components/text_sensor/index.rst +++ b/esphomeyaml/components/text_sensor/index.rst @@ -3,7 +3,7 @@ Text Sensor Component .. seo:: :description: Instructions for setting up text sensors that represent their state as a string of text. - :image: folder-open.svg + :image: folder-open.png Text sensors are a lot like normal :doc:`sensors `. But where the "normal" sensors only represent sensors that output **numbers**, this @@ -14,7 +14,7 @@ component can represent any *text*. Base Text Sensor Configuration ------------------------------ -.. code:: yaml +.. code-block:: yaml # Example sensor configuration name: Livingroom Temperature @@ -46,7 +46,7 @@ You can access the most recent state of the sensor in :ref:`lambdas ` you can get the value from the trigger with ``x``. -.. code:: yaml +.. code-block:: yaml text_sensor: - platform: version @@ -66,14 +66,14 @@ advanced stuff (see the full :doc:`API Reference ` for more i - ``publish_state()``: Manually cause the sensor to push out a value. - .. code:: yaml + .. code-block:: cpp // Within lambda, push a value of "Hello World" id(my_sensor).publish_state("Hello World"); - ``.state``: Retrieve the current value of the sensor as an ``std::string`` object. - .. code:: yaml + .. code-block:: cpp // For example, create a custom log message when a value is received: std::string val = id(my_sensor).state; diff --git a/esphomeyaml/components/text_sensor/mqtt_subscribe.rst b/esphomeyaml/components/text_sensor/mqtt_subscribe.rst index e94b1ab8b4..edf7d24ea7 100644 --- a/esphomeyaml/components/text_sensor/mqtt_subscribe.rst +++ b/esphomeyaml/components/text_sensor/mqtt_subscribe.rst @@ -10,7 +10,7 @@ The ``mqtt_subscribe`` text sensor platform allows you to get external data into The sensor will subscribe to messages on the given MQTT topic and save the most recent value in its ``id(mysensor).value``. -.. code:: yaml +.. code-block:: yaml # Example configuration entry text_sensor: @@ -35,7 +35,7 @@ This integration is especially useful for displays, to show external data on the Please note you have to use the ``.c_str()`` method on the ``.state`` object together with the ``%s`` format to use it in ``printf`` expressions. -.. code:: yaml +.. code-block:: yaml # Example configuration entry text_sensor: diff --git a/esphomeyaml/components/text_sensor/template.rst b/esphomeyaml/components/text_sensor/template.rst index c24bd19ad5..dd1c8cc5e9 100644 --- a/esphomeyaml/components/text_sensor/template.rst +++ b/esphomeyaml/components/text_sensor/template.rst @@ -3,12 +3,12 @@ Template Text Sensor .. seo:: :description: Instructions for setting up template text sensors in esphomelib - :image: description.svg + :image: description.png The ``template`` text sensor platform allows you to create a text sensor with templated values using :ref:`lambdas `. -.. code:: yaml +.. code-block:: yaml # Example configuration entry text_sensor: diff --git a/esphomeyaml/components/text_sensor/version.rst b/esphomeyaml/components/text_sensor/version.rst index b6e6479b7b..5440f0b3f0 100644 --- a/esphomeyaml/components/text_sensor/version.rst +++ b/esphomeyaml/components/text_sensor/version.rst @@ -3,7 +3,7 @@ Version Text Sensor .. seo:: :description: Instructions for setting up version text sensors. - :image: new-box.svg + :image: new-box.png The ``version`` text sensor platform exposes the esphomelib version the firmware was compiled against as a text sensor. @@ -12,7 +12,7 @@ was compiled against as a text sensor. :align: center :width: 80.0% -.. code:: yaml +.. code-block:: yaml # Example configuration entry text_sensor: diff --git a/esphomeyaml/components/time.rst b/esphomeyaml/components/time.rst index 0cdfa8859e..7b8ea1dd5a 100644 --- a/esphomeyaml/components/time.rst +++ b/esphomeyaml/components/time.rst @@ -5,35 +5,31 @@ Time .. seo:: :description: Instructions for setting up real time clock sources in esphomelib like network based time. - :image: clock-outline.svg + :image: clock-outline.png :keywords: NTP, SNTP, RTC The ``time`` component allows you to set up real time clock time sources for esphomelib. You can then get the current time in :ref:`lambdas `. Currently only sntp (internet-based) time is supported. -.. code:: yaml +.. code-block:: yaml # Example configuration entry time: - platform: sntp id: sntp_time - servers: - - 0.pool.ntp.org - - 1.pool.ntp.org - - 2.pool.ntp.org Configuration variables: ------------------------ - **id** (**Required**, :ref:`config-id`): Specify the ID of the time for use in lambdas. -- **servers** (*Optional*, list of strings): Choose up to 3 NTP servers that are used for the clock source. - Defaults to ``0.pool.ntp.org``, ``1.pool.ntp.org`` and ``2.pool.ntp.org`` - **timezone** (*Optional*, string): Manually tell esphomelib what timezone to use with `this format `__ (warning: the format is quite complicated). esphomeyaml tries to automatically infer the timezone string based on the timezone of the computer that is running esphomeyaml, but this might not always be accurate. +- **servers** (*Optional*, list of strings): Choose up to 3 NTP servers that are used for the clock source. + Defaults to ``0.pool.ntp.org``, ``1.pool.ntp.org`` and ``2.pool.ntp.org`` - **on_time** (*Optional*, :ref:`Automation `): Automation to run at specific intervals using a cron-like syntax. See :ref:`time-on_time`. @@ -49,7 +45,7 @@ Use In Lambdas To get the current local time with the timezone applied in :ref:`lambdas `, just call the ``.now()`` method like so: -.. code:: cpp +.. code-block:: cpp auto time = id(sntp_time).now(); @@ -106,7 +102,7 @@ The second way to use the time object is to directly transform it into a string This is directly done using C's `strftime `__ function which allows for a lot of flexibility. -.. code:: yaml +.. code-block:: cpp # For example, in a display object it.strftime(0, 0, id(font), "%Y-%m-%d %H:%M", id(time).now()); @@ -183,7 +179,7 @@ keys as seen below or using a cron expression like ``* /5 * * * *``. Basically, the automation engine looks at your configured time schedule every second and evaluates if the automation should run. -.. code:: yaml +.. code-block:: yaml time: - platform: sntp @@ -231,20 +227,20 @@ Configuration variables: In the ``seconds:``, ``minutes:``, ... fields you can use the following operators: -- .. code:: yaml +- .. code-block:: yaml seconds: 0 An integer like ``0`` or ``30`` will make the automation only trigger if the current second is **exactly** 0 or 30, respectively. -- .. code:: yaml +- .. code-block:: yaml seconds: 0,30,45 You can combine multiple expressions with the ``,`` operator. This operator makes it so that if either one of the expressions separated by a comma holds true, the automation will trigger. For example ``0,30,45`` will trigger if the current second is either ``0`` or ``30`` or ``45``. -- .. code:: yaml +- .. code-block:: yaml days_of_week: 2-6 # same as @@ -256,7 +252,7 @@ In the ``seconds:``, ``minutes:``, ... fields you can use the following operator The ``-`` (hyphen) operator can be used to create a range of values and is shorthand for listing all values with the ``,`` operator. -- .. code:: yaml +- .. code-block:: yaml # every 5 minutes seconds: 0 @@ -270,11 +266,11 @@ In the ``seconds:``, ``minutes:``, ... fields you can use the following operator automation trigger only when the minute of the hour is 0, or 5, 10, 15, ... The value in front of the ``/`` specifies the offset with which the step is applied. -- .. code:: yaml +- .. code-block:: yaml # Every minute seconds: 0 - minutes: * + minutes: '*' Lastly, the ``*`` operator matches every number. In the example above, ``*`` could for example be substituted with ``0-59``. @@ -285,7 +281,7 @@ In the ``seconds:``, ``minutes:``, ... fields you can use the following operator Please note the following automation would trigger for each second in the minutes 0,5,10,15 and not once per 5 minutes as the seconds variable is not set: - .. code:: yaml + .. code-block:: yaml time: - platform: sntp diff --git a/esphomeyaml/components/uart.rst b/esphomeyaml/components/uart.rst index 796104f86d..5b78e14c8d 100644 --- a/esphomeyaml/components/uart.rst +++ b/esphomeyaml/components/uart.rst @@ -5,7 +5,7 @@ UART Bus .. seo:: :description: Instructions for setting up a UART serial bus on ESPs - :image: uart.svg + :image: uart.png :keywords: UART, serial bus UART is a common serial protocol for a lot of devices. For example, when uploading a binary to your ESP @@ -32,7 +32,7 @@ In some cases only **TX** or **RX** exists as the device at the other end only a ones used for logging. Therefore the UART data on the ESP8266 can have occasional data glitches especially with higher baud rates.. -.. code:: yaml +.. code-block:: yaml # Example configuration entry uart: diff --git a/esphomeyaml/components/web_server.rst b/esphomeyaml/components/web_server.rst index 768c360840..306d7ce802 100644 --- a/esphomeyaml/components/web_server.rst +++ b/esphomeyaml/components/web_server.rst @@ -3,7 +3,7 @@ Web Server Component .. seo:: :description: Instructions for setting up a web server in esphomelib. - :image: http.svg + :image: http.png :keywords: web server, http, REST API The ``web_server`` component creates a simple web server on the node that can be accessed @@ -24,7 +24,7 @@ interface are hosted by esphomelib.com. If you want to use your own service, use Example web server frontend. -.. code:: yaml +.. code-block:: yaml # Example configuration entry web_server: diff --git a/esphomeyaml/components/wifi.rst b/esphomeyaml/components/wifi.rst index 59e5b4ab8e..40f71b03ce 100644 --- a/esphomeyaml/components/wifi.rst +++ b/esphomeyaml/components/wifi.rst @@ -3,7 +3,7 @@ WiFi Component .. seo:: :description: Instructions for setting up the WiFi configuration for your ESP node in esphomelib. - :image: network-wifi.svg + :image: network-wifi.png :keywords: WiFi, WLAN, ESP8266, ESP32 This core esphomelib component sets up WiFi connections to access points @@ -13,7 +13,7 @@ will fail in the config validation stage. It’s recommended to provide a static IP for your node, as it can dramatically improve connection times. -.. code:: yaml +.. code-block:: yaml # Example configuration entry wifi: @@ -85,7 +85,7 @@ to the ESP. This way, the ESP doesn't need to go through the slow DHCP process. You can do so with the ``manual_ip:`` option in the WiFi configuration. -.. code:: yaml +.. code-block:: yaml wifi: # ... @@ -121,7 +121,7 @@ please also try ``light``. - ``LIGHT`` - ``HIGH`` (most power saving) -.. code:: yaml +.. code-block:: yaml wifi: # ... diff --git a/esphomeyaml/cookbook/bruh.rst b/esphomeyaml/cookbook/bruh.rst index 775bab2ebf..f0f3075cdf 100644 --- a/esphomeyaml/cookbook/bruh.rst +++ b/esphomeyaml/cookbook/bruh.rst @@ -16,7 +16,7 @@ stuff used by the Multisensor 🎉 Thank you very much to `@jackjohnsonuk `__ for providing this configuration file 😀 -.. code:: yaml +.. code-block:: yaml esphomeyaml: name: diff --git a/esphomeyaml/cookbook/dual-r2-cover.rst b/esphomeyaml/cookbook/dual-r2-cover.rst index 4a21c69219..1f2f5517fa 100644 --- a/esphomeyaml/cookbook/dual-r2-cover.rst +++ b/esphomeyaml/cookbook/dual-r2-cover.rst @@ -28,7 +28,7 @@ for some motors. feature is implemented using asynchronous automations. So every time a open/close command is sent a delayed relay off command is added and old ones are not removed. -.. code:: yaml +.. code-block:: yaml esphomeyaml: name: cover diff --git a/esphomeyaml/cookbook/garage-door.rst b/esphomeyaml/cookbook/garage-door.rst index 98f0b4596e..ba814d6747 100644 --- a/esphomeyaml/cookbook/garage-door.rst +++ b/esphomeyaml/cookbook/garage-door.rst @@ -3,7 +3,7 @@ Simple Garage Door .. seo:: :description: Instructions for setting up a simple garage door in esphomelib. - :image: window-open.svg + :image: window-open.png The following is a possible configuration file for garage doors that are controlled by two relays: One for opening and another one for closing the garage door. When either one of them is turned on @@ -11,7 +11,7 @@ for a short period of time, the close/open action begins. -.. code:: yaml +.. code-block:: yaml switch: - platform: gpio diff --git a/esphomeyaml/cookbook/pir.rst b/esphomeyaml/cookbook/pir.rst index 186dceb4ed..5c873a3ce3 100644 --- a/esphomeyaml/cookbook/pir.rst +++ b/esphomeyaml/cookbook/pir.rst @@ -45,7 +45,7 @@ To configure esphomeyaml for use with the PIR sensor, use a if a pin is pulled HIGH/LOW and reports those values to Home Assistant. Optionally also set a ``device_class`` so that Home Assistant uses a nice icon for the binary sensor. -.. code:: yaml +.. code-block:: yaml binary_sensor: - platform: gpio diff --git a/esphomeyaml/cookbook/power_meter.rst b/esphomeyaml/cookbook/power_meter.rst index 31ef0904e1..77794c4292 100644 --- a/esphomeyaml/cookbook/power_meter.rst +++ b/esphomeyaml/cookbook/power_meter.rst @@ -27,7 +27,7 @@ And... that should already be it :) For esphomelib, you can then use the :doc:`pulse counter sensor ` using below configuration: -.. code:: yaml +.. code-block:: yaml sensor: - platform: pulse_counter @@ -51,7 +51,7 @@ power meter, tell them about esphomelib 😉 a single power meter tick can result in many pulses being counted. This effect is especially big on ESP8266s. If you're experiencing this, try enabling the ``internal_filter:`` filter option: - .. code:: yaml + .. code-block:: yaml sensor: - platform: pulse_counter diff --git a/esphomeyaml/cookbook/relay.rst b/esphomeyaml/cookbook/relay.rst index efd828f05c..40f060953d 100644 --- a/esphomeyaml/cookbook/relay.rst +++ b/esphomeyaml/cookbook/relay.rst @@ -32,7 +32,7 @@ when the input turns off, ``NC`` is connected to ``COM``. To use a relay with esphomelib, use a :doc:`GPIO Switch `. -.. code:: yaml +.. code-block:: yaml switch: - platform: gpio diff --git a/esphomeyaml/cookbook/temt6000.rst b/esphomeyaml/cookbook/temt6000.rst index b904d34f5b..197880ba78 100644 --- a/esphomeyaml/cookbook/temt6000.rst +++ b/esphomeyaml/cookbook/temt6000.rst @@ -21,7 +21,7 @@ To get the brightness the sensor measures, we then simply have to measure the vo on the ``SIG`` (also called ``OUT``) pin using the :doc:`/esphomeyaml/components/sensor/adc` and convert those voltage measurements to illuminance values in lux using a formula: -.. code:: yaml +.. code-block:: yaml sensor: - platform: adc diff --git a/esphomeyaml/devices/esp32.rst b/esphomeyaml/devices/esp32.rst index 4c08c0fba8..2f791b940b 100644 --- a/esphomeyaml/devices/esp32.rst +++ b/esphomeyaml/devices/esp32.rst @@ -3,14 +3,14 @@ Generic ESP32 .. seo:: :description: Information about how to use generic ESP32 boards in esphomelib. - :image: esp32.svg + :image: esp32.png All ESP32-based devices are supported by esphomeyaml. Simply select ``ESP32`` when the esphomeyaml wizard asks you for your platform and choose a board type from `this link `__ when the wizard asks you for the board type. -.. code:: yaml +.. code-block:: yaml # Example configuration entry esphomeyaml: @@ -33,7 +33,7 @@ Some notes about the pins on the ESP32: the :doc:`touch pad binary sensor ` like some other pins. -.. code:: yaml +.. code-block:: yaml # Example configuration entry esphomeyaml: diff --git a/esphomeyaml/devices/esp8266.rst b/esphomeyaml/devices/esp8266.rst index 44c269ffd0..933cfca4da 100644 --- a/esphomeyaml/devices/esp8266.rst +++ b/esphomeyaml/devices/esp8266.rst @@ -3,7 +3,7 @@ Generic ESP8266 .. seo:: :description: Instructions for using generic ESP8266s with esphomelib. - :image: esp8266.svg + :image: esp8266.png :keywords: ESP8266 All ESP8266-based devices are supported by esphomeyaml. Simply select ``ESP8266`` when @@ -12,7 +12,7 @@ from `this link ` to ``esp01_1m`` and set ``board_flash_mode`` to ``dout``. -.. code:: yaml +.. code-block:: yaml esphomeyaml: name: diff --git a/esphomeyaml/devices/sonoff_4ch.rst b/esphomeyaml/devices/sonoff_4ch.rst index 0a30b71704..6c0e189a0a 100644 --- a/esphomeyaml/devices/sonoff_4ch.rst +++ b/esphomeyaml/devices/sonoff_4ch.rst @@ -127,7 +127,7 @@ the Sonoff 4CH uses the ``dout`` SPI flash chip mode. But, as some users of othe said that other flash modes can brick the device, it's always good to specify it explicitly. -.. code:: yaml +.. code-block:: yaml esphomeyaml: name: @@ -173,7 +173,7 @@ another 2-4 seconds. The 4CH should now be in a flash mode and should not blink Now you can finally run the upload command: -.. code:: bash +.. code-block:: bash esphomeyaml sonoff_4ch.yaml run @@ -229,7 +229,7 @@ of the basic functions. ``GPIO3`` ``TX`` pin (for external sensors) ======================================== ========================================= -.. code:: yaml +.. code-block:: yaml esphomeyaml: name: diff --git a/esphomeyaml/devices/sonoff_basic.rst b/esphomeyaml/devices/sonoff_basic.rst index 3f5b56610c..4ad1e8cf57 100644 --- a/esphomeyaml/devices/sonoff_basic.rst +++ b/esphomeyaml/devices/sonoff_basic.rst @@ -61,7 +61,7 @@ exposes all of the basic functions. ``GPIO17`` Analog Input ================================================== ================================================== -.. code:: yaml +.. code-block:: yaml esphomeyaml: name: @@ -120,7 +120,7 @@ pre-compile the firmware. Or run the upload command if your device is connected to the serial interface: -.. code:: bash +.. code-block:: bash esphomeyaml sonoff_basic.yaml run diff --git a/esphomeyaml/devices/sonoff_s20.rst b/esphomeyaml/devices/sonoff_s20.rst index 349b7481cf..17fcf23333 100644 --- a/esphomeyaml/devices/sonoff_s20.rst +++ b/esphomeyaml/devices/sonoff_s20.rst @@ -128,7 +128,7 @@ the Sonoff S20 uses the ``dout`` SPI flash chip mode. But, as some users of othe said that other flash modes can brick the device, it's always good to specify it explicitly. -.. code:: yaml +.. code-block:: yaml esphomeyaml: name: @@ -169,7 +169,7 @@ The S20 should now be in a flash mode and should not blink with any LED. Now you can finally run the upload command: -.. code:: bash +.. code-block:: bash esphomeyaml sonoff_s20.yaml run @@ -213,7 +213,7 @@ of the basic functions. ``GPIO3`` ``TX`` pin (for external sensors) ======================================== ======================================== -.. code:: yaml +.. code-block:: yaml esphomeyaml: name: @@ -274,7 +274,7 @@ into a :doc:`monochromatic light `. And if you want the thing that's connected through the output of the S20 to appear as a light in Home Assistant, replace the last part with this: -.. code:: yaml +.. code-block:: yaml switch: - platform: restart diff --git a/esphomeyaml/guides/automations.rst b/esphomeyaml/guides/automations.rst index 75a2f20bcf..c6dbeda8f5 100644 --- a/esphomeyaml/guides/automations.rst +++ b/esphomeyaml/guides/automations.rst @@ -5,7 +5,7 @@ Automations And Templates .. seo:: :description: Getting started guide for automations in esphomelib. - :image: auto-fix.svg + :image: auto-fix.png Automations and templates are two very powerful concepts of esphomelib/yaml. Automations allow you to perform actions under certain conditions and templates are a way to easily @@ -14,7 +14,7 @@ API. Let's begin with an example to explain these concepts. Suppose you have this configuration file: -.. code:: yaml +.. code-block:: yaml switch: - platform: gpio @@ -42,7 +42,7 @@ hopefully a bit easier to read and understand than Home Assistant's. For example, this configuration would achieve your desired behavior: -.. code:: yaml +.. code-block:: yaml switch: - platform: gpio @@ -62,7 +62,7 @@ For example, this configuration would achieve your desired behavior: Woah, hold on there. Please explain what's going on here! Sure :) Let's step through what's happening here. -.. code:: yaml +.. code-block:: yaml switch: - platform: gpio @@ -72,7 +72,7 @@ Woah, hold on there. Please explain what's going on here! Sure :) Let's step thr First, we have to give the dehumidifier an :ref:`config-id` so that we can later use it inside our awesome automation. -.. code:: yaml +.. code-block:: yaml binary_sensor: - platform: gpio @@ -85,7 +85,7 @@ follows what you would call these events on mouse buttons. A *press* happens whe There are also other triggers like ``on_release``, ``on_click`` or ``on_double_click`` available. -.. code:: yaml +.. code-block:: yaml # ... on_press: @@ -102,7 +102,7 @@ Within this block, you can define several "actions". For example, ``switch.toggl action. Each action is separated by a dash and multiple actions can be executed in series by just adding another ``-`` like so: -.. code:: yaml +.. code-block:: yaml # ... on_press: @@ -114,7 +114,7 @@ like so: With this automation, a press on the push button would cause the dehumidifier to turn on/off for 2 seconds, and then cycle back to its original state. Similarly you can have a single trigger with multiple automations: -.. code:: yaml +.. code-block:: yaml # ... on_press: @@ -133,7 +133,7 @@ cycle back to its original state. Similarly you can have a single trigger with m As a last example, let's make our dehumidifier smart: Let's make it turn on automatically when the humidity a sensor reports is above 65% and make it turn off again when it reaches 50% -.. code:: yaml +.. code-block:: yaml sensor: - platform: dht @@ -166,7 +166,7 @@ With templates inside esphomelib, you can do almost *everything*. If for example automation if a certain complex formula evaluates to true, you can do that with templates. Let's look at an example first: -.. code:: yaml +.. code-block:: yaml binary_sensor: - platform: gpio @@ -221,7 +221,7 @@ we're retrieving the current state of the end stop using ``.state`` and using it variables like so. In this example the variable ``num_executions`` is incremented by one each time the lambda is executed and the current value is logged. - .. code:: yaml + .. code-block:: yaml lambda: |- static int num_executions = 0; @@ -236,7 +236,7 @@ Bonus: Templating Actions Another feature of esphomeyaml is that you can template almost every parameter for actions in automations. For example if you have a light and want to set it to a pre-defined color when a button is pressed, you can do this: -.. code:: yaml +.. code-block:: yaml on_press: then: @@ -246,8 +246,8 @@ if you have a light and want to set it to a pre-defined color when a button is p red: 0.8 green: 1.0 blue: !lambda >- - # The sensor outputs values from 0 to 100. The blue - # part of the light color will be determined by the sensor value. + // The sensor outputs values from 0 to 100. The blue + // part of the light color will be determined by the sensor value. return id(some_sensor).state / 100.0; Every parameter in actions that has the label "templatable" in the docs can be templated like above, using @@ -262,7 +262,7 @@ Bonus 2: Global Variables In some cases you might require to share a global variable across multiple lambdas. For example, global variables can be used to store the state of a garage door. -.. code:: yaml +.. code-block:: yaml # Example configuration entry globals: @@ -364,7 +364,7 @@ All Actions This action delays the execution of the next action in the action list by a specified time period. -.. code:: yaml +.. code-block:: yaml on_...: then: @@ -386,11 +386,11 @@ time period. This action executes an arbitrary piece of C++ code (see :ref:`Lambda `). -.. code:: yaml +.. code-block:: yaml on_...: then: - - lambda: >- + - lambda: |- id(some_binary_sensor).publish_state(false); .. _if_action: @@ -406,7 +406,7 @@ After the chosen branch (``then`` or ``else``) is done with execution, the next For example below you can see an automation that checks if a sensor value is below 30 and if so turns on a light for 5 seconds. Otherwise, the light is turned off immediately. -.. code:: yaml +.. code-block:: yaml on_...: then: @@ -441,7 +441,7 @@ Using this action you can manually call the ``update()`` method of a component. Please note that this only works with some component types and others will result in a compile error. -.. code:: yaml +.. code-block:: yaml on_...: then: @@ -462,7 +462,7 @@ triggers. With the ``script`` component you can define these steps in a central place, and then execute the script with a single call. -.. code:: yaml +.. code-block:: yaml # Example configuration entry script: diff --git a/esphomeyaml/guides/cli.rst b/esphomeyaml/guides/cli.rst index 9df0df204f..83123485f0 100644 --- a/esphomeyaml/guides/cli.rst +++ b/esphomeyaml/guides/cli.rst @@ -9,7 +9,7 @@ Base Usage esphomeyaml's command line interface always has the following format -.. code:: console +.. code-block:: console esphomeyaml [ARGUMENTS] diff --git a/esphomeyaml/guides/configuration-types.rst b/esphomeyaml/guides/configuration-types.rst index 5186693a6c..7122d1aa44 100644 --- a/esphomeyaml/guides/configuration-types.rst +++ b/esphomeyaml/guides/configuration-types.rst @@ -3,7 +3,7 @@ Configuration Types .. seo:: :description: Documentation of different configuration types in esphomelib - :image: settings.svg + :image: settings.png esphomeyaml’s configuration files have several configuration types. This page describes them. @@ -23,7 +23,7 @@ ID twice. Because esphomeyaml converts your configuration into C++ code and the ids are in reality just C++ variable names, they must also adhere to C++’s naming conventions. `C++ Variable -names `__ +names `__ … - … must start with a letter and can end with numbers. @@ -49,7 +49,7 @@ for the ``D0`` (as printed on the PCB silkscreen) pin on the NodeMCU ESP8266 has the internal GPIO name ``GPIO16``, but also has an alias ``D0``. So using either one of these names in your configuration will lead to the same result. -.. code:: yaml +.. code-block:: yaml some_config_option: pin: GPIO16 @@ -65,7 +65,7 @@ Pin Schema In some places, esphomeyaml also supports a more advanced “pin schema”. -.. code:: yaml +.. code-block:: yaml some_config_option: # Basic: @@ -116,7 +116,7 @@ Time In lots of places in esphomeyaml you need to define time periods. There are several ways of doing this. See below examples to see how you can specify time periods: -.. code:: yaml +.. code-block:: yaml some_config_option: some_time_option: 1000us # 1000 microseconds = 1ms diff --git a/esphomeyaml/guides/contributing.rst b/esphomeyaml/guides/contributing.rst index 7c82acdd07..c5ebbadd8a 100644 --- a/esphomeyaml/guides/contributing.rst +++ b/esphomeyaml/guides/contributing.rst @@ -3,7 +3,7 @@ Contributing .. seo:: :description: Getting started guide for contributing to the esphomelib project - :image: github-circle.svg + :image: github-circle.png Contributions to the esphomelib suite are very welcome! All the code for the projects is hosted on GitHub and you can find the sources here: @@ -31,21 +31,21 @@ RST primer: - **Headers**: You can write titles like this: - .. code:: rst + .. code-block:: rst My Title ======== and section headers like this: - .. code:: rst + .. code-block:: rst My Sub Section -------------- and sub-section headers like this: - .. code:: rst + .. code-block:: rst My Sub-sub section ****************** @@ -53,7 +53,7 @@ RST primer: - **Links**: To create a link to an external resource (for example https://www.google.com), use ``\`Link text \`__``. For example: - .. code:: rst + .. code-block:: rst `Google.com `__ @@ -62,7 +62,7 @@ RST primer: - **References**: To reference another document, use the ``:doc:`` and ``:ref:`` roles (references are set up globally and can be used between documents): - .. code:: rst + .. code-block:: rst .. _my-reference-label: @@ -77,17 +77,17 @@ RST primer: - **Inline code**: To have text appear ``like this``, use double backticks: - .. code:: rst + .. code-block:: rst To have text appear ``like this``, use double backticks. To have text appear ``like this``, use double backticks. -- **Code blocks**: To show a sample configuration file, use the ``code`` directive: +- **Code blocks**: To show a sample configuration file, use the ``code-block`` directive: - .. code:: rst + .. code-block:: rst - .. code:: yaml + .. code-block:: yaml # Sample configuration entry switch: @@ -95,7 +95,7 @@ RST primer: name: "Relay #42" pin: GPIO13 - .. code:: yaml + .. code-block:: yaml # Sample configuration entry switch: @@ -103,14 +103,9 @@ RST primer: name: "Relay #42" pin: GPIO13 - .. note:: - - The YAML syntax highlighter is currently broken. Somehow sphinx thinks this should be - C++ code 🤯. If you know how to fix this, it would be very much appreciated 😉 - - **Images**: To show images, use the ``figure`` directive: - .. code:: rst + .. code-block:: rst .. figure:: images/dashboard.png :align: center @@ -127,7 +122,7 @@ RST primer: - **Notes and warnings**: You can create simple notes and warnings using the ``note`` and ``warning`` directives: - .. code:: rst + .. code-block:: rst .. note:: @@ -148,7 +143,7 @@ RST primer: - **Italic and boldface font families**: To *italicize* text, use one asterisk around the text. To put **a strong emphasis** on a piece of text, put two asterisks around it. - .. code:: rst + .. code-block:: rst *This is italicized.* (A weird word...) **This is very important.** @@ -158,7 +153,7 @@ RST primer: - **Ordered and unordered list**: The syntax for lists in RST is more or less the same as in markdown: - .. code:: rst + .. code-block:: rst - Unordered Item @@ -186,7 +181,7 @@ please have a look at the `Sphinx reStructuredText Primer `__. -.. code:: bash +.. code-block:: bash # in esphomedocs repo: pip3 install -r requirements.txt @@ -195,7 +190,7 @@ To check your documentation changes locally, you first need install sphinx (**wi Alternatively, you can use the `esphomedocs docker image `__: - .. code:: bash + .. code-block:: bash docker run --rm -v "$PWD/..":/data -p 8000:8000 -it ottowinter/esphomedocs @@ -204,7 +199,7 @@ To check your documentation changes locally, you first need install sphinx (**wi Next, you will also need to clone the `esphomelib repository `__ into the folder where ``esphomedocs`` sits like this: -.. code:: +.. code-block:: text ├── esphomedocs/ │   ├── api/ @@ -222,7 +217,7 @@ the folder where ``esphomedocs`` sits like this: Then, use the provided Makefile to build the changes and start a simple web server: -.. code:: bash +.. code-block:: bash # Update doxygen API docs make doxyg @@ -256,7 +251,7 @@ look around the code base a bit and see how other components are doing stuff. To initialize the development environment, navigate to the repository and execute: -.. code:: bash +.. code-block:: bash # View available IDEs: pio init --help @@ -329,13 +324,13 @@ it in the configuration. Specifically, it may contain these fields: and add it to the global expression index. The return value is the left hand side variable which you can use for further calls. - .. code:: cpp + .. code-block:: cpp = ; - Register a variable of a pointer type using ``Pvariable(, , rhs)``. - .. code:: cpp + .. code-block:: cpp * = ; @@ -352,14 +347,14 @@ it in the configuration. Specifically, it may contain these fields: the correct operator. Additionally, you can pass a type as the second argument to ``get_variable``. This will cause esphomeyaml to use the first variable of that type. - .. code:: cpp + .. code-block:: cpp hub = get_variable(config.get(CONF_DALLAS_ID), DallasComponent) - Pass configuration arguments to mock function calls (like ``App.make_dallas_component``) using normal python :) - .. code:: python + .. code-block:: python rhs = App.make_dallas_component(config[CONF_PIN], config.get(CONF_UPDATE_INTERVAL)) @@ -367,7 +362,7 @@ it in the configuration. Specifically, it may contain these fields: - ``BUILD_FLAGS``: Pass build flags that should be provided if your component is loaded. - .. code:: python + .. code-block:: python BUILD_FLAGS = '-DUSE_DALLAS_SENSOR' diff --git a/esphomeyaml/guides/faq.rst b/esphomeyaml/guides/faq.rst index 0642915cf0..d7d2682dc5 100644 --- a/esphomeyaml/guides/faq.rst +++ b/esphomeyaml/guides/faq.rst @@ -3,7 +3,7 @@ Frequently Asked Questions .. seo:: :description: Frequently asked questions in esphomelib. - :image: question_answer.svg + :image: question_answer.png Tips for using esphomeyaml -------------------------- @@ -14,20 +14,20 @@ Tips for using esphomeyaml 2. If you want to see how esphomeyaml interprets your configuration, run - .. code:: bash + .. code-block:: bash esphomeyaml livingroom.yaml config 3. To view the logs from your node without uploading, run - .. code:: bash + .. code-block:: bash esphomeyaml livingroom.yaml logs 4. If you have changed the name of the node and want to update over-the-air, just specify ``--upload-port`` when running esphomeyaml. For example: - .. code:: bash + .. code-block:: bash esphomeyaml livingroom.yaml run --upload-port 192.168.178.52 @@ -121,12 +121,15 @@ great way for me to track and (hopefully) fix issues, so thank you! For me to fix the issue the quickest, there are some things that would be really helpful: -1. How do you use esphomelib? Through esphomeyaml or directly through C++ code? -2. If it's a build/upload issue: What system are you compiling/uploading things from? Windows, POSIX, from docker? -3. A snippet of the code/configuration file used is always great for a better understanding of the issue. -4. If it's an i2c or hardware communication issue please also try setting the +1. **Just writing "X doesn't work" or "X gives bug" is not helpful!!!** Seriously, how do you expect + me to help given just that information? +2. A snippet of the code/configuration file used is always great for me to reproduce this issue. + Please read `How to create a Minimal, Complete, and Verifiable example `__. +3. If it's an i2c or hardware communication issue please also try setting the :ref:`log level ` to ``VERY_VERBOSE`` as it provides helpful information about what is going on. +4. Please also include what you've already tried and didn't work so that these things can + be You can find the issue tracker here https://github.com/OttoWinter/esphomelib/issues @@ -135,7 +138,7 @@ How do I update to the latest version? It's simple. Run: -.. code:: bash +.. code-block:: bash pip2 install -U esphomeyaml # From docker: @@ -152,7 +155,7 @@ esphomelib has a beta release cycle so that new releases can easily be tested be the changes are deployed to the stable channel. You can help test esphomeyaml (and use new features) by installing the esphomeyaml beta: -.. code:: bash +.. code-block:: bash # For pip-based installs pip2 install --pre -U esphomeyaml @@ -208,7 +211,7 @@ I have a question... How can I contact you? Sure! I'd be happy to help :) You can contact me here: - `Discord `__ -- `Home Assistant Community Forums `__ +- `Home Assistant Community Forums `__ - `esphomelib `__ and `esphomeyaml `__ issue trackers. Preferably only for issues and feature requests. @@ -275,7 +278,7 @@ If even this doesn't work or you like to have a lot of components enabled there First we temporary 'remove' (comment out) all components from the ``yaml`` file, leaving only: ``esphomeyaml``, ``ota`` and ``wifi``, example: -.. code:: yaml +.. code-block:: yaml esphomeyaml: name: sonoff_basic diff --git a/esphomeyaml/guides/getting_started_command_line.rst b/esphomeyaml/guides/getting_started_command_line.rst index 3dc007de14..63e8a564c6 100644 --- a/esphomeyaml/guides/getting_started_command_line.rst +++ b/esphomeyaml/guides/getting_started_command_line.rst @@ -3,7 +3,7 @@ Getting Started with esphomeyaml .. seo:: :description: Getting Started guide for installing esphomeyaml using the command line and creating a basic configuration. - :image: console.svg + :image: console.png esphomeyaml is the perfect solution for creating custom firmwares for your ESP8266/ESP32 boards. In this guide we’ll go through how to setup a @@ -17,7 +17,7 @@ Installing esphomeyaml is very easy. All you need to do is have `Python (because of platformio 😕) and install the console script script through ``pip``. -.. code:: bash +.. code-block:: bash pip install esphomeyaml @@ -25,7 +25,7 @@ Alternatively, there’s also a docker image available for easy installation (the docker hub image is only available for amd64 right now; if you have an RPi, please install esphomelib through ``pip`` or use :doc:`the HassIO add-on `: -.. code:: bash +.. code-block:: bash docker pull ottowinter/esphomeyaml @@ -37,7 +37,7 @@ friendly setup wizard that will guide you through creating your first configuration file. For example, if you want to create a configuration file called ``livingroom.yaml``: -.. code:: bash +.. code-block:: bash esphomeyaml livingroom.yaml wizard # On Docker: @@ -59,7 +59,7 @@ So now you should have a file called ``livingroom.yaml`` (or similar). Go open that file in an editor of your choice and let’s add a :doc:`simple GPIO switch ` to our app. -.. code:: yaml +.. code-block:: yaml switch: - platform: gpio @@ -84,7 +84,7 @@ you have something you want to upload to your ESP board, simply plug in the device via USB and type the following command (replacing ``livingroom.yaml`` with your configuration file): -.. code:: bash +.. code-block:: bash esphomeyaml livingroom.yaml run @@ -102,7 +102,7 @@ uploading on the host system. If you are running docker on Linux you can add ``--device=/dev/ttyUSB0`` to your docker command to map a local USB device. -.. code:: bash +.. code-block:: bash docker run --rm -v "`pwd`":/config -it ottowinter/esphomeyaml livingroom.yaml compile platformio run -d livingroom -t upload @@ -126,7 +126,7 @@ Next, we’re going to add a very simple binary sensor that periodically checks a GPIO pin whether it’s pulled high or low - the :doc:`GPIO Binary Sensor `. -.. code:: yaml +.. code-block:: yaml binary_sensor: - platform: gpio @@ -145,7 +145,7 @@ through USB again. The upload will magically happen “over the air”. Using esphomeyaml directly, this is the same as from a USB cable, but for docker you need to supply an additional parameter: -.. code:: bash +.. code-block:: bash esphomeyaml livingroom.yaml run # On docker @@ -177,7 +177,7 @@ easily manage your nodes from a nice web interface. It was primarily designed fo To start the esphomeyaml dashboard, simply start esphomeyaml with the following command (with ``config/`` pointing to a directory where you want to store your configurations) -.. code:: bash +.. code-block:: bash # Install dashboard dependencies pip2 install tornado esptool @@ -204,7 +204,7 @@ be edited and all changes in there will be overriden, but outside of those comments you can safely create custom sensors while still using esphomeyaml’s great configuration options. -.. code:: cpp +.. code-block:: cpp // Auto generated code by esphomeyaml #include "esphomelib/application.h" @@ -223,7 +223,6 @@ esphomeyaml’s great configuration options. void loop() { App.loop(); - delay(20); } See Also diff --git a/esphomeyaml/guides/getting_started_hassio.rst b/esphomeyaml/guides/getting_started_hassio.rst index 1fbbc5503d..7bfa2af48c 100644 --- a/esphomeyaml/guides/getting_started_hassio.rst +++ b/esphomeyaml/guides/getting_started_hassio.rst @@ -3,7 +3,7 @@ Getting Started with esphomeyaml through HassIO .. seo:: :description: Getting Started guide for installing esphomeyaml as a HassIO Add-on and creating a basic configuration. - :image: home-assistant.svg + :image: home-assistant.png esphomeyaml is the perfect solution for creating custom firmwares for your ESP8266/ESP32 boards. In this guide we’ll go through how to setup a @@ -99,7 +99,7 @@ So now you should have a file called ``/config/esphomeyaml/livingroom.yaml`` (or Go open that file in and add a :doc:`simple GPIO switch ` to the configuration like this: -.. code:: yaml +.. code-block:: yaml switch: - platform: gpio @@ -129,7 +129,7 @@ Next, we’re going to add a very simple binary sensor that periodically checks a GPIO pin whether it’s pulled high or low - the :doc:`GPIO Binary Sensor `. -.. code:: yaml +.. code-block:: yaml binary_sensor: - platform: gpio @@ -178,7 +178,7 @@ be edited and all changes in there will be overridden, but outside of those comments you can safely create custom sensors while still using esphomeyaml’s great configuration options. -.. code:: cpp +.. code-block:: cpp // Auto generated code by esphomeyaml #include "esphomelib/application.h" @@ -197,7 +197,6 @@ esphomeyaml’s great configuration options. void loop() { App.loop(); - delay(20); } See Also diff --git a/esphomeyaml/guides/migrate_espeasy.rst b/esphomeyaml/guides/migrate_espeasy.rst index d86a881d89..1646c1abef 100644 --- a/esphomeyaml/guides/migrate_espeasy.rst +++ b/esphomeyaml/guides/migrate_espeasy.rst @@ -3,7 +3,7 @@ Migrating from ESPEasy .. seo:: :description: Migration guide for installing esphomelib on ESPs running ESPEasy. - :image: espeasy.svg + :image: espeasy.png Migrating from previous ESPEasy setups is very easy. You just need to have esphomeyaml create a binary for you and then upload that in the ESPEasy web interface. diff --git a/esphomeyaml/guides/migrate_espurna.rst b/esphomeyaml/guides/migrate_espurna.rst index 1feb3bf3df..3089958f4b 100644 --- a/esphomeyaml/guides/migrate_espurna.rst +++ b/esphomeyaml/guides/migrate_espurna.rst @@ -3,7 +3,7 @@ Migrating from ESPurna .. seo:: :description: Migration guide for installing esphomelib on ESPs running ESPurna. - :image: espurna.svg + :image: espurna.png Migrating from previous ESPurna setups is very easy. You just need to have esphomeyaml create a binary for you and then upload that in the ESPurna web interface. diff --git a/esphomeyaml/guides/migrate_sonoff_tasmota.rst b/esphomeyaml/guides/migrate_sonoff_tasmota.rst index 457d31c450..a21640a5c0 100644 --- a/esphomeyaml/guides/migrate_sonoff_tasmota.rst +++ b/esphomeyaml/guides/migrate_sonoff_tasmota.rst @@ -3,7 +3,7 @@ Migrating from Sonoff Tasmota .. seo:: :description: Migration guide for installing esphomelib on ESPs running Sonoff Tasmota. - :image: tasmota.svg + :image: tasmota.png Migrating from previous Sonoff Tasmota setups is very easy. You just need to have esphomeyaml create a binary for you and then upload that in the Tasmota web interface. diff --git a/esphomeyaml/index.rst b/esphomeyaml/index.rst index 25fe047f26..ba4c2e59ad 100644 --- a/esphomeyaml/index.rst +++ b/esphomeyaml/index.rst @@ -4,8 +4,8 @@ esphomeyaml .. image:: images/esphomeyaml-logo-full.svg .. seo:: - :description: esphomeyaml Component index - Reimagining DIY Home Automation - :image: /_static/logo-full.png + :description: esphomeyaml Component index - esphomeyaml Homepage - Reimagining DIY Home Automation. esphomelib is a framework that tries to provide the best possible use experience for using ESP8266 and ESP32 microcontrollers for Home Automation. esphomeyaml is the tool that converts YAML configuration files into custom firmwares and has many helpers so that you only have to worry about creating the hardware, esphomeyaml will take care of the rest. + :image: esphomeyaml-logo-full.png .. raw:: html diff --git a/githubpages.py b/githubpages.py new file mode 100644 index 0000000000..2ea6323c1e --- /dev/null +++ b/githubpages.py @@ -0,0 +1,14 @@ +import os + +def create_nojekyll(app, env): + if app.builder.format == 'html': + path = os.path.join(app.builder.outdir, '.nojekyll') + open(path, 'wt').close() + + path = os.path.join(app.builder.outdir, 'CNAME') + with open(path, 'wt') as f: + f.write(os.getenv('CNAME', 'esphomelib.com')) + + +def setup(app): + app.connect('env-updated', create_nojekyll) diff --git a/index.rst b/index.rst index 36c897de4d..4f2a5791cd 100644 --- a/index.rst +++ b/index.rst @@ -5,8 +5,8 @@ esphomelib :google-site-verification: qclmMpSERA2uy_ZceVgL6ijwkeEHer75LEPyyTQnK4E .. seo:: - :description: esphomeyaml Homepage - Reimagining DIY Home Automation - :image: /_static/logo-full.png + :description: esphomelib Homepage - Reimagining DIY Home Automation. esphomelib is a framework that tries to provide the best possible use experience for using ESP8266 and ESP32 microcontrollers for Home Automation. + :image: logo-full.png .. image:: /esphomeyaml/images/logo-full.svg @@ -32,9 +32,9 @@ esphomeyaml will: * Read your configuration file and warn you about potential errors (like using the invalid pins.) * Create a custom C++ sketch file for you using esphomeyaml's powerful C++ generation engine. - * Compile the sketch file for you using `platformio `__. + * Compile the sketch file for you using `platformio `__. * Upload the binary to your ESP via Over the Air updates. - * If you're using `Home Assistant `__, esphomelib + * If you're using `Home Assistant `__, esphomelib will automatically add all components to the home assistant UI. Features diff --git a/seo.py b/seo.py index 95c8109e7a..d8fd3b112b 100644 --- a/seo.py +++ b/seo.py @@ -95,10 +95,6 @@ def run(self): if not image.startswith('/'): image = '/_images/' + image self.options['image'] = env.config.html_baseurl + image - description = self.options.get('description') - if description is not None and len(description) >= 200: - self.options['description'] = description[:200].rsplit(' ', 1)[0] + '...' - return [SEONode(**self.options)] diff --git a/svg2png.py b/svg2png.py new file mode 100644 index 0000000000..33408c3831 --- /dev/null +++ b/svg2png.py @@ -0,0 +1,31 @@ +import os +import shlex +import subprocess + + +path = '_build/html/_images/' + +for from_ in os.listdir(path): + if not from_.endswith('.svg'): + continue + + to_ = from_[:-len('.svg')] + '.png' + from_ = os.path.abspath(os.path.join(path, from_)) + to_ = os.path.abspath(os.path.join(path, to_)) + + if os.path.exists(to_): + to_mtime = os.path.getmtime(to_) + from_mtime = os.path.getmtime(from_) + if to_mtime > from_mtime: + # Let's not re-convert files if we've already converted them + # Yes, mtime is not great but it's better than having the builds take + # ages + continue + + args = ['inkscape', '-z', '-e', to_, '-w', '800', + '-background', 'white', from_] + print("Running: {}".format(' '.join(shlex.quote(x) for x in args))) + proc = subprocess.run(args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + if b'Bitmap saved as' not in proc.stdout: + print("Error!") + print(proc.stdout) diff --git a/web-api/index.rst b/web-api/index.rst index a321330655..9dfdaafc97 100644 --- a/web-api/index.rst +++ b/web-api/index.rst @@ -3,7 +3,7 @@ Web Server API .. seo:: :description: Migration guide for installing esphomelib on ESPs running ESPEasy. - :image: espeasy.svg + :image: espeasy.png Since version 1.3, esphomelib includes a built-in web server that can be used to view states and send commands. In addition to visible the web-frontend available under the root index of the