Add more lints

This commit is contained in:
Otto Winter 2019-02-27 18:32:47 +01:00
parent 5f55de48ec
commit 7478734228
No known key found for this signature in database
GPG Key ID: DB66C0BE6013F97E
35 changed files with 360 additions and 216 deletions

View File

@ -53,8 +53,9 @@ of time to find+fix some final bugs.
**How do I migrate from MQTT?**
First, make sure you run at least Home Assistant 0.85.0 (currently a `beta release <https://www.home-assistant.io/docs/installation/updating/#run-the-beta-version>`__). Then, go through the
:ref:`migration guide here <api-mqtt_to_native>`.
First, make sure you run at least Home Assistant 0.85.0 (currently a
`beta release <https://www.home-assistant.io/docs/installation/updating/#run-the-beta-version>`__).
Then, go through the :ref:`migration guide here <api-mqtt_to_native>`.
Python 3 Compatibility
----------------------

View File

@ -148,6 +148,7 @@ Beta Fixes
All changes
-----------
- core: Attemp to fix the addressable flicker effect :corepr:`392` by :ghuser:`RomRider`
- esphome: typing is only required for python < 3.5 :esphomepr:`341` by :ghuser:`dotlambda`
- esphome: Fix install pillow in docker image :esphomepr:`338`

View File

@ -190,6 +190,7 @@ for using esphomeyaml to create a simple wireless doorbell:
.. raw:: html
<iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/xCQoOZNdaGY" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>
<iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/xCQoOZNdaGY"
frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>
.. disqus::

View File

@ -69,18 +69,30 @@ awesome projects ☀️
Special thanks to all the contributors for this release:
- esphomeyaml: Add only-generate parameter to generate command to only generate the C++ code `#84 <https://github.com/OttoWinter/esphomeyaml/pull/84>`__ by `@apeeters <https://github.com/apeeters>`__
- esphomeyaml: Fix esphomeyaml logs for tls enabled mqtt brokers `#118 <https://github.com/OttoWinter/esphomeyaml/pull/118>`__ by `@johnerikhalse <https://github.com/johnerikhalse>`__
- esphomelib: Add Samsung IR codes `#141 <https://github.com/OttoWinter/esphomelib/pull/141>`__ by `@escoand <https://github.com/escoand>`__
- esphomelib: Add support for SNTP and RTC `#76 <https://github.com/OttoWinter/esphomelib/pull/76>`__ by `@brandond <https://github.com/brandond>`__
- esphomelib: Run travis jobs in parallel `#123 <https://github.com/OttoWinter/esphomelib/pull/123>`__ by `@lobradov <https://github.com/lobradov>`__
- esphomelib: Fix typo in dallas error message `#125 <https://github.com/OttoWinter/esphomelib/pull/125>`__ by `@janpieper <https://github.com/janpieper>`__
- esphomelib: Fix esphomelib examples `#124 <https://github.com/OttoWinter/esphomelib/pull/124>`__ by `@lobradov <https://github.com/lobradov>`__
- esphomelib: Fix panic in binary_sensor template `#111 <https://github.com/OttoWinter/esphomelib/pull/111>`__ by `@nunofgs <https://github.com/nunofgs>`__
- esphomelib: Add ESP8266 library dependency to Arduino IDE instructions `#99 <https://github.com/OttoWinter/esphomelib/pull/99>`__ by `@per1234 <https://github.com/per1234>`__
- esphomelib: Fixing I2C readings `#98 <https://github.com/OttoWinter/esphomelib/pull/98>`__ by `@exxamalte <https://github.com/exxamalte>`__
- esphomedocs: Note added about resetting the ESP after serial upload before OTA upload `#14 <https://github.com/OttoWinter/esphomedocs/pull/14>`__ by `@exxamalte <https://github.com/exxamalte>`__
- esphomedocs: Add cookbook for dual relay cover `#10 <https://github.com/OttoWinter/esphomedocs/pull/10>`__ by `@aequitas <https://github.com/aequitas>`__
- esphomeyaml: Add only-generate parameter to generate command to only generate the C++ code
`#84 <https://github.com/OttoWinter/esphomeyaml/pull/84>`__ by `@apeeters <https://github.com/apeeters>`__
- esphomeyaml: Fix esphomeyaml logs for tls enabled mqtt brokers
`#118 <https://github.com/OttoWinter/esphomeyaml/pull/118>`__ by `@johnerikhalse <https://github.com/johnerikhalse>`__
- esphomelib: Add Samsung IR codes `#141 <https://github.com/OttoWinter/esphomelib/pull/141>`__
by `@escoand <https://github.com/escoand>`__
- esphomelib: Add support for SNTP and RTC `#76 <https://github.com/OttoWinter/esphomelib/pull/76>`__
by `@brandond <https://github.com/brandond>`__
- esphomelib: Run travis jobs in parallel `#123 <https://github.com/OttoWinter/esphomelib/pull/123>`__
by `@lobradov <https://github.com/lobradov>`__
- esphomelib: Fix typo in dallas error message `#125 <https://github.com/OttoWinter/esphomelib/pull/125>`__
by `@janpieper <https://github.com/janpieper>`__
- esphomelib: Fix esphomelib examples `#124 <https://github.com/OttoWinter/esphomelib/pull/124>`__
by `@lobradov <https://github.com/lobradov>`__
- esphomelib: Fix panic in binary_sensor template `#111 <https://github.com/OttoWinter/esphomelib/pull/111>`__
by `@nunofgs <https://github.com/nunofgs>`__
- esphomelib: Add ESP8266 library dependency to Arduino IDE instructions `#99 <https://github.com/OttoWinter/esphomelib/pull/99>`__
by `@per1234 <https://github.com/per1234>`__
- esphomelib: Fixing I2C readings `#98 <https://github.com/OttoWinter/esphomelib/pull/98>`__
by `@exxamalte <https://github.com/exxamalte>`__
- esphomedocs: Note added about resetting the ESP after serial upload before OTA upload
`#14 <https://github.com/OttoWinter/esphomedocs/pull/14>`__ by `@exxamalte <https://github.com/exxamalte>`__
- esphomedocs: Add cookbook for dual relay cover `#10 <https://github.com/OttoWinter/esphomedocs/pull/10>`__
by `@aequitas <https://github.com/aequitas>`__
And in some more personal news, you might have noticed that I was not very active in online communications (github, discord, ...)
and that's partly been due to me concentrating on other stuff (university applications, work and
@ -94,7 +106,8 @@ Other notable changes
- Fixed certain occasions where esphomeyaml could run into recursive dependencies
- Fixed i2c scans not showing up via MQTT
- Improved build times by about 60%. Now, the build time should depend on the amount of components you're using, not the total esphomelib code base size.
- Improved build times by about 60%. Now, the build time should depend on the amount of components you're using,
not the total esphomelib code base size.
- Fixed ESP32 Touch setup mode
- Fixed template binary sensors
- Added the option to specify ``never`` for ``update_interval`` to never
@ -181,11 +194,15 @@ Changes in 1.8.2
- esphomedocs: Typo in display docs `#28 <https://github.com/OttoWinter/esphomedocs/pull/28>`__ by `@yuanl <https://github.com/yuanl>`__
- esphomedocs: Typo fix. `#33 <https://github.com/OttoWinter/esphomedocs/pull/33>`__ by `@corbanmailloux <https://github.com/corbanmailloux>`__
- esphomelib: Fix typo "noting" `#172 <https://github.com/OttoWinter/esphomelib/pull/172>`__ by `@TheJulianJES <https://github.com/TheJulianJES>`__
- esphomedocs: Added docker local USB port mapping `#31 <https://github.com/OttoWinter/esphomedocs/pull/31>`__ by `@ladefoged81 <https://github.com/ladefoged81>`__
- esphomedocs: Fixed typo `#30 <https://github.com/OttoWinter/esphomedocs/pull/30>`__ by `@ladefoged81 <https://github.com/ladefoged81>`__
- esphomedocs: Add missing (required) name to example. `#29 <https://github.com/OttoWinter/esphomedocs/pull/29>`__ by `@corbanmailloux <https://github.com/corbanmailloux>`__
- esphomedocs: Added docker local USB port mapping `#31 <https://github.com/OttoWinter/esphomedocs/pull/31>`__
by `@ladefoged81 <https://github.com/ladefoged81>`__
- esphomedocs: Fixed typo `#30 <https://github.com/OttoWinter/esphomedocs/pull/30>`__
by `@ladefoged81 <https://github.com/ladefoged81>`__
- esphomedocs: Add missing (required) name to example. `#29 <https://github.com/OttoWinter/esphomedocs/pull/29>`__
by `@corbanmailloux <https://github.com/corbanmailloux>`__
- esphomedocs: Add ESP32 BLE workaround docs `#34 <https://github.com/OttoWinter/esphomedocs/pull/34>`__
- esphomelib: Apply effect after changing colors `#169 <https://github.com/OttoWinter/esphomelib/pull/169>`__ by `@TheJulianJES <https://github.com/TheJulianJES>`__
- esphomelib: Apply effect after changing colors `#169 <https://github.com/OttoWinter/esphomelib/pull/169>`__
by `@TheJulianJES <https://github.com/TheJulianJES>`__
- esphomelib: Add 64x48 SSD1306 Display `#161 <https://github.com/OttoWinter/esphomelib/pull/161>`__
- esphomedocs: Fix output link `#35 <https://github.com/OttoWinter/esphomedocs/pull/35>`__
- esphomedocs: Fix pulse counter API typo `#36 <https://github.com/OttoWinter/esphomedocs/pull/36>`__

