Update docs

This commit is contained in:
Otto Winter 2019-01-06 18:56:14 +01:00
parent aad3f5a133
commit 324891206e
No known key found for this signature in database
GPG Key ID: DB66C0BE6013F97E
79 changed files with 1066 additions and 569 deletions

17
Doxygen
View File

@ -213,7 +213,7 @@ MULTILINE_CPP_IS_BRIEF = NO
# documentation from any documented member that it re-implements.
# The default value is: YES.
INHERIT_DOCS = YES
INHERIT_DOCS = NO
# If the SEPARATE_MEMBER_PAGES tag is set to YES then doxygen will produce a new
# page for each member. If set to NO, the documentation of a member will be part
@ -329,7 +329,7 @@ AUTOLINK_SUPPORT = YES
# diagrams that involve STL classes more complete and accurate.
# The default value is: NO.
BUILTIN_STL_SUPPORT = NO
BUILTIN_STL_SUPPORT = YES
# If you use Microsoft's C++/CLI language, you should set this option to YES to
# enable parsing support.
@ -502,7 +502,7 @@ HIDE_UNDOC_CLASSES = NO
# included in the documentation.
# The default value is: NO.
HIDE_FRIEND_COMPOUNDS = NO
HIDE_FRIEND_COMPOUNDS = YES
# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any
# documentation blocks found inside the body of a function. If set to NO, these
@ -624,26 +624,26 @@ STRICT_PROTO_MATCHING = NO
# list. This list is created by putting \todo commands in the documentation.
# The default value is: YES.
GENERATE_TODOLIST = YES
GENERATE_TODOLIST = NO
# The GENERATE_TESTLIST tag can be used to enable (YES) or disable (NO) the test
# list. This list is created by putting \test commands in the documentation.
# The default value is: YES.
GENERATE_TESTLIST = YES
GENERATE_TESTLIST = NO
# The GENERATE_BUGLIST tag can be used to enable (YES) or disable (NO) the bug
# list. This list is created by putting \bug commands in the documentation.
# The default value is: YES.
GENERATE_BUGLIST = YES
GENERATE_BUGLIST = NO
# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or disable (NO)
# the deprecated list. This list is created by putting \deprecated commands in
# the documentation.
# The default value is: YES.
GENERATE_DEPRECATEDLIST= YES
GENERATE_DEPRECATEDLIST= NO
# The ENABLED_SECTIONS tag can be used to enable conditional documentation
# sections, marked by \if <section_label> ... \endif and \cond <section_label>
@ -821,6 +821,7 @@ FILE_PATTERNS = *.c \
*.cxx \
*.cpp \
*.c++ \
*.tcc \
*.java \
*.ii \
*.ixx \
@ -921,7 +922,7 @@ EXAMPLE_PATTERNS = *.cpp
# irrespective of the value of the RECURSIVE tag.
# The default value is: NO.
EXAMPLE_RECURSIVE = NO
EXAMPLE_RECURSIVE = YES
# The IMAGE_PATH tag can be used to specify one or more files or directories
# that contain images that are to be included in the documentation (see the

View File

@ -11,6 +11,11 @@ helpers.h
.. doxygenfile:: esphomelib/helpers.h
util.h
******
.. doxygenfile:: esphomelib/uil.h
optional.h
**********

View File

@ -20,3 +20,4 @@ Core
Time <time>
SPI Bus <spi>
UART Bus <uart>
Native API for Home Assistant <native-api>

19
api/core/native-api.rst Normal file
View File

@ -0,0 +1,19 @@
Native API
==========
See :cpp:func:`Application::init_api_server`.
API Reference
-------------
.. cpp:namespace:: nullptr
.. doxygenfile:: esphomelib/api/api_message.h
.. doxygenfile:: esphomelib/api/api_server.h
.. doxygenfile:: esphomelib/api/basic_messages.h
.. doxygenfile:: esphomelib/api/command_messages.h
.. doxygenfile:: esphomelib/api/list_entities.h
.. doxygenfile:: esphomelib/api/service_call_message.h
.. doxygenfile:: esphomelib/api/subscribe_logs.h
.. doxygenfile:: esphomelib/api/subscribe_state.h
.. doxygenfile:: esphomelib/api/util.h

View File

@ -4,24 +4,6 @@ Time
API Reference
-------------
.. cpp:namespace:: nullptr
.. doxygenclass:: time::RealTimeClockComponent
:members:
:protected-members:
:undoc-members:
.. doxygenstruct:: time::EsphomelibTime
:members:
:protected-members:
:undoc-members:
.. doxygenclass:: time::SNTPComponent
:members:
:protected-members:
:undoc-members:
.. doxygenclass:: time::CronTrigger
:members:
:protected-members:
:undoc-members:
.. doxygenfile:: esphomelib/time/rtc_component.h
.. doxygenfile:: esphomelib/time/sntp_component.h
.. doxygenfile:: esphomelib/time/homeassistant_time.h

View File

@ -6,17 +6,7 @@ Example Usage
.. code-block:: cpp
// Basic
App.init_wifi("YOUR_SSID", "YOUR_PASSWORD");
// Manual IP
auto *wifi = App.init_wifi("YOUR_SSID", "YOUR_PASSWORD");
wifi->set_sta_manual_ip(ManualIP{
.static_ip = IPAddress(192, 168, 178, 42),
.gateway = IPAddress(192, 168, 178, 1),
.subnet = IPAddress(255, 255, 255, 0)
});
// AP
wifi->set_ap("AP SSID", "Optional AP Password");
API Reference
-------------
@ -26,12 +16,5 @@ API Reference
WiFiComponent
*************
.. doxygenclass:: WiFiComponent
:members:
:protected-members:
:undoc-members:
.. doxygenstruct:: ManualIP
:members:
:protected-members:
:undoc-members:
.. doxygenfile:: esphomelib/wifi_component.h
.. doxygenfile:: esphomelib/ethernet_component.h

12
api/light/addressable.rst Normal file
View File

@ -0,0 +1,12 @@
Addressable Lights
==================
API Reference
-------------
.. doxygenfile:: esphomelib/light/addressable_light.h
Addressable Light Effects
*************************
.. doxygenfile:: esphomelib/light/addressable_light_effect.h

View File

@ -21,12 +21,4 @@ See :cpp:func:`Application::make_fast_led_light`.
API Reference
-------------
.. cpp:namespace:: nullptr
FastLEDLightOutputComponent
***************************
.. doxygenclass:: light::FastLEDLightOutputComponent
:members:
:protected-members:
:undoc-members:
.. doxygenfile:: esphomelib/light/fast_led_light_output.h

View File

@ -38,189 +38,35 @@ API Reference
LightColorValues
****************
.. doxygenclass:: light::LightColorValues
:members:
:protected-members:
:undoc-members:
.. doxygenfile:: esphomelib/light/light_color_values.h
LightEffect
***********
.. doxygenclass:: light::LightEffect
:members:
:protected-members:
:undoc-members:
.. doxygenclass:: light::RandomLightEffect
:members:
:protected-members:
:undoc-members:
.. doxygenstruct:: light::StrobeLightEffectColor
:members:
:protected-members:
:undoc-members:
.. doxygenclass:: light::StrobeLightEffect
:members:
:protected-members:
:undoc-members:
.. doxygenclass:: light::FlickerLightEffect
:members:
:protected-members:
:undoc-members:
.. doxygenclass:: light::LambdaLightEffect
:members:
:protected-members:
:undoc-members:
.. doxygenclass:: light::BaseFastLEDLightEffect
:members:
:protected-members:
:undoc-members:
.. doxygenclass:: light::FastLEDLambdaLightEffect
:members:
:protected-members:
:undoc-members:
.. doxygenclass:: light::FastLEDRainbowLightEffect
:members:
:protected-members:
:undoc-members:
.. doxygenstruct:: light::FastLEDColorWipeEffectColor
:members:
:protected-members:
:undoc-members:
.. doxygenclass:: light::FastLEDColorWipeEffect
:members:
:protected-members:
:undoc-members:
.. doxygenclass:: light::FastLEDScanEffect
:members:
:protected-members:
:undoc-members:
.. doxygenclass:: light::FastLEDTwinkleEffect
:members:
:protected-members:
:undoc-members:
.. doxygenclass:: light::FastLEDRandomTwinkleEffect
:members:
:protected-members:
:undoc-members:
.. doxygenclass:: light::FastLEDFireworksEffect
:members:
:protected-members:
:undoc-members:
.. doxygenclass:: light::FastLEDFlickerEffect
:members:
:protected-members:
:undoc-members:
.. doxygenfile:: esphomelib/light/light_effect.h
LightOutput
***********
.. doxygenclass:: light::LightOutput
:members:
:protected-members:
:undoc-members:
.. doxygenclass:: light::BinaryLightOutput
:members:
:protected-members:
:undoc-members:
.. doxygenclass:: light::MonochromaticLightOutput
:members:
:protected-members:
:undoc-members:
.. doxygenclass:: light::CWWWLightOutput
:members:
:protected-members:
:undoc-members:
.. doxygenclass:: light::RGBLightOutput
:members:
:protected-members:
:undoc-members:
.. doxygenclass:: light::RGBWLightOutput
:members:
:protected-members:
:undoc-members:
.. doxygenclass:: light::RGBWWLightOutput
:members:
:protected-members:
:undoc-members:
.. doxygenfile:: esphomelib/light/light_output.h
LightState
**********
.. doxygenclass:: light::LightState
:members:
:protected-members:
:undoc-members:
.. doxygenfile:: esphomelib/light/light_state.h
LightTraits
***********
.. doxygenclass:: light::LightTraits
:members:
:protected-members:
:undoc-members:
.. doxygenfile:: esphomelib/light/light_traits.h
LightTransformer
****************
.. doxygenclass:: light::LightTransformer
:members:
:protected-members:
:undoc-members:
.. doxygenclass:: light::LightTransitionTransformer
:members:
:protected-members:
:undoc-members:
.. doxygenclass:: light::LightFlashTransformer
:members:
:protected-members:
:undoc-members:
.. doxygenfile:: esphomelib/light/light_transformer.h
MQTTJSONLightComponent
**********************
.. doxygenclass:: light::MQTTJSONLightComponent
:members:
:protected-members:
:undoc-members:
.. doxygenclass:: light::TurnOffAction
:members:
:protected-members:
:undoc-members:
.. doxygenclass:: light::TurnOnAction
:members:
:protected-members:
:undoc-members:
.. doxygenclass:: light::ToggleAction
:members:
:protected-members:
:undoc-members:
.. doxygenfile:: esphomelib/light/mqtt_json_light_component.h

24
api/light/neopixelbus.rst Normal file
View File

@ -0,0 +1,24 @@
Neopixelbus Lights
==================
API Reference
-------------
.. cpp:namespace:: nullptr
.. doxygenenum:: light::ESPNeoPixelOrder
.. doxygenclass:: light::NeoPixelBusLightOutputBase
:members:
:protected-members:
:undoc-members:
.. doxygenclass:: light::NeoPixelRGBLightOutput
:members:
:protected-members:
:undoc-members:
.. doxygenclass:: light::NeoPixelRGBWLightOutput
:members:
:protected-members:
:undoc-members:

View File

@ -6,30 +6,7 @@ Stepper Component
API Reference
-------------
.. cpp:namespace:: nullptr
.. doxygenfile:: esphomelib/stepper/stepper.h
Stepper
*******
.. doxygenclass:: stepper::Stepper
:members:
:protected-members:
:undoc-members:
.. doxygenclass:: stepper::SetTargetAction
:members:
:protected-members:
:undoc-members:
.. doxygenclass:: stepper::ReportPositionAction
:members:
:protected-members:
:undoc-members:
A4988
*****
.. doxygenclass:: stepper::A4988
:members:
:protected-members:
:undoc-members:
.. doxygenfile:: esphomelib/stepper/a4988.h
.. doxygenfile:: esphomelib/stepper/uln2003.h