View File

@ -96,7 +96,7 @@ New Features
.. code-block:: text
[13:57:33][I][application:092]: You're running esphomelib v1.9.0 compiled on Nov 3 2018, 13:55:11
[13:57:33][I][application:092]: You're running esphomelib v1.9.0 compiled on Nov 3 2018, 13:55:11
- Stack traces in the USB logs are now automatically decoded to make debugging easier
(:yamlpr:`214`)

View File

@ -48,7 +48,7 @@ If you've previously used ESPHome with Home Assistant via MQTT and have enabled
the upgrade process is unfortunately not just swapping out the ``mqtt`` for ``api`` in your configuration:
Home Assistant's `entity registry <https://developers.home-assistant.io/docs/en/entity_registry_index.html>`__ complicates
things a bit. If you don't follow these steps, all your new native API entities will have a trailing
`_2` at the end of the entity ID.
``_2`` at the end of the entity ID.
You can repeat these steps for all your nodes, or convert them over to the new native API one by one.
@ -70,32 +70,32 @@ You can repeat these steps for all your nodes, or convert them over to the new n
.. raw:: html
<textarea rows="10" cols="50" id="entity-reg-converter"></textarea>
<button type="button" id="entity-reg-button">Convert Entity Registry</button>
<script>
var elem = document.getElementById("entity-reg-converter");
elem.addEventListener("click", function() {
elem.focus();
elem.select();
});
document.getElementById("entity-reg-button").addEventListener("click", function() {
try {
data = JSON.parse(elem.value);
} catch(e) {
alert(e);
}
var entities = data.data.entities;
var newEntities = [];
for (var i = 0; i < entities.length; i++) {
var entity = entities[i];
if (entity.platform != "mqtt") {
newEntities.push(entity);
<textarea rows="10" cols="50" id="entity-reg-converter"></textarea>
<button type="button" id="entity-reg-button">Convert Entity Registry</button>
<script>
var elem = document.getElementById("entity-reg-converter");
elem.addEventListener("click", function() {
elem.focus();
elem.select();
});
document.getElementById("entity-reg-button").addEventListener("click", function() {
try {
data = JSON.parse(elem.value);
} catch(e) {
alert(e);
}
}
data.data.entities = newEntities;
elem.value = JSON.stringify(data, null, 4);
});
</script>
var entities = data.data.entities;
var newEntities = [];
for (var i = 0; i < entities.length; i++) {
var entity = entities[i];
if (entity.platform != "mqtt") {
newEntities.push(entity);
}
}
data.data.entities = newEntities;
elem.value = JSON.stringify(data, null, 4);
});
</script>
4. Stop Home Assistant - this is necessary for the entity registry changes not to become overriden.
@ -108,8 +108,8 @@ You can repeat these steps for all your nodes, or convert them over to the new n
.. code-block:: yaml
# Example configuration entry
api:
# Example configuration entry
api:
8. In Home Assistant, go to "Configuration" -> "Integrations" - if you've set up the ``discovery:`` component,
you'll already see the ESP as a suggestion to be configured. But if you're having issues with that, you can

View File

@ -264,24 +264,24 @@ presses.
.. code-block:: yaml
on_multi_click:
- timing:
- ON for at most 1s
- OFF for at most 1s
- ON for at most 1s
- OFF for at least 0.2s
then:
- logger.log: "Double Clicked"
- timing:
- ON for 1s to 2s
- OFF for at least 0.5s
then:
- logger.log: "Single Long Clicked"
- timing:
- ON for at most 1s
- OFF for at least 0.5s
then:
- logger.log: "Single Short Clicked"
on_multi_click:
- timing:
- ON for at most 1s
- OFF for at most 1s
- ON for at most 1s
- OFF for at least 0.2s
then:
- logger.log: "Double Clicked"
- timing:
- ON for 1s to 2s
- OFF for at least 0.5s
then:
- logger.log: "Single Long Clicked"
- timing:
- ON for at most 1s
- OFF for at least 0.5s
then:
- logger.log: "Single Short Clicked"
.. _binary_sensor-is_on_condition:
.. _binary_sensor-is_off_condition:

View File

@ -243,7 +243,8 @@ As you can see, when you call ``printf`` most of the string is printed as-is, bu
stuff after it is encountered, it is magically replaced by the argument after the format (here ``id(my_sensor).state``).
Every time you type a percent sign ``%`` in a printf format string, it will treat the following letters as a format tag
until a so-called "specifier" is encountered (in this case ``f``). You can read more about it `here <https://www.tutorialspoint.com/c_standard_library/c_function_printf.htm>`__,
until a so-called "specifier" is encountered (in this case ``f``). You can read more about it
`here <https://www.tutorialspoint.com/c_standard_library/c_function_printf.htm>`__,
but for ESPHome there are really just a few things you need to know.
Let's break ``%.1f`` down:

View File

@ -10,7 +10,8 @@ Character-Based LCD Display
PCF8574
-------
The ``lcd_pcf8574`` display platform allows you to use standard character-based LCD displays like `this one <https://docs.labs.mediatek.com/resource/linkit7697-arduino/en/tutorial/driving-1602-lcd-with-pcf8574-pcf8574a>`__
The ``lcd_pcf8574`` display platform allows you to use standard character-based LCD displays like
`this one <https://docs.labs.mediatek.com/resource/linkit7697-arduino/en/tutorial/driving-1602-lcd-with-pcf8574-pcf8574a>`__
with ESPHome. This integration is only for LCD displays that display individual characters on a screen (usually 16-20 columns
and 2-4 rows), and not for LCD displays that can control each pixel individually.

View File

@ -5,7 +5,8 @@ MAX7219 7-Segment Display
:description: Instructions for setting up MAX7219 7-segment displays.
:image: max7219.jpg
The ``max7219`` display platform allows you to use MAX7219 7-segment display drivers (`datasheet <https://datasheets.maximintegrated.com/en/ds/MAX7219-MAX7221.pdf>`__,
The ``max7219`` display platform allows you to use MAX7219 7-segment display drivers (
`datasheet <https://datasheets.maximintegrated.com/en/ds/MAX7219-MAX7221.pdf>`__,
`hobbycomponents <https://hobbycomponents.com/displays/597-max7219-8-digit-seven-segment-display-module>`__)
with ESPHome. Please note that this integration is *only* for 7-segment display, not matrix configurations.

View File

@ -11,8 +11,10 @@ Over I²C
--------
The ``ssd1306_i2c`` display platform allows you to use
SSD1306 (`datasheet <https://cdn-shop.adafruit.com/datasheets/SSD1306.pdf>`__, `Adafruit <https://www.adafruit.com/product/326>`__)
and SH1106 (`datasheet <https://www.elecrow.com/download/SH1106%20datasheet.pdf>`__, `electrodragon <https://www.electrodragon.com/product/1-3-12864-blue-oled-display-iicspi/>`__)
SSD1306 (`datasheet <https://cdn-shop.adafruit.com/datasheets/SSD1306.pdf>`__,
`Adafruit <https://www.adafruit.com/product/326>`__)
and SH1106 (`datasheet <https://www.elecrow.com/download/SH1106%20datasheet.pdf>`__,
`electrodragon <https://www.electrodragon.com/product/1-3-12864-blue-oled-display-iicspi/>`__)
displays with ESPHome. Note that this component is for displays that are connected via the :ref:`I²C Bus <i2c>`.
If your SSD1306 or SH1106 is connected via the 4-Wire :ref:`SPI bus <spi>`, see :ref:`ssd1306-spi`.
@ -78,7 +80,8 @@ Over SPI
The ``ssd1306_spi`` display platform allows you to use
SSD1306 (`datasheet <https://cdn-shop.adafruit.com/datasheets/SSD1306.pdf>`__, `Adafruit <https://www.adafruit.com/product/326>`__)
and SH1106 (`datasheet <https://www.elecrow.com/download/SH1106%20datasheet.pdf>`__, `electrodragon <https://www.electrodragon.com/product/1-3-12864-blue-oled-display-iicspi/>`__)
and SH1106 (`datasheet <https://www.elecrow.com/download/SH1106%20datasheet.pdf>`__,
`electrodragon <https://www.electrodragon.com/product/1-3-12864-blue-oled-display-iicspi/>`__)
displays with ESPHome. Note that this component is for displays that are connected via the 4-Wire :ref:`SPI bus <spi>`.
If your SSD1306 or SH1106 is connected via the :ref:`I²C Bus <i2c>`, see :ref:`ssd1306-i2c`.

View File

@ -36,12 +36,12 @@ Configuration variables:
.. note::
Please be aware that ESP8266 modules must be reset after a serial
upload before OTA can work.
When you are trying to conduct an OTA update and receive an error message
``Bad Answer: ERR: ERROR[11]: Invalid bootstrapping`` the reason is
very likely that power-cycling the ESP module is required once after
the serial upload.
Please be aware that ESP8266 modules must be reset after a serial
upload before OTA can work.
When you are trying to conduct an OTA update and receive an error message
``Bad Answer: ERR: ERROR[11]: Invalid bootstrapping`` the reason is
very likely that power-cycling the ESP module is required once after
the serial upload.
Updating the password:
----------------------

View File

@ -124,21 +124,21 @@ complete configuration for a Sonoff B1 looks like:
.. note::
One of the features of the MY9231/MY9291 driver is that the chips
remember their state after a power cycling. Unfortunately, the
state of the driver can not be read. Therefore, if ESPHome can
not restore the previous state, it will result in a mismatch of
the driver output and the internal state (= MQTT state). So you
can configure the behaviour on boot time:
One of the features of the MY9231/MY9291 driver is that the chips
remember their state after a power cycling. Unfortunately, the
state of the driver can not be read. Therefore, if ESPHome can
not restore the previous state, it will result in a mismatch of
the driver output and the internal state (= MQTT state). So you
can configure the behaviour on boot time:
``update_on_boot: True``
On device power up/boot, the light may flash shortly, to the
state before powering off.
``update_on_boot: True``
On device power up/boot, the light may flash shortly, to the
state before powering off.
``update_on_boot: False``
On device power up/boot, the light show the last state, but the
internal data will not reflect this state. Thus, the first fade
is wrong, as well as the MQTT state.
``update_on_boot: False``
On device power up/boot, the light show the last state, but the
internal data will not reflect this state. Thus, the first fade
is wrong, as well as the MQTT state.
.. _my9231-output:

View File

@ -2,7 +2,8 @@ Dallas Temperature Sensor
=========================
.. seo::
:description: Instructions for setting up dallas temperature sensor hubs that can expose many temperature sensors on a single pin using the one wire protocol.
:description: Instructions for setting up dallas temperature sensor hubs that can
expose many temperature sensors on a single pin using the one wire protocol.
:image: dallas.jpg
:keywords: Dallas, ds18b20, onewire
@ -148,7 +149,8 @@ See Also
- :ref:`sensor-filters`
- :doc:`max6675`
- `Arduino DallasTemperature library <https://github.com/milesburton/Arduino-Temperature-Control-Library>`__ by `Miles Burton <https://github.com/milesburton>`__
- `Arduino DallasTemperature library <https://github.com/milesburton/Arduino-Temperature-Control-Library>`__
by `Miles Burton <https://github.com/milesburton>`__
- :apiref:`sensor/dallas_component.h`
- :ghedit:`Edit`

View File

@ -71,9 +71,9 @@ Configuration variables:
.. note::
If you're seeing lots of invalid temperature/humidity warnings in the logs, try manually setting the
DHT model with the ``model:`` configuration variable. Other problems could be wrong pull-up resistor values
on the DATA pin or too long cables.
If you're seeing lots of invalid temperature/humidity warnings in the logs, try manually setting the
DHT model with the ``model:`` configuration variable. Other problems could be wrong pull-up resistor values
on the DATA pin or too long cables.
See Also
--------

View File

@ -7,8 +7,7 @@ HTU21D Temperature+Humidity Sensor
:keywords: HTU21D
The HTU21D Temperature+Humidity sensor allows you to use your HTU21D
(`datasheet <https://www.te.com/commerce/DocumentDelivery/DDEController?Action=showdoc&DocId=Data+Sheet%7FHPC199_6%7FA6%7Fpdf%7FEnglish%7FENG_DS_HPC199_6_A6.pdf%7FCAT-HSC0004>`__,
`adafruit <https://www.adafruit.com/product/1899>`__) sensors with
(`adafruit <https://www.adafruit.com/product/1899>`__) sensors with
ESPHome. The :ref:`I²C Bus <i2c>` is
required to be set up in your configuration for this sensor to work.

View File

@ -7,8 +7,7 @@ MS5611 Atmospheric Pressure Sensor
:keywords: MS5611
The ``ms5611`` sensor platform allows you to use your MS5611 atmospheric pressure sensors
(`datasheet <https://www.te.com/commerce/DocumentDelivery/DDEController?Action=showdoc&DocId=Data+Sheet%7FMS5611-01BA03%7FB3%7Fpdf%7FEnglish%7FENG_DS_MS5611-01BA03_B3.pdf%7FCAT-BLPS0036>`__,
`hobbytronics`_) temperature and pressure sensors with ESPHome. The :ref:`I²C <i2c>` is
(`hobbytronics`_) temperature and pressure sensors with ESPHome. The :ref:`I²C <i2c>` is
required to be set up in your configuration for this sensor to work.
.. figure:: images/ms5611-full.jpg

View File

@ -91,7 +91,8 @@ See Also
- :doc:`/components/sensor/xiaomi_miflora`
- :doc:`/components/sensor/index`
- :apiref:`esp32_ble_tracker.h`
- `Xiaomi Mijia BLE protocol <https://github.com/mspider65/Xiaomi-Mijia-Bluetooth-Temperature-and-Humidity-Sensor>`__ by `@mspider65 <https://github.com/mspider65>`__
- `Xiaomi Mijia BLE protocol <https://github.com/mspider65/Xiaomi-Mijia-Bluetooth-Temperature-and-Humidity-Sensor>`__
by `@mspider65 <https://github.com/mspider65>`__
- `OpenMQTTGateway <https://github.com/1technophile/OpenMQTTGateway>`__ by `@1technophile <https://github.com/1technophile>`__
- :ghedit:`Edit`

View File

@ -215,14 +215,17 @@ Configuration variables:
Must be a string of 0s and 1s. For example ``'11001``.
- **device** (**Required**, string): The device within the group, usually the state of the last 5 DIP switches.
Must be a string of 0s and 1s. For example ``'01000``.
- **state** (**Required**, boolean): Whether to send a "turn on" or "turn off" signal when this switch is triggered. See :ref:`remote_transmitter-on_off_template`.
- **state** (**Required**, boolean): Whether to send a "turn on" or "turn off" signal when this switch
is triggered. See :ref:`remote_transmitter-on_off_template`.
- **protocol** (*Optional*, :ref:`RCSwitch protocol <rc_switch-protocol>`): The RCSwitch protocol to use. Defaults to ``1``.
- **rc_switch_type_b**: Send an RCSwitch `type B code <https://github.com/sui77/rc-switch/wiki/HowTo_OperateLowCostOutlets#type-b-two-rotarysliding-switches>`__.
- **rc_switch_type_b**: Send an RCSwitch
`type B code <https://github.com/sui77/rc-switch/wiki/HowTo_OperateLowCostOutlets#type-b-two-rotarysliding-switches>`__.
- **address** (**Required**, int): The number of the first rotary switch. For example ``4``.
- **channel** (**Required**, int): The number of the first rotary switch. For example ``2``.
- **state** (**Required**, boolean): Whether to send a "turn on" or "turn off" signal when this switch is triggered. See :ref:`remote_transmitter-on_off_template`.
- **state** (**Required**, boolean): Whether to send a "turn on" or "turn off" signal when this switch
is triggered. See :ref:`remote_transmitter-on_off_template`.
- **protocol** (*Optional*, :ref:`RCSwitch protocol <rc_switch-protocol>`): The RCSwitch protocol to use. Defaults to ``1``.
- **rc_switch_type_c**: Send an RCSwitch `type C code <https://github.com/sui77/rc-switch/wiki/HowTo_OperateLowCostOutlets#type-c-intertechno>`__.
@ -230,14 +233,16 @@ Configuration variables:
- **family** (**Required**, string): The family of the device. Must be a character from ``a`` to ``p``.
- **group** (**Required**, int): The group of the device. For example ``4``.
- **address** (**Required**, int): The address of the device. For example ``2``.
- **state** (**Required**, boolean): Whether to send a "turn on" or "turn off" signal when this switch is triggered. See :ref:`remote_transmitter-on_off_template`.
- **state** (**Required**, boolean): Whether to send a "turn on" or "turn off" signal when this switch
is triggered. See :ref:`remote_transmitter-on_off_template`.
- **protocol** (*Optional*, :ref:`RCSwitch protocol <rc_switch-protocol>`): The RCSwitch protocol to use. Defaults to ``1``.
- **rc_switch_type_d**: Send an RCSwitch type D code.
- **group** (**Required**, string): The group of the device. Must be a character from ``a`` to ``d``.
- **device** (**Required**, int): The address of the device. For example ``3``.
- **state** (**Required**, boolean): Whether to send a "turn on" or "turn off" signal when this switch is triggered. See :ref:`remote_transmitter-on_off_template`.
- **state** (**Required**, boolean): Whether to send a "turn on" or "turn off" signal when this switch
is triggered. See :ref:`remote_transmitter-on_off_template`.
- **protocol** (*Optional*, :ref:`RCSwitch protocol <rc_switch-protocol>`): The RCSwitch protocol to use. Defaults to ``1``.
- **rc5**: Send a RC5 IR code.

View File

@ -51,7 +51,9 @@ Configuration variables:
- **id** (*Optional*, :ref:`config-id`): Specify the ID of the time for use in lambdas.
- **timezone** (*Optional*, string): Manually tell ESPHome what timezone to use with `this format
<https://www.gnu.org/software/libc/manual/html_node/TZ-Variable.html>`__ (warning: the format is quite complicated) or the simpler `TZ database name <https://en.wikipedia.org/wiki/List_of_tz_database_time_zones>`__ in the form <Region>/<City>.
<https://www.gnu.org/software/libc/manual/html_node/TZ-Variable.html>`__ (warning: the
format is quite complicated) or the simpler `TZ database name <https://en.wikipedia.org/wiki/List_of_tz_database_time_zones>`__
in the form <Region>/<City>.
ESPHome tries to automatically infer the timezone string based on the timezone of the computer that is running
ESPHome, 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.

View File

@ -8,7 +8,8 @@ BME280 Environment
The :doc:`/components/sensor/bme280` is a simple temperature, humidity, and pressure sensor with communication over I2C.
With some simple math it is possible to either determine the height of the sensor, or the current pressure at sea level.
This guide can be applied to any sensor measuring temperature and pressure at the same time, like the :doc:`/components/sensor/bmp280`, or :doc:`/components/sensor/bme680`.
This guide can be applied to any sensor measuring temperature and pressure at the same time, like the
:doc:`/components/sensor/bmp280`, or :doc:`/components/sensor/bme680`.
.. figure:: images/bme280-header.jpg
:align: center
@ -36,30 +37,38 @@ After validating the sensor is working, we can proceed and add some formulas.
name: "Altitude"
lambda: |-
const float STANDARD_SEA_LEVEL_PRESSURE = 1013.25; //in hPa, see note
return ((id(bme280_temperature).state + 273.15) / 0.0065) * (powf((STANDARD_SEA_LEVEL_PRESSURE / id(bme280_pressure).state), 0.190234) - 1); // in meter
return ((id(bme280_temperature).state + 273.15) / 0.0065) *
(powf((STANDARD_SEA_LEVEL_PRESSURE / id(bme280_pressure).state), 0.190234) - 1); // in meter
update_interval: 15s
- platform: template
name: "Absolute Humidity"
lambda: |-
const float mw = 18.01534; // molar mass of water g/mol
const float r = 8.31447215; // Universal gas constant J/mol/K
return (6.112 * powf(2.718281828, (17.67 * id(bme280_temperature).state) / (id(bme280_temperature).state + 243.5)) * id(bme280_humidity).state * mw) / ((273.15 + id(bme280_temperature).state) * r); // in grams/m^3
return (6.112 * powf(2.718281828, (17.67 * id(bme280_temperature).state) /
(id(bme280_temperature).state + 243.5)) * id(bme280_humidity).state * mw) /
((273.15 + id(bme280_temperature).state) * r); // in grams/m^3
update_interval: 15s
Altitude and absolute humidity:
-------------------------------
The first block ``sensor`` starts with the normal bme280 sensor components ``temperature``, ``pressure``, and ``humidity`` with each their own id.
The first block ``sensor`` starts with the normal bme280 sensor components ``temperature``, ``pressure``,
and ``humidity`` with each their own id.
After the bme280 sensor, a :doc:`/components/sensor/template` is defined to calculate the altitude in a lambda.
The variable ``STANDARD_SEA_LEVEL_PRESSURE`` (in hPa), should be filled in for your location.
The formula derived from `here <https://github.com/finitespace/BME280/blob/master/src/EnvironmentCalculations.cpp>`, converts the currently measured pressure to the altitudes in meters including temperature compensation.
The formula derived from `here <https://github.com/finitespace/BME280/blob/master/src/EnvironmentCalculations.cpp>`__,
converts the currently measured pressure to the altitudes in meters including temperature compensation.
The lambda in the second :doc:`/components/sensor/template` defines two physical constants and converts the currently measured pressure to absolute humidity (grams/m^3).
The lambda in the second :doc:`/components/sensor/template` defines two physical constants and
converts the currently measured pressure to absolute humidity (grams/m^3).
.. note::
Calculating the altitude with the BME280 sensor accurately requires this value to be known at sea level for your location and day.
This can be achieved by replacing the global constant ``STANDARD_SEA_LEVEL_PRESSURE`` by for example pulling this value live from the internet or a stationary sensor via MQTT.
This can be achieved by replacing the global constant ``STANDARD_SEA_LEVEL_PRESSURE`` by for example
pulling this value live from the internet or a stationary sensor via MQTT.
Equivalent sea level pressure:
------------------------------
@ -85,7 +94,8 @@ Calculating the sea level pressure with a statically mounted sensor can be be us
name: "Equivalent sea level pressure"
lambda: |-
const float STANDARD_ALTITUDE = 0.6; // in meters, see note
return id(bme280_pressure).state / powf(1 - ((0.0065 * STANDARD_ALTITUDE) / (id(bme280_temperature).state + (0.0065 * STANDARD_ALTITUDE) + 273.15)), 5.257); // in hPa
return id(bme280_pressure).state / powf(1 - ((0.0065 * STANDARD_ALTITUDE) /
(id(bme280_temperature).state + (0.0065 * STANDARD_ALTITUDE) + 273.15)), 5.257); // in hPa
update_interval: 15s
.. note::

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

View File

@ -10,7 +10,8 @@ Time & Temperature on OLED Display
:align: left
:width: 75.0%
In this example I have used a :doc:`SSD1306 OLED Display over I²C </components/display/ssd1306>` to show current time and two different temperature values from Home Assistant.
In this example I have used a :doc:`SSD1306 OLED Display over I²C </components/display/ssd1306>` to
show current time and two different temperature values from Home Assistant.
ESPHome has support for several different types of displays. The display used here is 1.3" with 128x64 monochrome pixels (``SH1106 128x64``).
@ -45,7 +46,7 @@ Get the time from Home Assistant to sync the onboard real-time-clock.
Getting Temperature
*******************
Next, we want to get two temperature sensors imported from Home Assistant.
Next, we want to get two temperature sensors imported from Home Assistant.
I named them ``inside_temperature`` and ``outside_temperature``. You will use those references later.
@ -56,7 +57,7 @@ By adding ``internal: true`` to the sensors they won't be published back to Home
sensor:
- platform: homeassistant
id: inside_temperature
entity_id: sensor.mellanvaning_temperature
entity_id: sensor.mellanvaning_temperature
internal: true
- platform: homeassistant
@ -68,8 +69,8 @@ Define the Fonts
****************
- TrueType fonts are used. If you ever worked with fonts on microcontrollers you will love this!
- Save font files in ``/config/esphome`` folder where your esphome configuration is stored.
- The ``.ttf`` suffix must be lowercase and of course match your filename.
- Save font files in ``/config/esphome`` folder where your esphome configuration is stored.
- The ``.ttf`` suffix must be lowercase and of course match your filename.
- Selection of fonts can be a little bit tricky for small sizes to look good. Experiment and share your findings in the comments below!
.. code-block:: yaml
@ -90,7 +91,7 @@ Define the Fonts
Display Definition
******************
Now setup the communication to the display and start fill the screen with live data!
Now setup the communication to the display and start fill the screen with live data!
The ``reset_pin`` was not used in my hardware configuration as the display didn't had that pin exposed.
@ -113,16 +114,16 @@ Note your ``address`` and ``model`` might be different, use the scan option to f
it.printf(64, 0, id(font1), TextAlign::TOP_CENTER, "Mitt Smarta Hus");
// Print time in HH:MM format
it.strftime(0, 60, id(font2), TextAlign::BASELINE_LEFT, "%H:%M", id(time).now());
it.strftime(0, 60, id(font2), TextAlign::BASELINE_LEFT, "%H:%M", id(time).now());
// Print inside temperature (from homeassistant sensor)
if (id(inside_temperature).has_state()) {
if (id(inside_temperature).has_state()) {
it.printf(127, 23, id(font3), TextAlign::TOP_RIGHT , "%.1f°", id(inside_temperature).state);
}
}
// Print outside temperature (from homeassistant sensor)
if (id(outside_temperature).has_state()) {
it.printf(127, 60, id(font3), TextAlign::BASELINE_RIGHT , "%.1f°", id(outside_temperature).state);
if (id(outside_temperature).has_state()) {
it.printf(127, 60, id(font3), TextAlign::BASELINE_RIGHT , "%.1f°", id(outside_temperature).state);
}
Rendering

View File

@ -30,22 +30,22 @@ for some motors.
.. code-block:: yaml
esphome:
esphome:
name: cover
platform: ESP8266
board: esp01_1m
wifi:
wifi:
ssid: '***'
password: '***'
api:
api:
logger:
logger:
ota:
ota:
binary_sensor:
binary_sensor:
- platform: gpio
pin:
number: 10
@ -73,7 +73,7 @@ for some motors.
}
}
switch:
switch:
- platform: gpio
pin: 12
id: open
@ -81,7 +81,7 @@ for some motors.
pin: 5
id: close
cover:
cover:
- platform: template
name: "Cover"
id: cover

View File

@ -2,7 +2,8 @@ H801 RGBW LED controller
========================
The H801 is pretty afordable and easy to hack and adapt to your needs. It can be found on `Aliexpress <https://s.click.aliexpress.com/e/bbnUDBZW>`__
`Here <http://tinkerman.cat/closer-look-h801-led-wifi-controller/>`__ is an article about the hardware for those who have an interest for more details about the board.
`Here <http://tinkerman.cat/closer-look-h801-led-wifi-controller/>`__ is an article about the
hardware for those who have an interest for more details about the board.
It can be used as a RGB, RGBW, RGB dual white or even control 5 individual monochromatic strips if you want or combinations of these.
.. figure:: images/h801.jpg
@ -21,7 +22,7 @@ and the :doc:`ESP8266 Software PWM output </components/output/esp8266_pwm>` comp
wifi:
ssid: 'WIFI'
password: 'WIFIPASS'
manual_ip:
manual_ip:
static_ip: x.x.x.x
gateway: x.x.x.x
subnet: 255.255.255.0
@ -37,15 +38,15 @@ and the :doc:`ESP8266 Software PWM output </components/output/esp8266_pwm>` comp
- platform: esp8266_pwm
pin: 12
frequency: 1000 Hz
id: pwm_b
id: pwm_b
- platform: esp8266_pwm
pin: 15
frequency: 1000 Hz
id: pwm_g
id: pwm_g
- platform: esp8266_pwm
pin: 13
frequency: 1000 Hz
id: pwm_r
id: pwm_r
- platform: esp8266_pwm
pin: 14
frequency: 1000 Hz
@ -87,10 +88,12 @@ This LED strip can be used with the sketch as-is
For this type of led strip you have to swap the white and blue gpio numbers in the sketch
You will need to solder pins to the board inside the h801 (fortunately its pretty roomy and not a lot of components or stuff in the way part from the 2 wires on the back)
You will need to solder pins to the board inside the h801 (fortunately its pretty roomy and
not a lot of components or stuff in the way part from the 2 wires on the back)
3.3v, GND, TX and RX (RX to RX and TX to TX) needs to be connected to your serial adapter, the two other pins must be shorted by a jumper or a breadboard cable when flashing.
(Remember to remove it after flashing)
3.3v, GND, TX and RX (RX to RX and TX to TX) needs to be connected to your serial adapter, the
two other pins must be shorted by a jumper or a breadboard cable when flashing.
(Remember to remove it after flashing)
See Also
--------