9
api/sensor/apds9960.rst Normal file
View File

@ -0,0 +1,9 @@
APDS9960 Sensor
===============
See :cpp:func:`Application::make_apds9960`.
API Reference
-------------
.. doxygenclass:: esphomelib/sensor/apds9960.h

View File

@ -37,6 +37,8 @@ GPIOSwitch
:protected-members:
:undoc-members:
.. doxygenenum:: switch_::GPIOSwitchRestoreMode
.. doxygenclass:: switch_::SwitchCondition
:members:
:protected-members:

View File

@ -51,7 +51,8 @@ extensions = [
breathe_projects = {"esphomelib": "./_doxyxml/"}
breathe_default_project = "esphomelib"
breathe_domain_by_extension = {"h": "cpp"}
breathe_domain_by_extension = {"h": "cpp", "tcc": "cpp"}
breathe_default_members = ('members', 'private-members', 'undoc-members')
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']

View File

@ -3,21 +3,20 @@ Changelog - Version 1.9.0
.. seo::
:description: Changelog for esphomelib version 1.9.0.
:image: /_static/changelog-1.9.0.png
:image: /_static/changelog-1.10.0.png
:author: Otto Winter
:author_twitter: @OttoWinter_
.. imgtable::
Beta Releases, guides/faq.html#how-do-i-update-to-the-latest-beta-release, new-box.svg
TODO: Write Changelog, create seo image
Past Changelogs
---------------
.. toctree::
:glob:
:maxdepth: 1
v*
v1.9.0
v1.8.0
v1.7.0
.. disqus::

View File

@ -332,9 +332,9 @@ Past Changelogs
---------------
.. toctree::
:glob:
:maxdepth: 1
v*
v1.8.0
v1.7.0
.. disqus::

View File

@ -0,0 +1,156 @@
Native API Component
====================
.. seo::
:description: Instructions for setting up the native ESPHome API for communication with Home Assistant.
:image: server-network.png
:keywords: Native API, ESPHome, Home Assistant
This core esphomelib component sets up WiFi connections to access points
for you. It needs to be in your configuration or otherwise esphomeyaml
will fail in the config validation stage.
Its recommended to provide a static IP for your node, as it can
dramatically improve connection times.
.. code-block:: yaml
# Example configuration entry
api:
password: 'MyPassword'
Configuration variables:
------------------------
- **port** (*Optional*, integer): The port to run the API Server on. Defaults to ``6053``.
- **password** (*Optional*, string): The password to protect the API Server with. Defaults to no password.
- **reboot_timeout** (*Optional*, :ref:`time <config-time>`): The amount of time to wait before rebooting when no
client connects to the API. This is needed because sometimes the low level ESP functions report that
the ESP is connected to the network, when in fact it is not - only a full reboot fixes it.
Can be disabled by setting this to ``0s``. Defaults to ``5min``.
- **id** (*Optional*, :ref:`config-id`): Manually specify the ID used for code generation.
.. _api-mqtt_to_native:
Converting from MQTT to Native API Setup in Home Assistant
----------------------------------------------------------
The native API is the best way to use esphomelib together with Home Assistant - it's fast,
highly efficient and requires almost zero setup (whereas MQTT requires you to set up an MQTT broker first).
If you've previously used esphomelib with Home Assistant via MQTT and have enabled MQTT discovery,
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.
You can repeat these steps for all your nodes, or convert them over to the new native API one by one.
1. Disable MQTT discovery on ESP side. In your ESPHome configuration, set a special "clean" discovery flag:
.. code-block:: yaml
# In your ESPHome configuration! Not HA config!
mqtt:
# Other settings ...
discovery: clean
2. Compile and upload this new firmware. All entities should now be gone from Home Assistant.
3. Go to your Home Assistant configuration folder and go to the ``.storage`` folder (might be hidden
depending on your operating system). In there you will find a file called ``core.entity_registry`` - open
the file with a text editor and paste the contents below
.. 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);
}
}
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.
5. Convert the Entity Registry file above using the "Convert Entity Registry Button", and
override the ``.storage/core.entity_registry`` file with the new contents.
6. Start Home Assistant.
7. Now you can enable the ESPHome native API (and upload the new firmware)
.. code-block:: yaml
# 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
always manually set up an ESPHome device using "Set up a new integration" -> "ESPHome".
.. _api-homeassistant_service_action:
``homeassistant.service`` Action
--------------------------------
When using the native API with Home Assistant, you can create Home Assistant service
calls straight from ESPHome :ref:`Automations <automation>`.
.. code-block:: yaml
# In some trigger
on_...:
# Simple
- homeassistant.service:
service: notify.html5
data:
title: Button was pressed
# With templates and variables
- homeassistant.service:
service: notify.html5
data:
title: New Humidity
data_template:
message: The humidity is {{ my_variable }}%.
variables:
my_variable: |-
return id(my_sensor).state;
Configuration options:
- **service** (**Required**, string): The Home Assistant `Service <https://www.home-assistant.io/docs/scripts/service-calls/>`__
to call.
- **data** (*Optional*, mapping): Optional *static* data to pass along with the service call.
- **data_template** (*Optional*, mapping): Optional template data to pass along with the service call.
This is evaluated on the Home Assistant side with Home Assistant's templating engine.
- **variables** (*Optional*, mapping): Optional variables that can be used in the ``data_template``.
Values are :ref:`lambdas <config-lambda>` and will be evaluated before sending the request.
See Also
--------
- :doc:`API Reference </api/core/native-api>`
- `Edit this page on GitHub <https://github.com/OttoWinter/esphomedocs/blob/current/esphomeyaml/components/api.rst>`__
.. disqus::

View File