View File

@ -31,7 +31,7 @@ As many of the details on here a predicated on existing installations and knowle
* You have installed the relevant environment and it is functional (Home Assisant, ESPHome).
* You need to create your own secrets.yaml file.
* You are proficient in reading instructions and capable of using a search engine.
* You will look at the documentation on https://esphome.io/ (we may have missed something in this example).
* You will look at the documentation on this website (we may have missed something in this example).
* This serves only as a guide and errors and outlets are excluded.
.. warning::
@ -137,6 +137,7 @@ Here is the configuration with the basic operations outlined above.
2. Programming
**************
Follow the standard way of uploading to your Sonoff basic.
.. figure:: images/sonoff-fishpond-pump-1-programming.jpg

View File

@ -145,7 +145,8 @@ Reset Causes
------------
Additionally, the first line also contains the **reset cause**.
These reset causes `are documented <https://www.espressif.com/sites/default/files/documentation/esp8266_reset_causes_and_common_fatal_exception_causes_en.pdf>`__:
These reset causes `are documented
<https://www.espressif.com/sites/default/files/documentation/esp8266_reset_causes_and_common_fatal_exception_causes_en.pdf>`__:
== ===================================
0 Undefined

View File

@ -116,7 +116,8 @@ See https://randomnerdtutorials.com/how-to-flash-a-custom-firmware-to-sonoff/ fo
* Press and hold the toggle pin (long black pin next to LED and custom soldered pins).
* Supply USB power to Sonoff via FTDI (e.g. plug in USB to the FTDI, or use a power switch as explained in link above).
* Keep holding the toggle pin for approx 3-5 seconds now you should be ready to program. If you get a message unable to communicate when trying flash, check your TX/RX pin or retry entering boot mode again.
* Keep holding the toggle pin for approx 3-5 seconds now you should be ready to program.
If you get a message unable to communicate when trying flash, check your TX/RX pin or retry entering boot mode again.
Quick notes:
@ -140,58 +141,59 @@ You should get an output starting like this
.. code-block:: text
INFO Reading configuration...
INFO Detected timezone 'SAST' with UTC offset 2
INFO Generating C++ source...
INFO Compiling app...
INFO Running: platformio run -d fishpond
********************************************************************************************************
Obsolete PIO Core v3.6.3 is used (previous was 3.6.4b1)
Please remove multiple PIO Cores from a system:
https://docs.platformio.org/page/faq.html#multiple-pio-cores-in-a-system
...
lots of compile stuff
...
Memory Usage -> http://bit.ly/pio-memory-usage
DATA: [====== ] 55.6% (used 45512 bytes from 81920 bytes)
PROGRAM: [==== ] 38.1% (used 390576 bytes from 1023984 bytes)
===================================== [SUCCESS] Took 4.70 seconds =====================================
INFO Successfully compiled program.
Found multiple options, please choose one:
INFO Reading configuration...
INFO Detected timezone 'SAST' with UTC offset 2
INFO Generating C++ source...
INFO Compiling app...
INFO Running: platformio run -d fishpond
********************************************************************************************************
Obsolete PIO Core v3.6.3 is used (previous was 3.6.4b1)
Please remove multiple PIO Cores from a system:
https://docs.platformio.org/page/faq.html#multiple-pio-cores-in-a-system
...
lots of compile stuff
...
Memory Usage -> http://bit.ly/pio-memory-usage
DATA: [====== ] 55.6% (used 45512 bytes from 81920 bytes)
PROGRAM: [==== ] 38.1% (used 390576 bytes from 1023984 bytes)
===================================== [SUCCESS] Took 4.70 seconds =====================================
INFO Successfully compiled program.
Found multiple options, please choose one:
[1] /dev/ttyUSB0 (FT232R USB UART)
[2] Over The Air (fishpond.device)
(number): 1
INFO Running: esptool.py --before default_reset --after hard_reset --chip esp8266 --port /dev/ttyUSB0 write_flash 0x0 fishpond/.pioenvs/fishpond/firmware.bin
esptool.py v2.6
Serial port /dev/ttyUSB0
Connecting....
Chip is ESP8266EX
Features: WiFi
MAC: xx:xx:xx:xx:xx:xx
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Auto-detected Flash size: 1MB
Compressed 394720 bytes to 267991...
Wrote 394720 bytes (267991 compressed) at 0x00000000 in 23.8 seconds (effective 132.7 kbit/s)...
Hash of data verified.
(number): 1
...
esptool.py v2.6
Serial port /dev/ttyUSB0
Connecting....
Chip is ESP8266EX
Features: WiFi
MAC: xx:xx:xx:xx:xx:xx
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Auto-detected Flash size: 1MB
Compressed 394720 bytes to 267991...
Wrote 394720 bytes (267991 compressed) at 0x00000000 in 23.8 seconds (effective 132.7 kbit/s)...
Hash of data verified.
Leaving...
Hard resetting via RTS pin...
INFO Successfully uploaded program.
INFO Starting log output from /dev/ttyUSB0 with baud rate 115200
Leaving...
Hard resetting via RTS pin...
INFO Successfully uploaded program.
INFO Starting log output from /dev/ttyUSB0 with baud rate 115200
1.3. And then nothing will happen
*********************************
Once you have flashed the device, nothing will happen. You need to power cycle the device. You will notice the LED will start to flash and then becomes solid once connected to the WiFi network.
Once you have flashed the device, nothing will happen. You need to power cycle the device.
You will notice the LED will start to flash and then becomes solid once connected to the WiFi network.
You can follow the logs produced by the running module by running the command
.. code-block:: bash
esphome <my-awesome>.yaml logs
esphome <my-awesome>.yaml logs
Your output will possibly look like this

View File

@ -313,8 +313,10 @@ All Triggers
- :ref:`mqtt.on_message <mqtt-on_message>` / :ref:`mqtt.on_json_message <mqtt-on_json_message>`
- :ref:`sensor.on_value <sensor-on_value>` / :ref:`sensor.on_raw_value <sensor-on_raw_value>` / :ref:`sensor.on_value_range <sensor-on_value_range>`
- :ref:`binary_sensor.on_press <binary_sensor-on_press>` / :ref:`binary_sensor.on_release <binary_sensor-on_release>` / :ref:`binary_sensor.on_state <binary_sensor-on_state>`
- :ref:`binary_sensor.on_click <binary_sensor-on_click>` / :ref:`binary_sensor.on_double_click <binary_sensor-on_double_click>` / :ref:`binary_sensor.on_multi_click <binary_sensor-on_multi_click>`
- :ref:`binary_sensor.on_press <binary_sensor-on_press>` / :ref:`binary_sensor.on_release <binary_sensor-on_release>` /
:ref:`binary_sensor.on_state <binary_sensor-on_state>`
- :ref:`binary_sensor.on_click <binary_sensor-on_click>` / :ref:`binary_sensor.on_double_click <binary_sensor-on_double_click>` /
:ref:`binary_sensor.on_multi_click <binary_sensor-on_multi_click>`
- :ref:`esphome.on_boot <esphome-on_boot>` / :ref:`esphome.on_shutdown <esphome-on_shutdown>` / :ref:`esphome.on_loop <esphome-on_loop>`
- :ref:`pn532.on_tag <pn532-on_tag>`
- :ref:`time.on_time <time-on_time>`
@ -363,8 +365,8 @@ time period.
.. code-block:: yaml
on_...:
then:
on_...:
then:
- switch.turn_on: relay_1
- delay: 2s
- switch.turn_off: relay_1