@ -67,7 +67,7 @@ They are similar to :ref:`Sensor Filters <sensor-filters>`.
- invert:
- delayed_on: 100ms
- delayed_off: 100ms
- lambda: >-
- lambda: |-
if (id(other_binary_sensor).state) {
return x;
} else {
@ -140,6 +140,26 @@ edge of the signal.
Configuration variables: See :ref:`Automation <automation>`.
.. _binary_sensor-on_state:
``on_state``
************
This automation will be triggered when a new state is received (and thus combines ``on_press``
and ``on_release`` into one trigger). The new state will be given as the variable ``x`` as a boolean
and can be used in :ref:`lambdas <config-lambda>`.
.. code-block:: yaml
binary_sensor:
- platform: gpio
# ...
on_state:
then:
- switch.turn_off: relay_1
Configuration variables: See :ref:`Automation <automation>`.
.. _binary_sensor-on_click:
``on_click``
@ -260,23 +280,22 @@ presses.
then:
- logger.log: "Single Short Clicked"
.. _binary_sensor-is_on_off_condition:
.. _binary_sensor-is_on_condition:
.. _binary_sensor-is_off_condition:
``binary_sensor.is_on`` / ``binary_sensor.is_off Condition
**********************************************************
``binary_sensor.is_on`` / ``binary_sensor.is_off`` Condition
************************************************************
This :ref:`condition <config-condition>` passes if the given binary sensor is on/off.
This :ref:`Condition <config-condition>` checks if the given binary sensor is ON (or OFF).
.. code-block:: yaml
# in a trigger:
# In some trigger:
on_...:
if:
condition:
# Same syntax for is_off
binary_sensor.is_on: my_binary_sensor
# same goes for is_off
then:
- script.execute: my_script
lambda calls
************

View File

@ -17,7 +17,7 @@ a binary sensor.
binary_sensor:
- platform: template
name: "Garage Door Open"
lambda: >-
lambda: |-
if (isnan(id(ultrasonic_sensor1).state)) {
// isnan checks if the ultrasonic sensor echo
// has timed out, resulting in a NaN (not a number) state

View File

@ -19,7 +19,7 @@ as a cover and can be controlled through the frontend.
cover:
- platform: template
name: "Template Cover"
lambda: >-
lambda: |-
if (id(top_end_stop).state) {
return cover::COVER_OPEN;
} else {

View File

@ -34,7 +34,7 @@ Configuration variables:
- **pin** (**Required**, number): The pin the sensor bus is connected to.
- **update_interval** (*Optional*, :ref:`config-time`): The interval that the sensors should be checked.
Defaults to 15 seconds. See :ref:`sensor-default_filter`.
Defaults to 15 seconds.
- **id** (*Optional*, :ref:`config-id`): Manually specify the ID used for code generation.
See Also

View File

@ -41,7 +41,7 @@ change the UUID to something unique. For example, you can copy below randomly ge
.. raw:: html
<input type="text" id="ble-uuid" style="width: 240px;" readonly="readonly">
<input type="text" id="ble-uuid" onclick="this.focus();this.select()" style="width: 240px;" readonly="readonly">
<script>
// https://stackoverflow.com/a/105074/8924614
function guid() {

View File

@ -42,6 +42,11 @@ Advanced options:
- **build_path** (*Optional*, string): Customize where esphomeyaml will store the build files
for your node. By default, esphomeyaml puts all platformio project files under a folder ``<NODE_NAME>/``,
but you can customize this behavior using this option.
- **platformio_options** (*Optional*, mapping): Additional options to pass over to platformio in the
platformio.ini file. See :ref:`esphomeyaml-platformio_options`.
- **includes** (*Optional*, list): Additional files to include in the main.cpp for custom components.
- **libraries** (*Optional*, list): Additional `platformio libraries <https://platformio.org/lib>`__ to
include in the build. Mostly for custom code.
- **use_custom_code** (*Optional*, boolean): Whether to configure the project for writing custom components.
This sets up some flags so that custom code should compile correctly
- **includes** (*Optional*, list of files): A list of files to include in the main (auto-generated) sketch file
@ -236,6 +241,26 @@ This automation will be triggered on every ``loop()`` iteration (usually around
then:
# do something
.. _esphomeyaml-platformio_options:
``platformio_options``
----------------------
Platformio supports a number of options in its ``platformio.ini`` file. With the ``platformio_options``
parameter you can tell esphomeyaml what options to pass into the ``env`` section of the platformio file
(Note you can also do this by editing the ``platformio.ini`` file manually).
You can view a full list of platformio options here: https://docs.platformio.org/en/latest/projectconf/section_env.html
.. code-block:: yaml
# Example configuration entry
esphomeyaml:
# ...
platformio_options:
upload_speed: 115200
board_build.f_flash: 80000000L
See Also
--------

View File

@ -0,0 +1,89 @@
Ethernet Component
==================
.. seo::
:description: Instructions for setting up the Ethernet configuration for your ESP32 node in esphomelib.
:image: ethernet.png
:keywords: Ethernet, ESP32
.. warning::
This integration is experimental as I don't have the hardware to test it (yet).
If you can verify it works (or if it doesn't), notify me on `discord <https://discord.gg/KhAMKrd>`__.
This core esphomelib component sets up ethernet connections for ESP32s.
Ethernet for ESP8266 is not supported.
.. code-block:: yaml
# Example configuration entry
ethernet:
type: LAN8720
mdc_pin: GPIO23
mdio_pin: GPIO18
clk_mode: GPIO0_IN
phy_addr: 0
# Optional manual IP
manual_ip:
static_ip: 10.0.0.42
gateway: 10.0.0.1
subnet: 255.255.255.0
Configuration variables:
------------------------
- **type** (**Required**, string): The type of LAN chipset. Must be one of
``LAN8720`` or ``TLK110`` (see datasheet for more details).
- **mdc_pin** (**Required**, :ref:`config-pin`): The MDC pin of the board.
Usually this is ``GPIO23``.
- **mdio_pin** (**Required**, :ref:`config-pin`): The MDIO pin of the board.
Usually this is ``GPIO18``.
- **clk_mode** (*Optional*, string): The clock mode of the data lines, this must be one
of these values: (see datasheet of your board for more details)
- ``GPIO0_IN`` (Default) - External clock
- ``GPIO0_OUT`` - Internal clock
- ``GPIO16_OUT`` - Internal clock
- ``GPIO17_OUT`` - Internal clock
- **phy_addr** (*Optional*, int): The PHY addr type of the ethernet controller. Defaults to 0.
- **power_pin** (*Optional*, :ref:`Pin Schema <config-pin_schema>`): The pin with which
to control the power of the board. Leave unspecified for no power pin (default)
- **manual_ip** (*Optional*): Manually configure the static IP of the node.
- **static_ip** (*Required*, IPv4 address): The static IP of your node.
- **gateway** (*Required*, IPv4 address): The gateway of the local network.
- **subnet** (*Required*, IPv4 address): The subnet of the local network.
- **dns1** (*Optional*, IPv4 address): The main DNS server to use.
- **dns2** (*Optional*, IPv4 address): The backup DNS server to use.
- **hostname** (*Optional*, string): Manually set the hostname of the
node. Can only be 63 long at max and must only contain alphanumeric
characters plus dashes and underscores.
- **domain** (*Optional*, string): Set the domain of the node hostname used for uploading.
For example, if it's set to ``.local``, all uploads will be sent to ``<HOSTNAME>.local``.
Defaults to ``.local``.
- **id** (*Optional*, :ref:`config-id`): Manually specify the ID used for code generation.
Configuration for wESP32 board
------------------------------
.. code-block:: yaml
ethernet:
type: LAN8720
mdc_pin: GPIO16
mdio_pin: GPIO17
clk_mode: GPIO0_IN
phy_addr: 0
See Also
--------
- :doc:`API Reference </api/core/wifi>`
- `Edit this page on GitHub <https://github.com/OttoWinter/esphomedocs/blob/current/esphomeyaml/components/ethernet.rst>`__
.. disqus::

View File

@ -2,7 +2,7 @@ FastLED Clockless Light
=======================
.. seo::
:description: Instructions for setting up FastLED addressable lights like NEXTION.
:description: Instructions for setting up FastLED addressable lights like NEOPIXEL.
:image: color_lens.png
The ``fastled_clockless`` light platform allows you to create RGB lights

View File

@ -62,7 +62,7 @@ This action turns a light with the given ID on when executed.
# Templated
- light.turn_on:
id: light_1
brightness: !lambda >-
brightness: !lambda |-
// output value must be in range 0 - 1.0
return id(some_sensor).state / 100.0;
@ -158,6 +158,9 @@ entries with each having a unique name like so:
- platform: ...
# ...
effects:
# Use default parameters:
- random:
# Customize parameters
- random:
name: "My Slow Random Effect"
transition_length: 30s
@ -296,8 +299,8 @@ Configuration variables:
- **lambda** (**Required**, :ref:`lambda <config-lambda>`): The code to execute. ``static`` variables are
especially useful.
FastLED Rainbow Effect
**********************
Addressable Rainbow Effect
**************************
A light effect for individually-addressable LEDs that creates a moving rainbow over the whole LED strip using
the HSV color wheel.
@ -305,11 +308,11 @@ the HSV color wheel.
.. code-block:: yaml
light:
- platform: fastled_...
- platform: ...
# ...
effects:
- fastled_rainbow:
- fastled_rainbow:
- addressable_rainbow:
- addressable_rainbow:
name: Rainbow Effect With Custom Values
speed: 10
width: 50
@ -321,8 +324,8 @@ Configuration variables:
- **width** (*Optional*, int): The "width" of a full-scale rainbow, unitless. Defaults to ``50``.
FastLED Color Wipe Effect
*************************
Addressable 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``.
@ -330,11 +333,11 @@ the strip and shifts them forward every ``add_led_interval``.
.. code-block:: yaml
light:
- platform: fastled_...
- platform: ...
# ...
effects:
- fastled_color_wipe:
- fastled_color_wipe:
- addressable_color_wipe:
- addressable_color_wipe:
name: Color Wipe Effect With Custom Values
colors:
- red: 100%
@ -365,8 +368,8 @@ Configuration variables:
beginning of the strip. Defaults to ``100ms``.
- **reverse** (*Optional*, boolean): Whether to reverse the direction of the color wipe. Defaults to ``False``.
FastLED Scan Effect
*******************
Addressable 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.
@ -374,11 +377,11 @@ currently active light color.
.. code-block:: yaml
light:
- platform: fastled_...
- platform: ...
# ...
effects:
- fastled_scan:
- fastled_scan:
- addressable_scan:
- addressable_scan:
name: Scan Effect With Custom Values
move_interval: 100ms
@ -388,8 +391,8 @@ Configuration variables:
- **move_interval** (*Optional*, :ref:`config-time`): The interval with which to move the dot one LED forward.
Defaults to ``100ms``.
FastLED Twinkle Effect
**********************
Addressable Twinkle Effect
**************************
A light effect for individually-addressable LED strips that randomly chooses some LEDs and let's them bright
up for a moment, like a stars twinkling in the night's sky. The color of the pixels will be chosen by the
@ -398,11 +401,11 @@ currently active light color.
.. code-block:: yaml
light:
- platform: fastled_...
- platform: ...
# ...
effects:
- fastled_twinkle:
- fastled_twinkle:
- addressable_twinkle:
- addressable_twinkle:
name: Twinkle Effect With Custom Values
twinkle_probability: 5%
progress_interval: 4ms
@ -415,19 +418,19 @@ Configuration variables:
- **progress_interval** (*Optional*, :ref:`config-time`): The interval with which to progress the effect. This
affects the duration of a twinkle animation. Defaults to ``4ms``.
FastLED Random Twinkle Effect
*****************************
Addressable Random Twinkle Effect
*********************************
A light effect similar to ``fastled_twinkle``, but using random colors for each twinkle animation.
A light effect similar to ``addressable_twinkle``, but using random colors for each twinkle animation.
.. code-block:: yaml
light:
- platform: fastled_...
- platform: ...
# ...
effects:
- fastled_random_twinkle:
- fastled_random_twinkle:
- addressable_random_twinkle:
- addressable_random_twinkle:
name: Random Twinkle Effect With Custom Values
twinkle_probability: 5%
progress_interval: 32ms
@ -441,8 +444,8 @@ Configuration variables:
affects the duration of a twinkle animation. Defaults to ``4ms``.
FastLED Fireworks Effect
************************
Addressable 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.
@ -450,11 +453,11 @@ and lets the sparkles cascade over the LED strip.
.. code-block:: yaml
light:
- platform: fastled_...
- platform: ...
# ...
effects:
- fastled_fireworks:
- fastled_fireworks:
- addressable_fireworks:
- addressable_fireworks:
name: Fireworks Effect With Custom Values
update_interval: 32ms
spark_probability: 10%
@ -474,8 +477,8 @@ Configuration variables:
chosen so that the whole strip doesn't light up forever if the fade out rate is too low or that the firework
sparks do not propagate for a long time. Defaults to ``120``.
FastLED Flicker Effect
**********************
Addressable 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.
@ -483,18 +486,18 @@ each LED by its own random amount around the currently active light color.
.. code-block:: yaml
light:
- platform: fastled_...
- platform: ...
# ...
effects:
- fastled_flicker:
- fastled_flicker:
- addressable_flicker:
- addressable_flicker:
name: Flicker Effect With Custom Values
update_interval: 16ms
intensity: 5%
Configuration variables:
- **name** (*Optional*, string): The name of the effect. Defaults to ``FastLED Flicker``.
- **name** (*Optional*, string): The name of the effect. Defaults to ``Addressable Flicker``.
- **update_interval** (*Optional*, :ref:`config-time`): The time interval for updating the random offsets.
Defaults to ``16ms``.
- **intensity** (*Optional*, percentage): The intensity of the effect, basically how much the random values can offset

View File

@ -0,0 +1,97 @@
Neopixelbus Light
=================
.. seo::
:description: Instructions for setting up Neopixel addressable lights.
:image: color_lens.png
The ``neopixelbus`` light platform allows you to create RGB lights
in esphomelib for a individually addressable lights like NeoPixel or WS2812.
It is very similar to the :doc:`fastled_clockless` and :doc:`fastled_spi` platforms;
in fact most addressable lights are supported through both light platforms. The
difference is that they use different libraries: While the fastled platforms use
the `FastLED <https://github.com/FastLED/FastLED>`__ library, this integration uses
the `NeoPixelBus <https://github.com/Makuna/NeoPixelBus/>`__ library internally.
.. code-block:: yaml
# Example configuration entry
light:
- platform: neopixelbus
type: GRB
pin: GPIO23
num_leds: 60
name: "NeoPixel Light"
Configuration variables:
------------------------
**Base Options:**
- **name** (**Required**, string): The name of the light.
- **gamma_correct** (*Optional*, float): The `gamma correction
factor <https://en.wikipedia.org/wiki/Gamma_correction>`__ for the
light. Defaults to ``2.8``.
- **id** (*Optional*, :ref:`config-id`): Manually specify the ID used for code generation.
- **color_correct** (*Optional*, list of percentages): The color correction for each channel. This denotes
the maximum brightness of the red, green, blue[, white] channel. Defaults to ``color_correct: [100%, 100%, 100%]``.
- **default_transition_length** (*Optional*, :ref:`config-time`): The length of
the transition if no transition parameter is provided by Home
Assistant. Defaults to ``1s``.
- **power_supply** (*Optional*, :ref:`config-id`): The :doc:`/esphomeyaml/components/power_supply` to connect to
this light. When the light is turned on, the power supply will automatically be switched on too.
- **effects** (*Optional*, list): A list of :ref:`light effects <light-effects>` to use for this light.
- All other options from :ref:`MQTT Component <config-mqtt-component>`.
**Type Options:**
- **type** (*Optional*, string): The type of light. This is used to specify
if it is an RGBW or RGB light and in which order the colors are. Defaults to
``GRB``. Change this if you have lights with white value and/or the colors are in the wrong order.
- **variant** (*Optional*, string): The chipset variant. You can read more about these
`here <https://github.com/Makuna/NeoPixelBus/wiki/NeoPixelBus-object#neopixel-led-model-specific-methods>`__
(some of the info on that page is not entirely correct).
One of these values:
- ``800KBPS`` (default)
- ``400KBPS``
- ``WS2812X``
- ``SK6812``
- ``WS2813`` (same as ``WS2812X``)
- ``WS2812`` (same as ``800KBPS``)
- ``LC8812`` (same as ``SK6812``)
- **method** (*Optional*, string): The method to transmit the data with. You can read
more about these here: `ESP32 <https://github.com/Makuna/NeoPixelBus/wiki/ESP32-NeoMethods>`__,
`ESP8266 <https://github.com/Makuna/NeoPixelBus/wiki/ESP8266-NeoMethods>`__
- ``ESP8266_DMA`` (default for ESP8266)
- ``ESP8266_UART0``
- ``ESP8266_UART1``
- ``ESP8266_ASYNC_UART0``
- ``ESP8266_ASYNC_UART1``
- ``ESP32_I2S_0``
- ``ESP32_I2S_1`` (default for ESP32)
- ``BIT_BANG``
- **num_leds** (**Required**, int): The number of LEDs attached.
**Pin Options:** Some chipsets have two data pins to connect, others only have one.
If you have one line, only specify ``pin``, otherwise specify both ``clock_pin`` and ``data_pin``.
- **pin** (**Required**, :ref:`config-pin`): The pin for the data line of the light.
- **clock_pin** (**Required**, :ref:`config-pin`): The pin for the clock line of the light, for two-pin lights.
- **data_pin** (**Required**, :ref:`config-pin`): The pin for the data line of the light, for two-pin lights.
See Also
--------
- :doc:`/esphomeyaml/components/light/index`
- :doc:`/esphomeyaml/components/light/fastled_clockless`
- :doc:`/esphomeyaml/components/power_supply`
- :doc:`API Reference </api/light/neopixelbus>`
- `NeoPixelBus library <https://github.com/Makuna/NeoPixelBus/wiki/ESP8266-NeoMethods>`__
- `Edit this page on GitHub <https://github.com/OttoWinter/esphomedocs/blob/current/esphomeyaml/components/light/neopixelbus.rst>`__
.. disqus::

View File

@ -412,10 +412,10 @@ Publish an MQTT message on a topic using this action in automations.
# Templated:
- mqtt.publish:
topic: !lambda >-
topic: !lambda |-
if (id(reed_switch).state) return "topic1";
else return "topic2";
payload: !lambda >-
payload: !lambda |-
return id(reed_switch).state ? "YES" : "NO";
Configuration options:

View File

@ -21,7 +21,7 @@ GPIO39 can be used.
- platform: adc
pin: A0
name: "Living Room Brightness"
update_interval: 15s
update_interval: 60s
Configuration variables:
------------------------
@ -32,7 +32,7 @@ Configuration variables:
- **attenuation** (*Optional*): Only on ESP32. Specify the ADC
attenuation to use. See :ref:`adc-esp32_attenuation`.
- **update_interval** (*Optional*, :ref:`config-time`): The interval
to check the sensor. Defaults to ``15s``. See :ref:`sensor-default_filter`.
to check the sensor. Defaults to ``60s``.
- **id** (*Optional*, :ref:`config-id`): Manually specify the ID used for code generation.
- All other options from :ref:`Sensor <config-sensor>` and :ref:`MQTT Component <config-mqtt-component>`.

View File

@ -44,7 +44,7 @@ Configuration variables:
- **ads1115_id** (*Optional*, :ref:`config-id`): Manually specify the ID of the
:doc:`ADS1115 Hub </esphomeyaml/components/ads1115>` you want to use this sensor.
- **update_interval** (*Optional*, :ref:`config-time`): The interval
to check the sensor. Defaults to ``15s``. See :ref:`sensor-default_filter`.
to check the sensor. Defaults to ``60s``.
- **id** (*Optional*, :ref:`config-id`): Manually specify the ID used for code generation.
Multiplexer And Gain

View File

@ -0,0 +1,86 @@
APDS9960 Sensor
===============
.. seo::
:description: Instructions for setting up APDS9960 sensors.
:image: apds9960.jpg
The ``apds9960`` sensor platform allows you to use your APDS9960 RGB and gesture sensors
(`datasheet <https://cdn-shop.adafruit.com/datasheets/BST-BME280_DS001-10.pdf>`__,
`Sparkfun`_) with esphomelib.
The :ref:`I²C <i2c>` is
required to be set up in your configuration for this sensor to work.
.. figure:: images/apds9960-full.jpg
:align: center
:width: 80.0%
Image by `Sparkfun`_.
.. code-block:: yaml
# Example configuration entry
apds9960:
address: 0x39
update_interval: 60s
sensor:
- platform: apds9960
type: CLEAR
name: "APDS9960 Clear Channel"
binary_sensor:
- platform: apds9960
direction: UP
name: "APDS960 Up Movement"
# Repeat for each direction
.. _Sparkfun: https://www.sparkfun.com/products/12787
Configuration variables:
------------------------
The configuration is made up of three parts: The central component, individual sensors,
and direction binary sensors.
Base Configuration:
- **address** (*Optional*, integer): The i2c address of the sensor. Defaults to ``0x39``.
- **update_interval** (*Optional*, :ref:`config-time`): The interval
to check the sensor. Defaults to ``60s``.
Sensor Configuration:
- **name** (**Required**, string): The name for the sensor.
- **type** (**Required**, string): The type of sensor measurement. One of
- **CLEAR**
- **RED**
- **GREEN**
- **BLUE**
- **PROXIMITY**
- **id** (*Optional*, :ref:`config-id`): Set the ID of this sensor for use in lambdas.
- All other options from :ref:`Sensor <config-sensor>` and :ref:`MQTT Component <config-mqtt-component>`.
Binary Sensor Configuration:
- **name** (**Required**, string): The name for the binary sensor.
- **direction** (**Required**, string): The direction to measure. One of:
- **UP**
- **DOWN**
- **LEFT**
- **RIGHT**
- **id** (*Optional*, :ref:`config-id`): Manually specify the ID used for code generation.
- All other options from :ref:`Binary Sensor <config-binary_sensor>` and :ref:`MQTT Component <config-mqtt-component>`.
See Also
--------
- :ref:`sensor-filters`
- :doc:`API Reference </api/sensor/apds9960>`
- `Edit this page on GitHub <https://github.com/OttoWinter/esphomedocs/blob/current/esphomeyaml/components/sensor/apds9960.rst>`__
.. disqus::

View File

@ -31,7 +31,7 @@ your configuration for this sensor to work.
- platform: bh1750
name: "BH1750 Illuminance"
address: 0x23
update_interval: 15s
update_interval: 60s
Configuration variables:
------------------------
@ -43,7 +43,7 @@ Configuration variables:
- **resolution** (*Optional*, string): The resolution of the sensor in lx. One of ``4.0``,
``1.0``, ``0.5``. Defaults to ``0.5`` (the maximum resolution).
- **update_interval** (*Optional*, :ref:`config-time`): The interval to check the
sensor. Defaults to ``15s``. See :ref:`sensor-default_filter`.
sensor. Defaults to ``60s``.
- **id** (*Optional*, :ref:`config-id`): Manually specify the ID used for code
generation.
- All other options from :ref:`Sensor <config-sensor>` and :ref:`MQTT Component <config-mqtt-component>`.

View File

@ -32,7 +32,7 @@ required to be set up in your configuration for this sensor to work.
humidity:
name: "BME280 Humidity"
address: 0x77
update_interval: 15s
update_interval: 60s
Configuration variables:
------------------------
@ -68,7 +68,7 @@ Configuration variables:
- **iir_filter** (*Optional*): Set up an Infinite Impulse Response filter to increase accuracy. One of
``OFF``, ``2x``, ``4x``, ``16x``. Defaults to ``OFF``.
- **update_interval** (*Optional*, :ref:`config-time`): The interval to check the
sensor. Defaults to ``15s``. See :ref:`sensor-default_filter`.
sensor. Defaults to ``60s``.
.. _bme280-oversampling:

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

@ -34,7 +34,7 @@ your configuration for this sensor to work.
gas_resistance:
name: "BME680 Gas Resistance"
address: 0x77
update_interval: 15s
update_interval: 60s
Configuration variables:
------------------------
@ -82,7 +82,7 @@ Configuration variables:
Defaults to ``150ms``.
- **update_interval** (*Optional*, :ref:`config-time`): The interval to check the
sensor. Defaults to ``15s``. See :ref:`sensor-default_filter`.
sensor. Defaults to ``60s``.
.. figure:: images/bme680-ui.png
:align: center

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

View File

@ -33,7 +33,7 @@ your configuration for this sensor to work.
name: "Outside Temperature"
pressure:
name: "Outside Pressure"
update_interval: 15s
update_interval: 60s
Configuration variables:
------------------------
@ -54,7 +54,7 @@ Configuration variables:
- **address** (*Optional*, int): Manually specify the I²C address of
the sensor. Defaults to ``0x77``.
- **update_interval** (*Optional*, :ref:`config-time`): The interval to check the
sensor. Defaults to ``15s``. See :ref:`sensor-default_filter`.
sensor. Defaults to ``60s``.
See Also
--------

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

@ -30,7 +30,7 @@ required to be set up in your configuration for this sensor to work.
pressure:
name: "Outside Pressure"
address: 0x77
update_interval: 15s
update_interval: 60s
Configuration variables:
------------------------
@ -58,7 +58,7 @@ Configuration variables:
- **iir_filter** (*Optional*): Set up an Infinite Impulse Response filter to increase accuracy. One of
``OFF``, ``2x``, ``4x``, ``16x``. Defaults to ``OFF``.
- **update_interval** (*Optional*, :ref:`config-time`): The interval to check the
sensor. Defaults to ``15s``. See :ref:`sensor-default_filter`.
sensor. Defaults to ``60s``.
.. figure:: images/bmp280-full.jpg
:align: center

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

@ -48,7 +48,7 @@ Configuration variables:
- **voltage** (*Optional*): Use the voltage value of the sensor in V (RMS).
All options from :ref:`Sensor <config-sensor>` and :ref:`MQTT Component <config-mqtt-component>`.
- **update_interval** (*Optional*, :ref:`config-time`): The interval to check the
sensor. Defaults to ``15s``. See :ref:`sensor-default_filter`.
sensor. Defaults to ``60s``.
- **uart_id** (*Optional*, :ref:`config-id`): Manually specify the ID of the :ref:`UART Component <uart>` if you want
to use multiple UART buses.

View File

@ -43,7 +43,7 @@ if you're having issues try the 4.7kΩ recommended by the manufacturer) between
name: "Living Room Temperature"
humidity:
name: "Living Room Humidity"
update_interval: 15s
update_interval: 60s
Configuration variables:
------------------------
@ -65,7 +65,7 @@ Configuration variables:
one of ``AUTO_DETECT``, ``DHT11``, ``DHT22``, ``AM2302``, ``RHT03``
and helps with some connection issues. Defaults to ``AUTO_DETECT``.
- **update_interval** (*Optional*, :ref:`config-time`): The interval to check the
sensor. Defaults to ``15s``. See :ref:`sensor-default_filter`.
sensor. Defaults to ``60s``.
.. note::

View File

@ -31,7 +31,7 @@ The ``dht12`` Temperature+Humidity sensor allows you to use your DHT12
name: "Living Room Temperature"
humidity:
name: "Living Room Humidity"
update_interval: 15s
update_interval: 60s
Configuration variables:
------------------------
@ -48,8 +48,8 @@ Configuration variables:
- **id** (*Optional*, :ref:`config-id`): Set the ID of this sensor for use in lambdas.
- All other options from :ref:`Sensor <config-sensor>` and :ref:`MQTT Component <config-mqtt-component>`.
- **update_interval** (*Optional*, :ref:`config-time`): The interval to check the sensor. Defaults to ``15s``.
See :ref:`sensor-default_filter`.
- **update_interval** (*Optional*, :ref:`config-time`): The interval to check the sensor. Defaults to ``60s``.
See Also
--------

View File

@ -28,8 +28,8 @@ Configuration variables:
- **pin** (*Optional*, :ref:`Pin Schema <config-pin_schema>`): The pin to observe for the duty
cycle.
- **update_interval** (*Optional*, :ref:`config-time`): The interval to check the sensor. Defaults to ``15s``.
See :ref:`sensor-default_filter`.
- **update_interval** (*Optional*, :ref:`config-time`): The interval to check the sensor. Defaults to ``60s``.
- **id** (*Optional*, :ref:`config-id`): Set the ID of this sensor for use in lambdas.
- All other options from :ref:`Sensor <config-sensor>` and :ref:`MQTT Component <config-mqtt-component>`.

View File

@ -25,14 +25,14 @@ by the hall sensor.
sensor:
- platform: esp32_hall
name: "ESP32 Hall Sensor"
update_interval: 15s
update_interval: 60s
Configuration variables:
------------------------
- **name** (**Required**, string): The name of the hall effect sensor.
- **update_interval** (*Optional*, :ref:`config-time`): The interval
to check the sensor. Defaults to ``15s``. See :ref:`sensor-default_filter`.
to check the sensor. Defaults to ``60s``.
- **id** (*Optional*, :ref:`config-id`): Manually specify the ID used for code generation.
- All other options from :ref:`Sensor <config-sensor>` and :ref:`MQTT Component <config-mqtt-component>`.

View File

@ -34,7 +34,7 @@ required to be set up in your configuration for this sensor to work.
name: "Living Room Temperature"
humidity:
name: "Living Room Pressure"
update_interval: 15s
update_interval: 60s
Configuration variables:
------------------------
@ -51,8 +51,8 @@ Configuration variables:
- **id** (*Optional*, :ref:`config-id`): Set the ID of this sensor for use in lambdas.
- All other options from :ref:`Sensor <config-sensor>` and :ref:`MQTT Component <config-mqtt-component>`.
- **update_interval** (*Optional*, :ref:`config-time`): The interval to check the sensor. Defaults to ``15s``.
See :ref:`sensor-default_filter`.
- **update_interval** (*Optional*, :ref:`config-time`): The interval to check the sensor. Defaults to ``60s``.
Currently, the platform doesn't support activating the built-in heater,
as it seems to only be rarely of use. If you need it, please open an

View File

@ -31,7 +31,7 @@ be measured at the same exact points in time.
name: "HLW8012 Voltage"
power:
name: "HLW8012 Power"
update_interval: 15s
update_interval: 60s
.. note::
@ -55,8 +55,8 @@ Configuration variables:
Defaults to the Sonoff POW's value ``2351``.
- **change_mode_every** (*Optional*, int): After how many updates to cycle between the current/voltage measurement mode.
Note that the first value after switching is discarded because it is often inaccurate. Defaults to ``8``.
- **update_interval** (*Optional*, :ref:`config-time`): The interval to check the sensor. Defaults to ``15s``.
See :ref:`sensor-default_filter`.
- **update_interval** (*Optional*, :ref:`config-time`): The interval to check the sensor. Defaults to ``60s``.
See Also
--------

View File

@ -29,7 +29,7 @@ required to be set up in your configuration for this sensor to work.
heading:
name: "HMC5883L Heading"
range: 130uT
update_interval: 15s
update_interval: 60s
Configuration variables:
------------------------
@ -43,8 +43,8 @@ Configuration variables:
:ref:`Sensor <config-sensor>` and :ref:`MQTT Component <config-mqtt-component>`.
- **heading** (*Optional*): The heading of the sensor in degrees. All options from
:ref:`Sensor <config-sensor>` and :ref:`MQTT Component <config-mqtt-component>`.
- **update_interval** (*Optional*, :ref:`config-time`): The interval to check the sensor. Defaults to ``15s``.
See :ref:`sensor-default_filter`.
- **update_interval** (*Optional*, :ref:`config-time`): The interval to check the sensor. Defaults to ``60s``.
- **id** (*Optional*, :ref:`config-id`): Manually specify the ID used for code generation.
See Also

View File

@ -0,0 +1,43 @@
Homeassistant Sensor
====================
.. seo::
:description: Instructions for setting up homeassistant sensors with esphomelib that import states from your homeassistant instance.
:image: home-assistant.png
The ``homeassistant`` sensor platform allows you to create a sensors that import
states from your Home Assistant instance using the :doc:`native API </esphomeyaml/components/api>`.
.. code-block:: yaml
# Example configuration entry
sensor:
- platform: homeassistant
name: "Temperature Sensor From Home Assistant"
entity_id: sensor.temperature_sensor
.. note::
This component is only for numeral states. If you want to import arbitrary text states
from Home Assistant, use the :doc:`Home Assistant Text Sensor </esphomeyaml/components/text_sensor/homeassistant>`.
Importing attributes is currently not supported, but you can create template sensors in Home Assistant
that return the attribute of a sensor and then import the template sensor here.
Configuration variables:
------------------------
- **name** (**Required**, string): The name of the sensor.
- **entity_id** (**Required**, string): The entity ID to import from Home Assistant.
- **id** (*Optional*,:ref:`config-id`): Manually specify the ID used for code generation.
- All other options from :ref:`Sensor <config-sensor>` and :ref:`MQTT Component <config-mqtt-component>`.
See Also
--------
- :ref:`sensor-filters`
- :ref:`automation`
- :doc:`API Reference </api/core/native-api>`
- `Edit this page on GitHub <https://github.com/OttoWinter/esphomedocs/blob/current/esphomeyaml/components/sensor/homeassistant.rst>`__
.. disqus::

View File

@ -37,7 +37,7 @@ required to be set up in your configuration for this sensor to work.
name: "Living Room Temperature"
humidity:
name: "Living Room Humidity"
update_interval: 15s
update_interval: 60s
Configuration variables:
------------------------
@ -54,8 +54,8 @@ Configuration variables:
- **id** (*Optional*, :ref:`config-id`): Set the ID of this sensor for use in lambdas.
- All other options from :ref:`Sensor <config-sensor>` and :ref:`MQTT Component <config-mqtt-component>`.
- **update_interval** (*Optional*, :ref:`config-time`): The interval to check the sensor. Defaults to ``15s``.
See :ref:`sensor-default_filter`.
- **update_interval** (*Optional*, :ref:`config-time`): The interval to check the sensor. Defaults to ``60s``.
See Also
--------

View File

@ -31,7 +31,7 @@ Connect ``GND`` to ``GND``, ``VCC`` to ``3.3V`` and the other three ``MISO`` (or
dout_pin: D0
clk_pin: D1
gain: 128
update_interval: 15s
update_interval: 60s
Configuration variables:
------------------------
@ -39,8 +39,8 @@ Configuration variables:
- **name** (**Required**, string): The name for the load cell sensor.
- **dout_pin** (**Required**, :ref:`Pin Schema <config-pin_schema>`): The DOUT (or DAT) pin.
- **clk_pin** (**Required**, :ref:`Pin Schema <config-pin_schema>`): The CLK pin.
- **update_interval** (*Optional*, :ref:`config-time`): The interval to check the sensor. Defaults to ``15s``.
See :ref:`sensor-default_filter`.
- **update_interval** (*Optional*, :ref:`config-time`): The interval to check the sensor. Defaults to ``60s``.
- **id** (*Optional*, :ref:`config-id`): Manually specify the ID used for code generation.
- All other options from :ref:`Sensor <config-sensor>` and :ref:`MQTT Component <config-mqtt-component>`.

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

View File

@ -42,7 +42,7 @@ required to be set up in your configuration for this sensor to work.
name: "INA219 Shunt Voltage"
max_voltage: 32.0V
max_current: 3.2A
update_interval: 15s
update_interval: 60s
Configuration variables:
------------------------
@ -62,8 +62,8 @@ Configuration variables:
All options from :ref:`Sensor <config-sensor>` and :ref:`MQTT Component <config-mqtt-component>`.
- **shunt_voltage** (*Optional*): Use the shunt voltage (voltage across the shunt resistor) value of the sensor in V.
All options from :ref:`Sensor <config-sensor>` and :ref:`MQTT Component <config-mqtt-component>`.
- **update_interval** (*Optional*, :ref:`config-time`): The interval to check the sensor. Defaults to ``15s``.
See :ref:`sensor-default_filter`.
- **update_interval** (*Optional*, :ref:`config-time`): The interval to check the sensor. Defaults to ``60s``.
See Also
--------

View File

@ -45,7 +45,7 @@ required to be set up in your configuration for this sensor to work.
# ...
channel_3:
# ...
update_interval: 15s
update_interval: 60s
Configuration variables:
------------------------
@ -66,8 +66,8 @@ Configuration variables:
- **channel_2** (*Optional*): The configuration options for the 2nd channel. Same options as 1st channel.
- **channel_3** (*Optional*): The configuration options for the 3rd channel. Same options as 1st channel.
- **update_interval** (*Optional*, :ref:`config-time`): The interval to check the sensor. Defaults to ``15s``.
See :ref:`sensor-default_filter`.
- **update_interval** (*Optional*, :ref:`config-time`): The interval to check the sensor. Defaults to ``60s``.
.. figure:: images/ina3221-pins.jpg
:align: center

View File

@ -189,25 +189,6 @@ fahrenheit.
- lambda: return x * (9.0/5.0) + 32.0;
unit_of_measurement: "°F"
.. _sensor-default_filter:
``update_interval`` gotchas
---------------------------
By default, esphomelib takes an average over the last 15 values before publishing updates.
This was done in order to automatically decrease sensor noise.
Therefore if you have an ``update_interval`` of 15 seconds, you will only see the values
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-block:: yaml
# Example configuration entry
sensor:
- platform: adc
# ...
filters: []
Sensor Automation
-----------------

View File

@ -29,15 +29,15 @@ Connect ``GND`` to ``GND``, ``VCC`` to ``3.3V`` and the other three ``MISO`` (or
- platform: max31855
name: "Living Room Temperature"
cs_pin: D2
update_interval: 15s
update_interval: 60s
Configuration variables:
------------------------
- **name** (**Required**, string): The name for the temperature sensor.
- **cs_pin** (**Required**, :ref:`Pin Schema <config-pin_schema>`): The Chip Select pin of the SPI interface.
- **update_interval** (*Optional*, :ref:`config-time`): The interval to check the sensor. Defaults to ``15s``.
See :ref:`sensor-default_filter`.
- **update_interval** (*Optional*, :ref:`config-time`): The interval to check the sensor. Defaults to ``60s``.
- **spi_id** (*Optional*, :ref:`config-id`): Manually specify the ID of the :ref:`SPI Component <spi>` if you want
to use multiple SPI buses.
- **id** (*Optional*, :ref:`config-id`): Manually specify the ID used for code generation.

View File

@ -37,15 +37,15 @@ Connect ``GND`` to ``GND``, ``VCC`` to ``3.3V`` and the other three ``MISO`` (or
- platform: max6675
name: "Living Room Temperature"
cs_pin: D2
update_interval: 15s
update_interval: 60s
Configuration variables:
------------------------
- **name** (**Required**, string): The name for the temperature sensor.
- **cs_pin** (**Required**, :ref:`Pin Schema <config-pin_schema>`): The Chip Select pin of the SPI interface.
- **update_interval** (*Optional*, :ref:`config-time`): The interval to check the sensor. Defaults to ``15s``.
See :ref:`sensor-default_filter`.
- **update_interval** (*Optional*, :ref:`config-time`): The interval to check the sensor. Defaults to ``60s``.
- **spi_id** (*Optional*, :ref:`config-id`): Manually specify the ID of the :ref:`SPI Component <spi>` if you want
to use multiple SPI buses.
- **id** (*Optional*, :ref:`config-id`): Manually specify the ID used for code generation.

View File

@ -36,7 +36,7 @@ TX/RX labels are from the perspective of the MH-Z19). Additionally, you need to
name: "MH-Z19 CO2 Value"
temperature:
name: "MH-Z19 Temperature"
update_interval: 15s
update_interval: 60s
Configuration variables:
------------------------
@ -56,7 +56,7 @@ Configuration variables:
- All other options from :ref:`Sensor <config-sensor>` and :ref:`MQTT Component <config-mqtt-component>`.
- **update_interval** (*Optional*, :ref:`config-time`): The interval to check the
sensor. Defaults to ``15s``. See :ref:`sensor-default_filter`.
sensor. Defaults to ``60s``.
- **uart_id** (*Optional*, :ref:`config-id`): Manually specify the ID of the :ref:`UART Component <uart>` if you want
to use multiple UART buses.

View File

@ -68,8 +68,8 @@ Configuration variables:
:ref:`Sensor <config-sensor>` and :ref:`MQTT Component <config-mqtt-component>`.
- **temperature** (*Optional*): Use the internal temperature of the sensor. All options from
:ref:`Sensor <config-sensor>` and :ref:`MQTT Component <config-mqtt-component>`.
- **update_interval** (*Optional*, :ref:`config-time`): The interval to check the sensor. Defaults to ``15s``.
See :ref:`sensor-default_filter`.
- **update_interval** (*Optional*, :ref:`config-time`): The interval to check the sensor. Defaults to ``60s``.
- **id** (*Optional*, :ref:`config-id`): Manually specify the ID used for code generation.
See Also

View File

@ -33,7 +33,7 @@ required to be set up in your configuration for this sensor to work.
pressure:
name: "Outside Pressure"
address: 0x77
update_interval: 15s
update_interval: 60s
Configuration variables:
------------------------
@ -55,7 +55,7 @@ Configuration variables:
- **address** (*Optional*, int): Manually specify the i^2c address of
the sensor. Defaults to ``0x77``.
- **update_interval** (*Optional*, :ref:`config-time`): The interval to check the
sensor. Defaults to ``15s``. See :ref:`sensor-default_filter`.
sensor. Defaults to ``60s``.
See Also
--------

View File

@ -42,8 +42,8 @@ Configuration variables:
- **internal_filter** (*Optional*, :ref:`config-time`): If a pulse shorter than this
time is detected, its discarded and no pulse is counted. Defaults to ``13us``. On the ESP32,
this value can not be higher than ``13us``, for the ESP8266 you can use larger intervals too.
- **update_interval** (*Optional*, :ref:`config-time`): The interval to check the sensor. Defaults to ``15s``.
See :ref:`sensor-default_filter`.
- **update_interval** (*Optional*, :ref:`config-time`): The interval to check the sensor. Defaults to ``60s``.
- **id** (*Optional*, :ref:`config-id`): Manually specify the ID used for code generation.
- All other options from :ref:`Sensor <config-sensor>` and :ref:`MQTT Component <config-mqtt-component>`.

View File

@ -27,7 +27,7 @@ required to be set up in your configuration for this sensor to work.
humidity:
name: "Living Room Humidity"
address: 0x44
update_interval: 15s
update_interval: 60s
Configuration variables:
------------------------
@ -47,7 +47,7 @@ Configuration variables:
- **address** (*Optional*, int): Manually specify the i^2c address of the sensor.
Defaults to ``0x44``.
- **update_interval** (*Optional*, :ref:`config-time`): The interval to check the
sensor. Defaults to ``15s``. See :ref:`sensor-default_filter`.
sensor. Defaults to ``60s``.
See Also
--------

View File

@ -43,7 +43,7 @@ required to be set up in your configuration for this sensor to work.
gain: 1x
integration_time: 2.4ms
address: 0x29
update_interval: 15s
update_interval: 60s
Configuration variables:
------------------------
@ -66,7 +66,7 @@ Configuration variables:
``2.4ms`` (default), ``24ms``, ``50ms``, ``101ms``, ``154ms``, ``700ms``.
- **address** (*Optional*, int): Manually specify the i^2c address of the sensor. Defaults to ``0x29``.
- **update_interval** (*Optional*, :ref:`config-time`): The interval to check the
sensor. Defaults to ``15s``. See :ref:`sensor-default_filter`.
sensor. Defaults to ``60s``.
See Also
--------

View File

@ -14,13 +14,13 @@ using :ref:`lambdas <config-lambda>`.
sensor:
- platform: template
name: "Template Sensor"
lambda: >-
lambda: |-
if (id(some_binary_sensor).state) {
return 42.0;
} else {
return 0.0;
}
update_interval: 15s
update_interval: 60s
Possible return values for the lambda:
@ -36,7 +36,7 @@ Configuration variables:
- **lambda** (*Optional*, :ref:`lambda <config-lambda>`):
Lambda to be evaluated every update interval to get the new value of the sensor
- **update_interval** (*Optional*, :ref:`config-time`): The interval to check the
sensor. Defaults to ``15s``. See :ref:`sensor-default_filter`.
sensor. Defaults to ``60s``.
- **id** (*Optional*,:ref:`config-id`): Manually specify the ID used for code generation.
- All other options from :ref:`Sensor <config-sensor>` and :ref:`MQTT Component <config-mqtt-component>`.

View File

@ -31,7 +31,7 @@ your configuration for this sensor to work.
- platform: tsl2561
name: "TSL2561 Ambient Light"
address: 0x39
update_interval: 15s
update_interval: 60s
Configuration variables:
------------------------
@ -47,7 +47,7 @@ Configuration variables:
formula for calculating the illuminance in lx. Set this to ``true`` if you're working with a CS
package. Defaults to ``false``.
- **update_interval** (*Optional*, :ref:`config-time`): The interval to check the
sensor. Defaults to ``15s``. See :ref:`sensor-default_filter`.
sensor. Defaults to ``60s``.
- **id** (*Optional*, :ref:`config-id`): Manually specify the ID used for code generation.
- All other options from :ref:`Sensor <config-sensor>` and :ref:`MQTT Component <config-mqtt-component>`.

View File

@ -55,7 +55,7 @@ Configuration variables:
the timeout. Use either this or ``timeout_meter``. Defaults to
11662µs.
- **update_interval** (*Optional*, :ref:`config-time`): The interval to check the
sensor. Defaults to ``15s``. See :ref:`sensor-default_filter`.
sensor. Defaults to ``60s``.
- **id** (*Optional*, :ref:`config-id`): Manually specify the ID used for code generation.
- All other options from :ref:`Sensor <config-sensor>` and :ref:`MQTT Component <config-mqtt-component>`.

View File

@ -18,8 +18,8 @@ Time rollovers are automatically handled.
Configuration variables:
------------------------
- **update_interval** (*Optional*, :ref:`config-time`): The interval to check the sensor. Defaults to ``15s``.
See :ref:`sensor-default_filter`.
- **update_interval** (*Optional*, :ref:`config-time`): The interval to check the sensor. Defaults to ``60s``.
- **id** (*Optional*, :ref:`config-id`): Set the ID of this sensor for use in lambdas.
- All other options from :ref:`Sensor <config-sensor>` and :ref:`MQTT Component <config-mqtt-component>`.

View File

@ -21,14 +21,14 @@ measured in decibels. These values are always negative and the closer they are t
sensor:
- platform: wifi_signal
name: "WiFi Signal Sensor"
update_interval: 15s
update_interval: 60s
Configuration variables:
------------------------
- **name** (**Required**, string): The name of the WiFi signal sensor.
- **update_interval** (*Optional*, :ref:`config-time`): The interval
to check the sensor. Defaults to ``15s``. See :ref:`sensor-default_filter`.
to check the sensor. Defaults to ``60s``.
- **id** (*Optional*, :ref:`config-id`): Manually specify the ID used for code generation.
- All other options from :ref:`Sensor <config-sensor>` and :ref:`MQTT Component <config-mqtt-component>`.

View File

@ -9,7 +9,10 @@ Stepper Component
The ``stepper`` component allows you to use stepper motors with esphomelib.
Currently only the A4988 stepper driver
(`datasheet <https://www.pololu.com/file/0J450/a4988_DMOS_microstepping_driver_with_translator.pdf>`__)
is supported.
and ULN2003 (`datasheet <http://www.ti.com/lit/ds/symlink/uln2003a.pdf>`__) are supported.
A4988 Configuration
-------------------
.. code-block:: yaml
@ -28,7 +31,6 @@ is supported.
Configuration variables:
------------------------
- **id** (**Required**, :ref:`config-id`): Specify the ID of the stepper so that you can control it.
- **step_pin** (**Required**, :ref:`Pin Schema <config-pin_schema>`): The ``STEP`` pin of the A4988
@ -59,6 +61,46 @@ Configuration variables:
number: D1
inverted: True
ULN2003 Configuration
---------------------
.. code-block:: yaml
# Example configuration entry
stepper:
- platform: uln2003
id: my_stepper
pin_a: D0
pin_b: D1
pin_c: D2
pin_d: D3
max_speed: 250 steps/s
# Optional:
acceleration: inf
deceleration: inf
Configuration variables:
- **id** (**Required**, :ref:`config-id`): Specify the ID of the stepper so that you can control it.
- **pin_a**, **pin_b**, **pin_c**, **pin_d** (**Required**, :ref:`Pin Schema <config-pin_schema>`):
The four pins of the stepper control board.
- **sleep_when_done** (*Optional*, boolean): Whether to turn off all coils when the stepper has
reached the target position
- **step_mode** (*Optional*, string): The step mode to operate the motor with. One of:
- ``FULL_STEP`` (Default)
- ``HALF_STEP``
- ``WAVE_DRIVE``
- **max_speed** (**Required**, float): The maximum speed in ``steps/s`` (steps per seconds) to drive the
stepper at. Note most steppers can't step properly with speeds higher than 250 steps/s.
- **acceleration** (*Optional*, float): The acceleration in ``steps/s^2`` (steps per seconds squared)
to use when starting to move. The default is ``inf`` which means infinite acceleration, so the
stepper will try to drive with the full speed immediately.
- **deceleration** (*Optional*, float): The same as ``acceleration``, but for when the motor is decelerating
shortly before reaching the set position. Defaults to ``inf`` (immediate deceleration).
.. _stepper-set_target_action:

View File

@ -28,15 +28,42 @@ Configuration variables:
GPIO pin to use for the switch.
- **name** (**Required**, string): The name for the switch.
- **id** (*Optional*, :ref:`config-id`): Manually specify the ID used for code generation.
- **restore_mode** (*Optional*): Control how the GPIO Switch attempts to restore state on bootup.
- ``RESTORE_DEFAULT_OFF`` (Default) - Attempt to restore state and default to OFF if not possible to restore.
- ``RESTORE_DEFAULT_ON`` - Attempt to restore state and default to ON.
- ``ALWAYS_OFF`` - Always initialize the pin as OFF on bootup.
- ``ALWAYS_ON`` - Always initialize the pin as ON on bootup.
- All other options from :ref:`Switch <config-switch>` and :ref:`MQTT Component <config-mqtt-component>`.
.. note::
To create an active-low switch (one that is turned off by default), use the :ref:`Pin Schema <config-pin_schema>`:
esphomelib will attempt to restore the state of the switch on boot-up and write the value
very early in the boot process.
.. code-block:: yaml
Please note that certain pins can have pull-up/down resistors that activate/deactivate a pin before
esphomelib can initialize them. Please check with a multimeter and use another pin if necessary.
# Example configuration entry
switch:
- platform: gpio
pin:
number: 25
inverted: yes
And to create momentary switches, for example switches that toggle a pin for a moment, use :doc:`template switches <template>`:
.. code-block:: yaml
# Example configuration entry
switch:
- platform: gpio
pin: 25
id: relay
- platform: template
name: "Momentary Switch"
optimistic: yes
turn_on_action:
- switch.turn_on: relay
- delay: 100ms
- switch.turn_off: relay
See Also
--------

View File

@ -69,6 +69,23 @@ This action turns a switch with the given ID off when executed.
then:
- switch.turn_off: relay_1
.. _switch-is_on_condition:
.. _switch-is_off_condition:
``switch.is_on`` / ``switch.is_off`` Condition
**********************************************
This :ref:`Condition <config-condition>` checks if the given switch is ON (or OFF).
.. code-block:: yaml
# In some trigger:
on_...:
if:
condition:
# Same syntax for is_off
switch.is_on: my_switch
lambda calls
************
@ -95,16 +112,16 @@ advanced stuff (see the full :doc:`API Reference </api/cover/index>` for more in
// Switch is OFF, do something else here
}
- ``write_state()``: Manually cause the cover to go into an OFF/ON state from code.
- ``turn_off()``/``turn_on``: Manually turn the switch ON/OFF from code.
Similar to the ``switch.turn_on`` and ``switch.turn_off`` actions,
but can be used in complex lambda expressions.
.. code-block:: yaml
id(my_switch).write_state(false);
id(my_switch).write_state(true);
id(my_switch).turn_off();
id(my_switch).turn_on(true);
// Toggle the switch
id(my_switch).write_state(!id(my_switch).state);
id(my_switch).toggle();
.. _switch-is_on_off_condition:

View File

@ -0,0 +1,35 @@
Homeassistant Text Sensor
=========================
.. seo::
:description: Instructions for setting up homeassistant text sensors with esphomelib that import states from your homeassistant instance.
:image: home-assistant.png
The ``homeassistant`` text sensor platform allows you to create a sensors that import
states from your Home Assistant instance using the :doc:`native API </esphomeyaml/components/api>`.
.. code-block:: yaml
# Example configuration entry
text_sensor:
- platform: homeassistant
name: "Weather Forecast From Home Assistant"
entity_id: sensor.weather_forecast
Configuration variables:
------------------------
- **name** (**Required**, string): The name of the text sensor.
- **entity_id** (**Required**, string): The entity ID to import from Home Assistant.
- **id** (*Optional*,:ref:`config-id`): Manually specify the ID used for code generation.
- All other options from :ref:`Text Sensor <config-text_sensor>` and :ref:`MQTT Component <config-mqtt-component>`.
See Also
--------
- :ref:`sensor-filters`
- :ref:`automation`
- :doc:`API Reference </api/core/native-api>`
- `Edit this page on GitHub <https://github.com/OttoWinter/esphomedocs/blob/current/esphomeyaml/components/text_sensor/homeassistant.rst>`__
.. disqus::

View File

@ -16,7 +16,7 @@ using :ref:`lambdas <config-lambda>`.
name: "Template Text Sensor"
lambda: |-
return {"Hello World"};
update_interval: 15s
update_interval: 60s
Possible return values for the lambda:
@ -32,7 +32,7 @@ Configuration variables:
- **lambda** (*Optional*, :ref:`lambda <config-lambda>`):
Lambda to be evaluated every update interval to get the new value of the text sensor
- **update_interval** (*Optional*, :ref:`config-time`): The interval to check the
text sensor. Defaults to ``15s``. See :ref:`sensor-default_filter`.
text sensor. Defaults to ``60s``.
- **id** (*Optional*,:ref:`config-id`): Manually specify the ID used for code generation.
- All other options from :ref:`Text Sensor <config-text_sensor>` and :ref:`MQTT Component <config-mqtt-component>`.

View File

@ -10,7 +10,35 @@ Time
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 <config-lambda>`.
Currently only sntp (internet-based) time is supported.
Currently only sntp (internet-based) and homeassistant time sources are supported.
Home Assistant Time Source
--------------------------
The preferred way to get time in esphomelib is using Home Assistant.
With the ``homeassistant`` time platform, the :doc:`native API </esphomeyaml/components/api>` connection
to Home Assistant will be used to periodically synchronize the current time.
.. code-block:: yaml
# Example configuration entry
time:
- platform: homeassistant
id: homeassistant_time
Configuration variables:
- **id** (*Optional*, :ref:`config-id`): Specify the ID of the time for use in lambdas.
- **timezone** (*Optional*, string): Manually tell esphomelib 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>. 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.
- **on_time** (*Optional*, :ref:`Automation <automation>`): Automation to run at specific intervals using
a cron-like syntax. See :ref:`time-on_time`.
SNTP Configuration
------------------
.. code-block:: yaml
@ -19,11 +47,9 @@ Currently only sntp (internet-based) time is supported.
- platform: sntp
id: sntp_time
Configuration variables:
------------------------
- **id** (**Required**, :ref:`config-id`): Specify the ID of the time for use in lambdas.
- **id** (*Optional*, :ref:`config-id`): Specify the ID of the time for use in lambdas.
- **timezone** (*Optional*, string): Manually tell esphomelib 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>.
esphomeyaml tries to automatically infer the timezone string based on the timezone of the computer that is running
@ -33,12 +59,6 @@ Configuration variables:
- **on_time** (*Optional*, :ref:`Automation <automation>`): Automation to run at specific intervals using
a cron-like syntax. See :ref:`time-on_time`.
.. note::
To use the automatic timezone detection you will need to have the python ``tzlocal`` package installed.
If you're running this as a Hass.io add-on or with the official esphomeyaml docker image, it should already
be installed. Otherwise you need to install it using ``pip2 install tzlocal``.
Use In Lambdas
--------------

View File

@ -34,6 +34,8 @@ Configuration variables:
of the WiFi access point your device should connect to.
- **password** (*Optional*, string): The password (or PSK) for your
WiFi network. Leave empty for no password.
- **networks** (*Optional*): Configure multiple WiFi networks to connect to, the best one
that is reachable will be connected to. See :ref:`wifi-networks`.
- **manual_ip** (*Optional*): Manually configure the static IP of the node.
- **static_ip** (*Required*, IPv4 address): The static IP of your node.
@ -127,6 +129,38 @@ please also try ``light``.
# ...
power_save_mode: none
.. _wifi-networks:
Connecting to Multiple Networks
-------------------------------
Starting with version 1.10.0, you can give esphomelib a number of WiFi networks to connect to.
Esphomelib will then attempt to connect to the one with the highest signal strength.
To enable this mode, remove the ``ssid`` and ``password`` options from your wifi configuration
and move everything under the ``networks`` key:
.. code-block:: yaml
# Example configuration entry
wifi:
networks:
- ssid: FirstNetworkToConnectTo
password: VerySafePassword
- ssid: SecondNetworkToConnectTo
password: VerySafePassword
# Other options
# ...
Configuration variables:
- **ssid** (string): The SSID or WiFi network name.
- **password** (string): The password to use for authentication. Leave empty for no password.
- **channel** (int): The channel of the network (1-14). If given, only connects to networks
that are on this channel.
- **bssid** (string): Optionally define a BSSID (MAC-Address) of the network to connect to.
This can be used to further restrict which networks to connect to.
See Also
--------

View File

@ -49,7 +49,7 @@ configuration file 😀
name: "Multisensor Brightness"
unit_of_measurement: lux
filters:
- lambda: >-
- lambda: |-
return (x / 10000.0) * 2000000.0;
binary_sensor:

View File

@ -29,7 +29,7 @@ and convert those voltage measurements to illuminance values in lux using a form
name: "TEMT6000 Illuminance"
unit_of_measurement: lx
filters:
- lambda: >-
- lambda: |-
return (x / 10000.0) * 2000000.0;
.. figure:: images/temt6000-pins.jpg

View File

@ -175,7 +175,7 @@ first:
cover:
- platform: template
name: Living Room Cover
lambda: !lambda >-
lambda: !lambda |-
if (id(top_end_stop).state) {
return cover::COVER_OPEN;
} else {
@ -189,14 +189,14 @@ name lambda is used instead of Home Assistant's "template" lingo to avoid confus
shy away from using lambdas because you just hear C++ and think oh noes, I'm not going down *that* road:
Writing lambdas is not that hard! Here's a bit of a primer:
First, you might have already wondered what the ``lambda: !lambda >-`` part is supposed to mean. ``!lambda``
First, you might have already wondered what the ``lambda: !lambda |-`` part is supposed to mean. ``!lambda``
tells esphomeyaml that the following block is supposed to be interpreted as a lambda, or C++ code. Note that
here, the ``lambda:`` key would actually implicitly make the following block a lambda so in this context,
you could have just written ``lambda: >-``.
you could have just written ``lambda: |-``.
Next, there's the weird ``>-`` character combination. This effectively tells the YAML parser to treat the following
Next, there's the weird ``|-`` character combination. This effectively tells the YAML parser to treat the following
**indented** (!) block as plaintext. Without it, the YAML parser would attempt to read the following block as if
it were made up of YAML keys like ``cover:`` for example. (You may also have seen variations of this like ``|-``
it were made up of YAML keys like ``cover:`` for example. (You may also have seen variations of this like ``>-``
or just ``|`` or ``>``. There's a slight difference in how these different styles deal with whitespace, but for our
purposes we can ignore that).
@ -245,7 +245,7 @@ if you have a light and want to set it to a pre-defined color when a button is p
transition_length: 0.5s
red: 0.8
green: 1.0
blue: !lambda >-
blue: !lambda |-
// 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;
@ -253,7 +253,6 @@ if you have a light and want to set it to a pre-defined color when a button is p
Every parameter in actions that has the label "templatable" in the docs can be templated like above, using
all of the usual lambda syntax.
.. _config-globals:
Bonus 2: Global Variables
@ -312,19 +311,11 @@ in the :doc:`wifi component </esphomeyaml/components/wifi>` and :doc:`mqtt compo
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_value_range <sensor-on_value_range>`
- :ref:`sensor.on_raw_value <sensor-on_raw_value>`
- :ref:`binary_sensor.on_press <binary_sensor-on_press>`
- :ref:`binary_sensor.on_release <binary_sensor-on_release>`
- :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:`esphomeyaml.on_boot <esphomeyaml-on_boot>`
- :ref:`esphomeyaml.on_shutdown <esphomeyaml-on_shutdown>`
- :ref:`esphomeyaml.on_loop <esphomeyaml-on_loop>`
- :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:`esphomeyaml.on_boot <esphomeyaml-on_boot>` / :ref:`esphomeyaml.on_shutdown <esphomeyaml-on_shutdown>` / :ref:`esphomeyaml.on_loop <esphomeyaml-on_loop>`
- :ref:`pn532.on_tag <pn532-on_tag>`
All Actions
@ -332,42 +323,28 @@ All Actions
- :ref:`delay <delay_action>`
- :ref:`lambda <lambda_action>`
- :ref:`if <if_action>`
- :ref:`while <while_action>`
- :ref:`if <if_action>` / :ref:`while <while_action>`
- :ref:`component.update <component-update_action>`
- :ref:`script.execute <script-execute_action>`
- :ref:`script.stop <script-stop_action>`
- :ref:`script.execute <script-execute_action>` / :ref:`script.stop <script-stop_action>`
- :ref:`logger.log <logger-log_action>`
- :ref:`mqtt.publish <mqtt-publish_action>`
- :ref:`mqtt.publish_json <mqtt-publish_json_action>`
- :ref:`switch.toggle <switch-toggle_action>`
- :ref:`switch.turn_off <switch-turn_off_action>`
- :ref:`switch.turn_on <switch-turn_on_action>`
- :ref:`light.toggle <light-toggle_action>`
- :ref:`light.turn_off <light-turn_off_action>`
- :ref:`light.turn_on <light-turn_on_action>`
- :ref:`cover.open <cover-open_action>`
- :ref:`cover.close <cover-close_action>`
- :ref:`cover.stop <cover-stop_action>`
- :ref:`fan.toggle <fan-toggle_action>`
- :ref:`fan.turn_off <fan-turn_off_action>`
- :ref:`fan.turn_on <fan-turn_on_action>`
- :ref:`output.turn_off <output-turn_off_action>`
- :ref:`output.turn_on <output-turn_on_action>`
- :ref:`output.set_level <output-set_level_action>`
- :ref:`deep_sleep.enter <deep_sleep-enter_action>`
- :ref:`deep_sleep.prevent <deep_sleep-prevent_action>`
- :ref:`homeassistant.service <api-homeassistant_service_action>`
- :ref:`mqtt.publish <mqtt-publish_action>` / :ref:`mqtt.publish_json <mqtt-publish_json_action>`
- :ref:`switch.toggle <switch-toggle_action>` / :ref:`switch.turn_off <switch-turn_off_action>` / :ref:`switch.turn_on <switch-turn_on_action>`
- :ref:`light.toggle <light-toggle_action>` / :ref:`light.turn_off <light-turn_off_action>` / :ref:`light.turn_on <light-turn_on_action>`
- :ref:`cover.open <cover-open_action>` / :ref:`cover.close <cover-close_action>` / :ref:`cover.stop <cover-stop_action>`
- :ref:`fan.toggle <fan-toggle_action>` / :ref:`fan.turn_off <fan-turn_off_action>` / :ref:`fan.turn_on <fan-turn_on_action>`
- :ref:`output.turn_off <output-turn_off_action>` / :ref:`output.turn_on <output-turn_on_action>` / :ref:`output.set_level <output-set_level_action>`
- :ref:`deep_sleep.enter <deep_sleep-enter_action>` / :ref:`deep_sleep.prevent <deep_sleep-prevent_action>`
.. _config-condition:
All Conditions
--------------
- :ref:`and <and_condition>`
- :ref:`or <or_condition>`
- :ref:`lambda <lambda_condition>`
- :ref:`binary_sensor.is_on / binary_sensor.is_off <binary_sensor-is_on_off_condition>`
- :ref:`switch.is_on / switch.is_off <switch-is_on_off_condition>`
- :ref:`and <and_condition>` / :ref:`or <or_condition>`
- :ref:`binary_sensor.is_on <binary_sensor-is_on_condition>` / :ref:`binary_sensor.is_off <binary_sensor-is_off_condition>`
- :ref:`switch.is_on <switch-is_on_condition>` / :ref:`switch.is_off <switch-is_off_condition>`
- :ref:`sensor.in_range <sensor-in_range_condition>`
.. _delay_action:
@ -407,6 +384,45 @@ This action executes an arbitrary piece of C++ code (see :ref:`Lambda <config-la
- lambda: |-
id(some_binary_sensor).publish_state(false);
.. _lambda_condition:
``lambda`` Condition
--------------------
This condition performs an arbitrary piece of C++ code (see :ref:`Lambda <config-lambda>`)
and can be used to create conditional flow in actions.
.. code-block:: yaml
on_...:
then:
- if:
condition:
# Should return either true or false
lambda: |-
return id(some_sensor).state < 30;
# ...
.. _and_condition:
.. _or_condition:
``and`` / ``or`` Condition
--------------------------
Check a combination of conditions
.. code-block:: yaml
on_...:
then:
- if:
condition:
# Same syntax for and
or:
- binary_sensor.is_on: some_binary_sensor
- binary_sensor.is_on: other_binary_sensor
# ...
.. _if_action:
``if`` Action
@ -428,17 +444,17 @@ turns on a light for 5 seconds. Otherwise, the light is turned off immediately.
condition:
lambda: 'return id(some_sensor).state < 30;'
then:
- lambda: 'ESP_LOGD("main", "The sensor value is below 30!");
- logger.log: "The sensor value is below 30!"
- light.turn_on: my_light
- delay: 5s
else:
- lambda: 'ESP_LOGD("main", "The sensor value is above 30!");
- logger.log: "The sensor value is above 30!"
- light.turn_off: my_light
Configuration options:
- **if** (**Required**, :ref:`config-condition`): The condition to check which branch to take.
- **condition** (**Required**, :ref:`config-condition`): The condition to check which branch to take. See :ref:`Conditions <config-condition>`.
- **then** (*Optional*, :ref:`config-action`): The action to perform if the condition evaluates to true.
Defaults to doing nothing.
- **else** (*Optional*, :ref:`config-action`): The action to perform if the condition evaluates to false.
@ -449,36 +465,25 @@ Configuration options:
``while`` Action
----------------
This actions repeats a sequence of actions until a condition is no longer met.
For example, below you can see a configuration that will blink an LED as long as a template
switch is on.
This action is similar to the :ref:`if <if_action>` Action. The ``while`` action executes
a block until a given condition evaluates to false.
.. code-block:: yaml
switch:
- platform: gpio
pin: D1
id: blinking_pin
- platform: template
name: Blink LED
id: blink
optimistic: true
turn_on_action:
# In a trigger:
on_...:
- while:
condition:
switch.is_on: blink
binary_sensor.is_on: some_binary_sensor
then:
- switch.turn_on: blinking_pin
- delay: 500ms
- switch.turn_off: blinking_pin
- delay: 500ms
- logger.log: "Still executing"
- light.toggle: some_light
- delay: 5s
Configuration options:
- **if** (**Required**, :ref:`config-condition`): The condition to check whether to continue evaluation.
- **then** (**Optional**, :ref:`config-action`): The action to perform if the condition evaluates to true.
- **condition** (**Required**): The condition to check whether to execute. See :ref:`Conditions <config-condition>`.
- **then** (**Required**, :ref:`config-action`): The action to perform until the condition evaluates to false.
.. _component-update_action:
@ -531,8 +536,9 @@ execute the script with a single call.
``script.stop`` Action
----------------------
This action allows you to stop a given script during execution. Please note this is only
useful right now if your script contains a ``delay`` action.
This action allows you to stop a given script during execution. If the
script is not running, does nothing.
Please note this is only useful right now if your script contains a ``delay`` action.
.. code-block:: yaml
@ -549,66 +555,6 @@ useful right now if your script contains a ``delay`` action.
then:
- script.stop: my_script
.. _and_condition:
``and`` Condition
-----------------
This condition passes if and only if all of the conditions pass.
.. code-block:: yaml
# in a trigger:
on_...:
if:
condition:
and:
- condition_a:
- condition_b:
then:
- script.execute: my_script
.. _or_condition:
``or`` Condition
----------------
This condition passes if at least one condition passes.
.. code-block:: yaml
# in a trigger:
on_...:
if:
condition:
or:
- condition_a:
- condition_b:
then:
- script.execute: my_script
.. _lambda_condition:
``lambda`` Condition
--------------------
This condition passes if the given :ref:`lambda <config-lambda>` returns ``true``.
.. code-block:: yaml
# in a trigger:
on_...:
if:
condition:
lambda: |-
if (id(my_sensor).value > 30.0) {
return true;
} else {
return false;
}
then:
- script.execute: my_script
See Also
--------

View File

@ -146,28 +146,32 @@ There are several ways of doing this. See below examples to see how you can spec
Substitutions
-------------
If you're using many ESPs in your home and have many similar configuration files, it can
be cumbersome to keep all files up to date. There are already some ways to minimize
repeating yourself in the configuration using the ``!include`` and ``!secret`` YAML
directives.
If you want to go one step further and reduce duplication even further, you can use
``substitutions`` in esphomeyaml's config. Substitutions allow you define top-level
variables which are then replaced everywhere in your configuration which are then
substituted with their value using the bash-style ``${}`` syntax.
Starting with version 1.10.0, esphomeyaml has a powerful new way to reduce repetition in configuration files:
Substitutions. With substitutions, you can have a single generic source file for all nodes of one kind and
substitute expressions in.
.. code-block:: yaml
substitutions:
devicename: livingroom
upper_devicename: Livingroom
esphomeyaml:
name: $devicename
name: $livingroom
# ...
switch:
- platform: ...
name: ${devicename} switch
sensor:
- platform: dht
# ...
temperature:
name: ${upper_devicename} Temperature
humidity:
name: ${upper_devicename} Humidity
In the top-level ``substitutions`` section, you can put as many key-value pairs as you want. Before
validating your configuration, esphomeyaml will automatically replace all occurrences of substitutions
by their value. The syntax for a substitution is based on bash and is case-sensitive: ``$substitution_key`` or
``${substitution_key}`` (same)
See Also
--------

View File

@ -39,6 +39,8 @@ Tips for using esphomeyaml
6. You can view the full command line interface options here: :doc:`/esphomeyaml/guides/cli`
7. Use :ref:`substitutions <config-substitutions>` to reduce repetition in your configuration files.
.. |secret| replace:: ``!secret``
.. _secret: https://www.home-assistant.io/docs/configuration/secrets/
.. |include| replace:: ``!include``

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

View File

@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="24" height="24" viewBox="0 0 24 24"><path d="M7,15H9V18H11V15H13V18H15V15H17V18H19V9H15V6H9V9H5V18H7V15M4.38,3H19.63C20.94,3 22,4.06 22,5.38V19.63A2.37,2.37 0 0,1 19.63,22H4.38C3.06,22 2,20.94 2,19.63V5.38C2,4.06 3.06,3 4.38,3Z" /></svg>

After

Width:  |  Height:  |  Size: 477 B

View File

@ -23,12 +23,15 @@ Guides
Getting Started through Command Line, guides/getting_started_command_line, console.svg
Getting Started through Hass.io Add-On, guides/getting_started_hassio, home-assistant.svg
Configuration Types, guides/configuration-types, settings.svg
Migrating from Sonoff-Tasmota, guides/migrate_sonoff_tasmota, tasmota.svg
Migrating from ESPurna, guides/migrate_espurna, espurna.svg
Migrating from ESPEasy, guides/migrate_espeasy, espeasy.svg
Automations, guides/automations, auto-fix.svg
FAQ and Tips, guides/faq, question_answer.svg
Contributing, guides/contributing, github-circle.svg
Changelog, changelog/index, new-box.svg
.. _devices:
@ -45,9 +48,11 @@ These are only the devices for which I've had the time to set up dedicated guide
Generic ESP8266, devices/esp8266, esp8266.svg
Generic ESP32, devices/esp32, esp32.svg
NodeMCU ESP8266, devices/nodemcu_esp8266, nodemcu_esp8266.jpg
NodeMCU ESP32, devices/nodemcu_esp32, nodemcu_esp32.jpg
Sonoff S20, devices/sonoff_s20, sonoff_s20.jpg
Sonoff 4CH, devices/sonoff_4ch, sonoff_4ch.jpg
Generic Sonoff, devices/sonoff, sonoff.svg
Sonoff Basic, devices/sonoff_basic, sonoff_basic.jpg
@ -59,12 +64,16 @@ Core Components
Core, components/esphomeyaml, cloud-circle.svg
WiFi, components/wifi, network-wifi.svg
MQTT, components/mqtt, mqtt.png
I²C Bus, components/i2c, i2c.svg
SPI Bus, components/spi, spi.svg
UART Bus, components/uart, uart.svg
OTA Updates, components/ota, system-update.svg
Logger, components/logger, file-document-box.svg
Web Server, components/web_server, http.svg
Native API, components/api, server-network.svg
Power Supply, components/power_supply, power.svg
Deep Sleep, components/deep_sleep, hotel.svg
@ -76,6 +85,7 @@ Sensor Components
Sensor Core, components/sensor/index, folder-open.svg
ADC, components/sensor/adc, flash.svg
ADS1115, components/sensor/ads1115, ads1115.jpg
APDS9960, components/sensor/apds9960, apds9960.jpg
BH1750, components/sensor/bh1750, bh1750.jpg
BLE RSSI, components/sensor/ble_rssi, bluetooth.svg
BME280, components/sensor/bme280, bme280.jpg
@ -91,6 +101,7 @@ Sensor Components
HDC1080, components/sensor/hdc1080, hdc1080.jpg
HLW8012, components/sensor/hlw8012, hlw8012.svg
HMC5883L, components/sensor/hmc5883l, hmc5883l.jpg
Home Assistant, components/sensor/homeassistant, home-assistant.svg
HX711, components/sensor/hx711, hx711.jpg
INA219, components/sensor/ina219, ina219.jpg
INA3221, components/sensor/ina3221, ina3221.jpg
@ -159,13 +170,17 @@ Light Components
Light Core, components/light/index, folder-open.svg
Binary Light, components/light/binary, lightbulb.svg
Monochromatic Light, components/light/monochromatic, brightness-medium.svg
Cold+Warm White Light, components/light/cwww, brightness-medium.svg
RGB Light, components/light/rgb, rgb.png
RGBW Light, components/light/rgbw, rgbw.png
RGBWW Light, components/light/rgbww, rgbw.png
FastLED Clockless Light, components/light/fastled_clockless, color_lens.svg
FastLED SPI Light, components/light/fastled_spi, color_lens.svg
NeoPixelBus Light, components/light/neopixelbus, color_lens.svg
Looking for WS2811 and similar individually addressable lights? Have a look at the
:doc:`FastLED Clockless Light <components/light/fastled_clockless>`.
@ -221,6 +236,7 @@ Text Sensor Components
.. imgtable::
Text Sensor Core, components/text_sensor/index, folder-open.svg
Home Assistant, components/text_sensor/homeassistant, home-assistant.svg
MQTT Subscribe Text, components/text_sensor/mqtt_subscribe, mqtt.png
Version, components/text_sensor/version, new-box.svg
Template Text Sensor, components/text_sensor/template, description.svg
@ -247,6 +263,7 @@ Misc Components
Time, components/time, clock-outline.svg
Stepper, components/stepper/index, stepper.svg
MY9231/MY9291 LED driver, components/my9231, my9231.svg
ESP32 Ethernet, components/ethernet, ethernet.svg
Additional Custom Components
----------------------------