View File

@ -109,11 +109,11 @@ RST primer:
.. code-block:: yaml
# Sample configuration entry
switch:
- platform: gpio
name: "Relay #42"
pin: GPIO13
# Sample configuration entry
switch:
- platform: gpio
name: "Relay #42"
pin: GPIO13
.. note::
@ -130,10 +130,10 @@ RST primer:
Optional figure caption.
.. figure:: images/dashboard.png
:align: center
:width: 40.0%
:align: center
:width: 40.0%
Optional figure caption.
Optional figure caption.
.. note::
@ -149,19 +149,19 @@ RST primer:
.. note::
This is a note.
This is a note.
.. warning::
This is a warning.
This is a warning.
.. note::
This is a note.
This is a note.
.. warning::
This is a warning.
This is a warning.
- **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.
@ -198,7 +198,8 @@ RST primer:
1. Ordered Item #1
2. Ordered Item #2
- **imgtable**: ESPHome uses a custom RST directive to show the table on the front page (see `index.rst <https://github.com/esphome/esphome-docs/blob/current/index.rst>`__).
- **imgtable**: ESPHome uses a custom RST directive to show the table on the front page (see
`index.rst <https://github.com/esphome/esphome-docs/blob/current/index.rst>`__).
New pages need to be added to the ``imgtable`` list. The syntax is CSV with <PAGE NAME>, <FILE NAME> (without RST),
<IMAGE> (in top-level images/ directory). The aspect ratio of these images should be 8:10 (or 10:8) but exceptions are possible.
@ -215,6 +216,7 @@ please have a look at the `Sphinx reStructuredText Primer <http://www.sphinx-doc
Build
*****
.. note::
The easiest way is to use the `esphome-docs docker image <https://hub.docker.com/r/esphome/esphome-docs/>`__:

View File

@ -8,7 +8,8 @@ Frequently Asked Questions
Tips for using ESPHome
----------------------
1. ESPHome supports (most of) `Home Assistant's YAML configuration directives <https://www.home-assistant.io/docs/configuration/splitting_configuration/>`__ like
1. ESPHome supports (most of) `Home Assistant's YAML configuration directives
<https://www.home-assistant.io/docs/configuration/splitting_configuration/>`__ like
``!include``, ``!secret``. So you can store all your secret WiFi passwords and so on
in a file called ``secrets.yaml`` within the directory where the configuration file is.
@ -252,11 +253,12 @@ And a docker compose file looks like this:
ESPHome uses mDNS to show online/offline state in the dashboard view. So for that feature
to work you need to enable host networking mode
mDNS might not work if your Home Assistant server and your ESPHome nodes are on different subnets. If your router supports Avahi, you are able to get mDNS working over different subnets.
mDNS might not work if your Home Assistant server and your ESPHome nodes are on different subnets.
If your router supports Avahi, you are able to get mDNS working over different subnets.
Just follow the next steps:
1. Enable Avahi on both subnets.
2. Enable UDP traffic from ESPHome node's subnet to 224.0.0.251/32 on port 5353.

View File

@ -5,13 +5,22 @@ This is a dummy file to include images in the sphinx output
that will only be used in raw HTML and thus not auto-included.
.. image:: shield-discord.svg
.. image:: shield-github.svg
.. image:: shield-donate.svg
.. image:: shield-twitter.svg
.. image:: logo.svg
.. image:: logo-core.svg
.. image:: logo-docs.svg
.. image:: logo-flasher.svg
.. image:: logo-release.svg
.. image:: logo-text.svg

View File

@ -5,14 +5,17 @@ ESPHome
:google-site-verification: Q5q5TFbCofxA8-cSa1Frv5Hj4RopF5zwEZf_zaNHqf4
.. seo::
:description: ESPHome Homepage - Reimagining DIY Home Automation. ESPHome is a framework that tries to provide the best possible use experience for using ESP8266 and ESP32 microcontrollers for Home Automation. Just write a simple YAML configuration file and get your own customized firmware.
:description: ESPHome Homepage - Reimagining DIY Home Automation. ESPHome is a framework that
tries to provide the best possible use experience for using ESP8266 and ESP32 microcontrollers
for Home Automation. Just write a simple YAML configuration file and get your own customized firmware.
:image: logo.png
.. image:: /images/logo-text.svg
.. raw:: html
<a href="https://github.com/esphome/esphome"><img src="/_images/shield-github.svg" alt="GitHub" style="max-width:100%;height:26px;width:116.1px;margin-top:10px;"></a>
<a href="https://github.com/esphome/esphome"><img src="/_images/shield-github.svg" alt="GitHub"
style="max-width:100%;height:26px;width:116.1px;margin-top:10px;"></a>
<a href="https://discord.gg/KhAMKrd"><img src="/_images/shield-discord.svg" alt="Discord" style="max-width:100%;height:26px;width:126.3px;"></a>
<a href="https://twitter.com/esphome_"><img src="/_images/shield-twitter.svg" alt="Twitter" style="max-width:100%;height:26px;width:122.1px;"></a>
<a href="/guides/faq.html#donations"><img src="/_images/shield-donate.svg" alt="Donate" style="max-width:100%;height:26px;width:110.6px;"></a>

2
seo.py
View File

@ -10,7 +10,7 @@ class SEONode(nodes.General, nodes.Element):
author=None, author_twitter=None, keywords=None):
super(SEONode, self).__init__()
self.title = title
self.description = description
self.description = description.replace('\n', ' ')
self.image = image
self.author = author
self.author_twitter = author_twitter

View File

@ -6,7 +6,7 @@ errors = []
def find_all(a_str, sub):
for i, line in enumerate(a_str.splitlines(keepends=False)):
for i, line in enumerate(a_str.splitlines()):
column = 0
while True:
column = line.find(sub, column)
@ -17,6 +17,9 @@ def find_all(a_str, sub):
section_regex = re.compile(r'^(=+|-+|\*+|~+)$')
directive_regex = re.compile(r'^(\s*)\.\. (.*)::.*$')
directive_arg_regex = re.compile(r'^(\s+):.*:\s*.*$')
esphome_io_regex = re.compile(r'https://esphome.io/')
for f in sorted(Path('.').glob('**/*.rst')):
@ -25,14 +28,29 @@ for f in sorted(Path('.').glob('**/*.rst')):
except UnicodeDecodeError:
errors.append("File {} is not readable as UTF-8. Please set your editor to UTF-8 mode."
"".format(f))
continue
if not content.endswith('\n'):
errors.append("Newline at end of file missing. Please insert an empty line at end "
"of file {}".format(f))
# Check tab character
for line, col in find_all(content, '\t'):
errors.append("File {} contains tab character on line {}:{}. "
"Please convert tabs to spaces.".format(f, line, col))
"Please convert tabs to spaces.".format(f, line + 1, col))
# Check windows newline
for line, col in find_all(content, '\r'):
errors.append("File {} contains windows newline on line {}:{}. "
"Please set your editor to unix newline mode.".format(f, line, col))
"Please set your editor to unix newline mode.".format(f, line + 1, col))
lines = content.splitlines(keepends=False)
# Check whitespace at end of line
for i, line in enumerate(lines):
if line.rstrip() != line:
errors.append("Lines must not contain spaces at the end of the line. Please "
"remove spaces at the end of {}:{}".format(f, i+1))
for i, line in enumerate(lines):
if i == 0:
continue
@ -42,7 +60,63 @@ for f in sorted(Path('.').glob('**/*.rst')):
line_above = lines[i - 1]
if len(line_above) != len(line):
errors.append("The title length must match the bar length below it. See {}:{}"
"".format(f, i))
"".format(f, i+1))
if i + 1 < len(lines) and lines[i + 1]:
errors.append("Empty line after heading is missing. Please insert an "
"empty line. See {}:{}".format(f, i+1))
for i, line in enumerate(lines):
m = directive_regex.match(line)
if m is None:
continue
base_indentation = len(m.group(1))
directive_name = m.group(2)
if directive_name.startswith('|') or directive_name == 'seo':
continue
# Match directive args
for j in range(i + 1, len(lines)):
if not directive_arg_regex.match(lines[j]):
break
else:
# Reached end of file
continue
# Empty line must follow
if lines[j]:
errors.append("Directive '{}' is not followed by an empty line. Please insert an "
"empty line after {}:{}".format(directive_name, f, j))
continue
k = j + 1
for j in range(k, len(lines)):
if not lines[j]:
# Ignore Empty lines
continue
num_spaces = len(lines[j]) - len(lines[j].lstrip())
if num_spaces <= base_indentation:
# Finished with this directive
break
num_indent = num_spaces - base_indentation
if j == k and num_indent != 4:
errors.append("Directive '{}' must be indented with 4 spaces, not {}. See "
"{}:{}".format(directive_name, num_indent, f, j+1))
break
# Check line length
for i, line in enumerate(lines):
max_line_length = 160
if len(line) > max_line_length:
errors.append("Lines must not be longer than {} characters. Line {}:{} is {} "
"characters long. Please insert newlines."
"".format(max_line_length, f, i+1, len(line)))
for i, line in enumerate(lines):
if esphome_io_regex.search(line):
if 'privacy.rst' in str(f) or 'web_server.rst' in str(f):
continue
errors.append("All links to esphome.io should be relative, please remove esphome.io "
"from URL. See {}:{}".format(f, i+1))
for error in errors:

View File

@ -182,7 +182,7 @@ Fan
***
Fans are similar to switches as they can be turned on/off and toggled. In addition, if the
underlying fan supports it, fans in the web server also support the speed settings "low",
underlying fan supports it, fans in the web server also support the speed settings "low",
"medium" and "high" and an oscillation setting. To get the current state of a fan, create a
GET request to ``/fan/<id>``.