Initial commit 🎉

This commit is contained in:
Otto Winter 2018-05-13 11:37:02 +02:00
commit 07ddde788c
No known key found for this signature in database
GPG Key ID: DB66C0BE6013F97E
182 changed files with 9032 additions and 0 deletions

4
.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
_doxyxml
_build
.python-version

2482
Doxygen Normal file

File diff suppressed because it is too large Load Diff

40
Makefile Normal file
View File

@ -0,0 +1,40 @@
# Minimal makefile for Sphinx documentation
#
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
SPHINXPROJ = esphomelib
SOURCEDIR = .
BUILDDIR = _build
ESPHOMELIB_PATH = ../esphomelib
html:
# ESPHOMELIB_PATH=$(ESPHOMELIB_PATH) doxygen Doxygen
$(SPHINXBUILD) -M html "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
cleanhtml:
rm -rf "$(BUILDDIR)/html/*" _doxyxml/
minifyhtml: html
./minify.sh
deploy: cleanhtml html minifyhtml
touch "$(BUILDDIR)/html/.nojekyll"
echo "esphomelib.com" >"$(BUILDDIR)/html/CNAME"
cd "$(BUILDDIR)/html" && git add --all && git commit -m "Deploy to gh-pages"
@printf "Run \033[0;36mcd $(BUILDDIR)/html && git push origin gh-pages\033[0m to deploy\n"
help:
$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
webserver: html
cd "$(BUILDDIR)/html" && python3 -m http.server
.PHONY: help Makefile
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

0
_static/.keep Normal file
View File

21
_static/custom.css Normal file
View File

@ -0,0 +1,21 @@
.row-odd {
background-color: #f3f6f6;
}
tr.row-even > td {
text-align: center;
}
img.component-image {
border: none;
vertical-align: middle;
display: block;
margin-left: auto;
margin-right: auto;
width: 100%;
height: 85px;
object-fit: contain;
}
table.docutils {
width: 100%;
}

417
_static/webserver-v1.css Normal file
View File

@ -0,0 +1,417 @@
/* Based off of https://github.com/sindresorhus/github-markdown-css */
.markdown-body {
-ms-text-size-adjust: 100%;
-webkit-text-size-adjust: 100%;
line-height: 1.5;
color: #24292e;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
font-size: 16px;
line-height: 1.5;
word-wrap: break-word;
}
.markdown-body a {
background-color: transparent;
}
.markdown-body a:active,
.markdown-body a:hover {
outline-width: 0;
}
.markdown-body strong {
font-weight: bolder;
}
.markdown-body h1 {
font-size: 2em;
margin: 0.67em 0;
}
.markdown-body img {
border-style: none;
}
.markdown-body pre {
font-family: monospace, monospace;
font-size: 1em;
}
.markdown-body hr {
box-sizing: content-box;
height: 0;
overflow: visible;
}
.markdown-body input {
font: inherit;
margin: 0;
}
.markdown-body input {
overflow: visible;
}
.markdown-body [type="checkbox"] {
box-sizing: border-box;
padding: 0;
}
.markdown-body * {
box-sizing: border-box;
}
.markdown-body input {
font-family: inherit;
font-size: inherit;
line-height: inherit;
}
.markdown-body a {
color: #0366d6;
text-decoration: none;
}
.markdown-body a:hover {
text-decoration: underline;
}
.markdown-body strong {
font-weight: 600;
}
.markdown-body hr {
height: 0;
margin: 15px 0;
overflow: hidden;
background: transparent;
border: 0;
border-bottom: 1px solid #dfe2e5;
}
.markdown-body hr::before {
display: table;
content: "";
}
.markdown-body hr::after {
display: table;
clear: both;
content: "";
}
.markdown-body table {
border-spacing: 0;
border-collapse: collapse;
}
.markdown-body td,
.markdown-body th {
padding: 0;
}
.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
margin-top: 0;
margin-bottom: 0;
}
.markdown-body h1 {
font-size: 32px;
font-weight: 600;
}
.markdown-body h2 {
font-size: 24px;
font-weight: 600;
}
.markdown-body h3 {
font-size: 20px;
font-weight: 600;
}
.markdown-body h4 {
font-size: 16px;
font-weight: 600;
}
.markdown-body h5 {
font-size: 14px;
font-weight: 600;
}
.markdown-body h6 {
font-size: 12px;
font-weight: 600;
}
.markdown-body p {
margin-top: 0;
margin-bottom: 10px;
}
.markdown-body blockquote {
margin: 0;
}
.markdown-body ul,
.markdown-body ol {
padding-left: 0;
margin-top: 0;
margin-bottom: 0;
}
.markdown-body ol ol,
.markdown-body ul ol {
list-style-type: lower-roman;
}
.markdown-body ul ul ol,
.markdown-body ul ol ol,
.markdown-body ol ul ol,
.markdown-body ol ol ol {
list-style-type: lower-alpha;
}
.markdown-body dd {
margin-left: 0;
}
.markdown-body pre {
margin-top: 0;
margin-bottom: 0;
font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;
font-size: 12px;
}
.markdown-body::before {
display: table;
content: "";
}
.markdown-body::after {
display: table;
clear: both;
content: "";
}
.markdown-body>*:first-child {
margin-top: 0 !important;
}
.markdown-body>*:last-child {
margin-bottom: 0 !important;
}
.markdown-body a:not([href]) {
color: inherit;
text-decoration: none;
}
.markdown-body p,
.markdown-body blockquote,
.markdown-body ul,
.markdown-body ol,
.markdown-body dl,
.markdown-body table,
.markdown-body pre {
margin-top: 0;
margin-bottom: 16px;
}
.markdown-body hr {
height: 0.25em;
padding: 0;
margin: 24px 0;
background-color: #e1e4e8;
border: 0;
}
.markdown-body blockquote {
padding: 0 1em;
color: #6a737d;
border-left: 0.25em solid #dfe2e5;
}
.markdown-body blockquote>:first-child {
margin-top: 0;
}
.markdown-body blockquote>:last-child {
margin-bottom: 0;
}
.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
margin-top: 24px;
margin-bottom: 16px;
font-weight: 600;
line-height: 1.25;
}
.markdown-body h1 {
padding-bottom: 0.3em;
font-size: 2em;
border-bottom: 1px solid #eaecef;
}
.markdown-body h2 {
padding-bottom: 0.3em;
font-size: 1.5em;
border-bottom: 1px solid #eaecef;
}
.markdown-body h3 {
font-size: 1.25em;
}
.markdown-body h4 {
font-size: 1em;
}
.markdown-body h5 {
font-size: 0.875em;
}
.markdown-body h6 {
font-size: 0.85em;
color: #6a737d;
}
.markdown-body ul,
.markdown-body ol {
padding-left: 2em;
}
.markdown-body ul ul,
.markdown-body ul ol,
.markdown-body ol ol,
.markdown-body ol ul {
margin-top: 0;
margin-bottom: 0;
}
.markdown-body li {
word-wrap: break-all;
}
.markdown-body li>p {
margin-top: 16px;
}
.markdown-body li+li {
margin-top: 0.25em;
}
.markdown-body dl {
padding: 0;
}
.markdown-body dl dt {
padding: 0;
margin-top: 16px;
font-size: 1em;
font-style: italic;
font-weight: 600;
}
.markdown-body dl dd {
padding: 0 16px;
margin-bottom: 16px;
}
.markdown-body table {
display: block;
width: 100%;
overflow: auto;
}
.markdown-body table th {
font-weight: 600;
}
.markdown-body table th,
.markdown-body table td {
padding: 6px 13px;
border: 1px solid #dfe2e5;
}
.markdown-body table tr {
background-color: #fff;
border-top: 1px solid #c6cbd1;
}
.markdown-body table tr:nth-child(2n) {
background-color: #f6f8fa;
}
.markdown-body img {
max-width: 100%;
box-sizing: content-box;
background-color: #fff;
}
.markdown-body img[align=right] {
padding-left: 20px;
}
.markdown-body img[align=left] {
padding-right: 20px;
}
.markdown-body pre {
padding: 16px;
overflow: auto;
font-size: 85%;
line-height: 1.45;
background-color: #f6f8fa;
border-radius: 3px;
word-wrap: normal;
}
.markdown-body :checked+.radio-label {
position: relative;
z-index: 1;
border-color: #0366d6;
}
.markdown-body hr {
border-bottom-color: #eee;
}
#log .v {
color: #888888;
}
#log .d {
color: #00DDDD;
}
#log .c {
color: magenta;
}
#log .i {
color: limegreen;
}
#log .w {
color: yellow;
}
#log .e {
color: red;
font-weight: bold;
}
#log {
background-color: #1c1c1c;
}

59
_static/webserver-v1.js Normal file
View File

@ -0,0 +1,59 @@
const source = new EventSource("/events");
source.addEventListener('log', function (e) {
const log = document.getElementById("log");
let klass = '';
if (e.data.startsWith("")) {
klass = 'e';
} else if (e.data.startsWith("")) {
klass = 'w';
} else if (e.data.startsWith("")) {
klass = 'i';
} else if (e.data.startsWith("")) {
klass = 'c';
} else if (e.data.startsWith("")) {
klass = 'd';
} else if (e.data.startsWith("")) {
klass = 'v';
} else {
log.innerHTML += e.data + '\n';
}
log.innerHTML += '<span class="' + klass + '">' + e.data.substr(7, e.data.length - 10) + "</span>\n";
});
source.addEventListener('state', function (e) {
const data = JSON.parse(e.data);
document.getElementById(data.id).children[1].innerText = data.state;
});
const states = document.getElementById("states");
let i = 0, row;
for (; row = states.rows[i]; i++) {
if (row.classList.contains("switch")) {
(function(id) {
row.children[2].children[0].addEventListener('click', function (e) {
const xhr = new XMLHttpRequest();
xhr.open("POST", '/switch/' + id.substr(7) + '/toggle', true);
xhr.send();
});
})(row.id);
}
if (row.classList.contains("fan")) {
(function(id) {
row.children[2].children[0].addEventListener('click', function (e) {
const xhr = new XMLHttpRequest();
xhr.open("POST", '/fan/' + id.substr(4) + '/toggle', true);
xhr.send();
});
})(row.id);
}
if (row.classList.contains("light")) {
(function(id) {
row.children[2].children[0].addEventListener('click', function (e) {
const xhr = new XMLHttpRequest();
xhr.open("POST", '/light/' + id.substr(6) + '/toggle', true);
xhr.send();
});
})(row.id);
}
}

2
_static/webserver-v1.min.css vendored Normal file
View File

@ -0,0 +1,2 @@
/* Based off of https://github.com/sindresorhus/github-markdown-css */
.markdown-body{-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%;line-height:1.5;color:#24292e;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";font-size:16px;line-height:1.5;word-wrap:break-word}.markdown-body a{background-color:transparent}.markdown-body a:active,.markdown-body a:hover{outline-width:0}.markdown-body strong{font-weight:bolder}.markdown-body h1{font-size:2em;margin:0.67em 0}.markdown-body img{border-style:none}.markdown-body pre{font-family:monospace,monospace;font-size:1em}.markdown-body hr{box-sizing:content-box;height:0;overflow:visible}.markdown-body input{font:inherit;margin:0}.markdown-body input{overflow:visible}.markdown-body [type="checkbox"]{box-sizing:border-box;padding:0}.markdown-body *{box-sizing:border-box}.markdown-body input{font-family:inherit;font-size:inherit;line-height:inherit}.markdown-body a{color:#0366d6;text-decoration:none}.markdown-body a:hover{text-decoration:underline}.markdown-body strong{font-weight:600}.markdown-body hr{height:0;margin:15px 0;overflow:hidden;background:transparent;border:0;border-bottom:1px solid #dfe2e5}.markdown-body hr::before{display:table;content:""}.markdown-body hr::after{display:table;clear:both;content:""}.markdown-body table{border-spacing:0;border-collapse:collapse}.markdown-body td,.markdown-body th{padding:0}.markdown-body h1,.markdown-body h2,.markdown-body h3,.markdown-body h4,.markdown-body h5,.markdown-body h6{margin-top:0;margin-bottom:0}.markdown-body h1{font-size:32px;font-weight:600}.markdown-body h2{font-size:24px;font-weight:600}.markdown-body h3{font-size:20px;font-weight:600}.markdown-body h4{font-size:16px;font-weight:600}.markdown-body h5{font-size:14px;font-weight:600}.markdown-body h6{font-size:12px;font-weight:600}.markdown-body p{margin-top:0;margin-bottom:10px}.markdown-body blockquote{margin:0}.markdown-body ul,.markdown-body ol{padding-left:0;margin-top:0;margin-bottom:0}.markdown-body ol ol,.markdown-body ul ol{list-style-type:lower-roman}.markdown-body ul ul ol,.markdown-body ul ol ol,.markdown-body ol ul ol,.markdown-body ol ol ol{list-style-type:lower-alpha}.markdown-body dd{margin-left:0}.markdown-body pre{margin-top:0;margin-bottom:0;font-family:"SFMono-Regular",Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px}.markdown-body::before{display:table;content:""}.markdown-body::after{display:table;clear:both;content:""}.markdown-body>*:first-child{margin-top:0!important}.markdown-body>*:last-child{margin-bottom:0!important}.markdown-body a:not([href]){color:inherit;text-decoration:none}.markdown-body p,.markdown-body blockquote,.markdown-body ul,.markdown-body ol,.markdown-body dl,.markdown-body table,.markdown-body pre{margin-top:0;margin-bottom:16px}.markdown-body hr{height:0.25em;padding:0;margin:24px 0;background-color:#e1e4e8;border:0}.markdown-body blockquote{padding:0 1em;color:#6a737d;border-left:0.25em solid #dfe2e5}.markdown-body blockquote>:first-child{margin-top:0}.markdown-body blockquote>:last-child{margin-bottom:0}.markdown-body h1,.markdown-body h2,.markdown-body h3,.markdown-body h4,.markdown-body h5,.markdown-body h6{margin-top:24px;margin-bottom:16px;font-weight:600;line-height:1.25}.markdown-body h1{padding-bottom:0.3em;font-size:2em;border-bottom:1px solid #eaecef}.markdown-body h2{padding-bottom:0.3em;font-size:1.5em;border-bottom:1px solid #eaecef}.markdown-body h3{font-size:1.25em}.markdown-body h4{font-size:1em}.markdown-body h5{font-size:0.875em}.markdown-body h6{font-size:0.85em;color:#6a737d}.markdown-body ul,.markdown-body ol{padding-left:2em}.markdown-body ul ul,.markdown-body ul ol,.markdown-body ol ol,.markdown-body ol ul{margin-top:0;margin-bottom:0}.markdown-body li{word-wrap:break-all}.markdown-body li>p{margin-top:16px}.markdown-body li+li{margin-top:0.25em}.markdown-body dl{padding:0}.markdown-body dl dt{padding:0;margin-top:16px;font-size:1em;font-style:italic;font-weight:600}.markdown-body dl dd{padding:0 16px;margin-bottom:16px}.markdown-body table{display:block;width:100%;overflow:auto}.markdown-body table th{font-weight:600}.markdown-body table th,.markdown-body table td{padding:6px 13px;border:1px solid #dfe2e5}.markdown-body table tr{background-color:#fff;border-top:1px solid #c6cbd1}.markdown-body table tr:nth-child(2n){background-color:#f6f8fa}.markdown-body img{max-width:100%;box-sizing:content-box;background-color:#fff}.markdown-body img[align=right]{padding-left:20px}.markdown-body img[align=left]{padding-right:20px}.markdown-body pre{padding:16px;overflow:auto;font-size:85%;line-height:1.45;background-color:#f6f8fa;border-radius:3px;word-wrap:normal}.markdown-body:checked+.radio-label{position:relative;z-index:1;border-color:#0366d6}.markdown-body hr{border-bottom-color:#eee}#log .v{color:#888}#log .d{color:#0DD}#log .c{color:magenta}#log .i{color:limegreen}#log .w{color:yellow}#log .e{color:red;font-weight:bold}#log{background-color:#1c1c1c}

1
_static/webserver-v1.min.js vendored Normal file
View File

@ -0,0 +1 @@
const source=new EventSource("/events");source.addEventListener("log",function(a){const b=document.getElementById("log");let c="";a.data.startsWith("\x1B[1;31m")?c="e":a.data.startsWith("\x1B[0;33m")?c="w":a.data.startsWith("\x1B[0;32m")?c="i":a.data.startsWith("\x1B[0;35m")?c="c":a.data.startsWith("\x1B[0;36m")?c="d":a.data.startsWith("\x1B[0;37m")?c="v":b.innerHTML+=a.data+"\n",b.innerHTML+="<span class=\""+c+"\">"+a.data.substr(7,a.data.length-10)+"</span>\n"}),source.addEventListener("state",function(a){const b=JSON.parse(a.data);document.getElementById(b.id).children[1].innerText=b.state});const states=document.getElementById("states");for(let a,b=0;a=states.rows[b];b++)a.classList.contains("switch")&&function(b){a.children[2].children[0].addEventListener("click",function(){const a=new XMLHttpRequest;a.open("POST","/switch/"+b.substr(7)+"/toggle",!0),a.send()})}(a.id),a.classList.contains("fan")&&function(b){a.children[2].children[0].addEventListener("click",function(){const a=new XMLHttpRequest;a.open("POST","/fan/"+b.substr(4)+"/toggle",!0),a.send()})}(a.id),a.classList.contains("light")&&function(b){a.children[2].children[0].addEventListener("click",function(){const a=new XMLHttpRequest;a.open("POST","/light/"+b.substr(6)+"/toggle",!0),a.send()})}(a.id);

View File

@ -0,0 +1,31 @@
ESP32 Touch Binary Sensor
=========================
Example Usage
-------------
.. code-block:: cpp
auto *touch = App.make_esp32_touch_component();
touch->set_setup_mode(true);
touch->set_iir_filter(1000);
App.register_binary_sensor(touch_hub->make_touch_pad("ESP32 Touch Pad 9", TOUCH_PAD_NUM9, 1000));
.. cpp:namespace:: esphomelib
See :cpp:func:`Application::make_esp32_touch_component`.
API Reference
-------------
.. cpp:namespace:: nullptr
.. doxygenclass:: binary_sensor::ESP32TouchComponent
:members:
:protected-members:
:undoc-members:
.. doxygenclass:: binary_sensor::ESP32TouchBinarySensor
:members:
:protected-members:
:undoc-members:

View File

@ -0,0 +1,26 @@
GPIO Binary Sensor
==================
Example Usage
-------------
.. code-block:: cpp
// Basic
App.make_gpio_binary_sensor("Window Open", 36);
// Custom pinMode
App.make_gpio_binary_sensor("Window Open", GPIOInputPin(36, INPUT_PULLUP));
.. cpp:namespace:: esphomelib
See :cpp:func:`Application::make_gpio_binary_sensor`.
API Reference
-------------
.. cpp:namespace:: nullptr
.. doxygenclass:: binary_sensor::GPIOBinarySensorComponent
:members:
:protected-members:
:undoc-members:

View File

@ -0,0 +1,56 @@
Binary Sensor
=============
.. cpp:namespace:: binary_sensor
In esphomelib, every component that exposes a binary state, is a :cpp:class:`BinarySensor`.
To create your own binary sensor, simply subclass :cpp:class:`BinarySensor` and call
:cpp:func:`BinarySensor::publish_state` to tell the frontend that you have a new state.
Inversion is automatically done for you when publishing state and can be changed by the
user with :cpp:func:`BinarySensor::set_inverted`.
Supported Binary Sensors
------------------------
.. toctree::
GPIO Binary Sensor <gpio>
Node Status Binary Sensor <status>
ESP32 Touch Binary Sensor <esp32_touch>
Example Usage
-------------
.. code-block:: cpp
// Basic
App.register_binary_sensor(custom_binary_sensor);
// GPIO Binary Sensor
App.make_gpio_binary_sensor("Window Open", 36);
.. cpp:namespace:: esphomelib
See :cpp:func:`Application::register_binary_sensor` and :cpp:func:`Application::make_gpio_binary_sensor`.
API Reference
-------------
.. cpp:namespace:: nullptr
BinarySensor
************
.. doxygenclass:: binary_sensor::BinarySensor
:members:
:protected-members:
:undoc-members:
MQTTBinarySensorComponent
*************************
.. doxygenclass:: binary_sensor::MQTTBinarySensorComponent
:members:
:protected-members:
:undoc-members:

View File

@ -0,0 +1,26 @@
Node Status Binary Sensor
=========================
This binary sensor platform allows you to create a switch that uses the birth and last will
messages by the MQTT client to show an ON/OFF state of the node.
Example Usage
-------------
.. code-block:: cpp
App.make_status_binary_sensor("Livingroom Node Status");
.. cpp:namespace:: esphomelib
See :cpp:func:`Application::make_status_binary_sensor`.
API Reference
-------------
.. cpp:namespace:: nullptr
.. doxygenclass:: binary_sensor::StatusBinarySensor
:members:
:protected-members:
:undoc-members:

38
api/core/application.rst Normal file
View File

@ -0,0 +1,38 @@
Application
===========
.. cpp:namespace:: esphomelib
The :cpp:class:`Application` class has two objectives: 1. handle all of
your :cpp:class:`Component`\ s and 2. provide helper methods to simplify creating a component.
.. cpp:namespace:: Application
In itself, an Application instance doesn't do and store very much. It mostly only keeps track of all Components
(using an internal :cpp:func:`std::vector` containing pointers), so that when the user calls the :cpp:func:`setup` or
:cpp:func:`loop` methods, it can relay those calls to the components.
In order for the Application to know about your components, each one of them should be registered using the
:cpp:func:`register_component` call. And for subclasses of MQTTComponent, :cpp:func:`register_mqtt_component`
shall be used.
Apart from the helpers, only one function is really necessary for setting up the Application instance:
:cpp:func:`set_name`. The name provided by this is used throughout the code base to construct various strings
such as MQTT topics or WiFi hostnames. Additionally, some one-time-setup components such as MQTT or WiFi can be
initialized with the `init_` calls. Next, this class provides a bunch of helper methods to create and
register components easily using the `make_` calls.
Each component can tell the Application with which *priority* it wishes to be called using the `get_loop_priority()`
and `get_setup_priority()` overrides. The Application will then automatically order the components before execution.
API Reference
-------------
.. cpp:namespace:: nullptr
.. doxygenclass:: Application
:members:
:protected-members:
:undoc-members:
.. doxygenvariable:: App

34
api/core/component.rst Normal file
View File

@ -0,0 +1,34 @@
Component
=========
.. cpp:namespace:: Component
Every object that should be handled by the Application instance and receive :cpp:func:`setup` and
:cpp:func:`loop` calls must be a subclass of :cpp:class:`Component`.
API Reference
-------------
.. cpp:namespace:: nullptr
Component
*********
.. doxygenclass:: Component
:members:
:protected-members:
:undoc-members:
PollingComponent
****************
.. doxygenclass:: PollingComponent
:members:
:protected-members:
:undoc-members:
Setup Priorities
****************
.. doxygennamespace:: setup_priority

25
api/core/controller.rst Normal file
View File

@ -0,0 +1,25 @@
Controller
==========
.. cpp:namespace:: Controller
API Reference
-------------
.. cpp:namespace:: nullptr
Controller
**********
.. doxygenclass:: Component
:members:
:protected-members:
:undoc-members:
StoringController
*****************
.. doxygenclass:: StoringController
:members:
:protected-members:
:undoc-members:

17
api/core/deep-sleep.rst Normal file
View File

@ -0,0 +1,17 @@
Deep Sleep
==========
.. cpp:namespace:: DeepSleepComponent
API Reference
-------------
.. cpp:namespace:: nullptr
DeepSleepComponent
******************
.. doxygenclass:: DeepSleepComponent
:members:
:protected-members:
:undoc-members:

135
api/core/helpers.rst Normal file
View File

@ -0,0 +1,135 @@
Helpers
=======
esphomelib uses a bunch of helpers to make the library easier to use.
API Reference
-------------
helpers.h
*********
.. doxygentypedef:: json_parse_t
.. doxygentypedef:: json_build_t
.. doxygenvariable:: HOSTNAME_CHARACTER_WHITELIST
.. doxygenfunction:: get_mac_address
.. doxygenfunction:: generate_hostname
.. doxygenfunction:: sanitize_hostname
.. doxygenfunction:: truncate_string
.. doxygenfunction:: is_empty
.. doxygenfunction:: reboot
.. doxygenfunction:: add_shutdown_hook
.. doxygenfunction:: safe_reboot
.. doxygenfunction:: add_safe_shutdown_hook
.. doxygenfunction:: to_lowercase_underscore
.. doxygenfunction:: build_json
.. doxygenfunction:: parse_json
.. doxygenfunction:: clamp
.. doxygenfunction:: lerp
.. doxygenfunction:: make_unique
.. doxygenfunction:: random_uint32
.. doxygenfunction:: random_double
.. doxygenfunction:: random_float
.. doxygenfunction:: gamma_correct
.. doxygenfunction:: value_accuracy_to_string
.. doxygenfunction:: uint64_to_string
.. doxygenfunction:: uint32_to_string
.. doxygenfunction:: sanitize_string_whitelist
.. doxygenfunction:: disable_interrupts
.. doxygenfunction:: enable_interrupts
.. doxygenfunction:: crc8
.. doxygenclass:: Optional
:members:
:protected-members:
:undoc-members:
.. doxygenfunction:: parse_on_off
.. doxygenclass:: SlidingWindowMovingAverage
:members:
:protected-members:
:undoc-members:
.. doxygenclass:: ExponentialMovingAverage
:members:
:protected-members:
:undoc-members:
.. doxygenclass:: CallbackManager
:members:
:protected-members:
:undoc-members:
ESPPreferences
**************
.. doxygenclass:: ESPPreferences
:members:
:protected-members:
:undoc-members:
.. doxygenvariable:: global_preferences
esphal.h
********
This header should be used whenever you want to access some `digitalRead`, `digitalWrite`, ... methods.
.. doxygenclass:: GPIOPin
:members:
:protected-members:
:undoc-members:
.. doxygenclass:: GPIOOutputPin
:members:
:protected-members:
:undoc-members:
.. doxygenclass:: GPIOInputPin
:members:
:protected-members:
:undoc-members:
ESPOneWire
**********
esphomelib has its own implementation of OneWire, because the implementation in the Arduino libraries
seems to have lots of timing issues with the ESP8266/ESP32. That's why ESPOneWire was created.
.. doxygenclass:: ESPOneWire
:members:
:protected-members:
:undoc-members:
defines.h
*********
.. doxygenfile:: esphomelib/defines.h

20
api/core/i2c.rst Normal file
View File

@ -0,0 +1,20 @@
I2CComponent
============
To make i2c devices easier to implement in esphomelib, there's a special I2CComponent implementing
a bunch of i2c helper functions on top of the Arduino Wire library. It is also the preferred way
of using i2c peripherals since it implements timeouts, verbose logs for debugging issues, and
for the ESP32 the ability to have multiple i2c busses in operation at the same time.
API Reference
-------------
.. doxygenclass:: I2CComponent
:members:
:protected-members:
:undoc-members:
.. doxygenclass:: I2CDevice
:members:
:protected-members:
:undoc-members:

18
api/core/index.rst Normal file
View File

@ -0,0 +1,18 @@
Core
====
.. toctree::
:maxdepth: 1
Application <application>
Component <component>
WiFi <wifi>
MQTT Client <mqtt>
Over-The-Air Updates <ota>
Helpers <helpers>
Logging Engine <log>
Power Supply <power-supply>
Controller <controller>
Web Server <web-server>
Deep Sleep <deep-sleep>
I2C <i2c>

23
api/core/log.rst Normal file
View File

@ -0,0 +1,23 @@
Logging Engine
==============
esphomelib will by default log to both Serial (with baudrate 115200).
API Reference
-------------
.. doxygendefine:: ESPHOMELIB_LOG_LEVEL_NONE
.. doxygendefine:: ESPHOMELIB_LOG_LEVEL_ERROR
.. doxygendefine:: ESPHOMELIB_LOG_LEVEL_WARN
.. doxygendefine:: ESPHOMELIB_LOG_LEVEL_INFO
.. doxygendefine:: ESPHOMELIB_LOG_LEVEL_DEBUG
.. doxygendefine:: ESPHOMELIB_LOG_LEVEL_VERBOSE
.. doxygendefine:: ESPHOMELIB_LOG_LEVEL_VERY_VERBOSE
LogComponent
************
.. doxygenclass:: LogComponent
:members:
:protected-members:
:undoc-members:

60
api/core/mqtt.rst Normal file
View File

@ -0,0 +1,60 @@
MQTT Client
===========
.. cpp:namespace:: mqtt
API Reference
-------------
.. cpp:namespace:: nullptr
MQTTClientComponent
*******************
.. doxygenclass:: mqtt::MQTTClientComponent
:members:
:protected-members:
:undoc-members:
.. doxygentypedef:: mqtt::mqtt_callback_t
.. doxygenstruct:: mqtt::MQTTMessage
:members:
:protected-members:
:undoc-members:
.. doxygenstruct:: mqtt::MQTTSubscription
:members:
:protected-members:
:undoc-members:
.. doxygenstruct:: mqtt::MQTTCredentials
:members:
:protected-members:
:undoc-members:
.. doxygenstruct:: mqtt::Availability
:members:
:protected-members:
:undoc-members:
.. doxygenstruct:: mqtt::MQTTDiscoveryInfo
:members:
:protected-members:
:undoc-members:
.. doxygenvariable:: mqtt::global_mqtt_client
MQTTComponent
*************
.. doxygenclass:: mqtt::MQTTComponent
:members:
:protected-members:
:undoc-members:
.. doxygenstruct:: mqtt::SendDiscoveryConfig
:members:
:protected-members:
:undoc-members:

34
api/core/ota.rst Normal file
View File

@ -0,0 +1,34 @@
Over-The-Air Updates
====================
Example Usage
-------------
.. code-block:: cpp
// Setup basic OTA
App.init_ota();
// Enable safe mode.
App.init_ota()->start_safe_mode();
// OTA password
auto *ota = App.init_ota();
ota->set_auth_plaintext_password("VERY_SECURE");
ota->start_safe_mode();
// OTA MD5 password
auto *ota = App.init_ota();
ota->set_auth_password_hash("761d3a8c46989f1d357842e8dedf7712");
ota->start_safe_mode();
API Reference
-------------
.. cpp:namespace:: nullptr
OTAComponent
************
.. doxygenclass:: OTAComponent
:members:
:protected-members:
:undoc-members:

25
api/core/power-supply.rst Normal file
View File

@ -0,0 +1,25 @@
Power Supply
============
Example Usage
-------------
.. code-block:: cpp
// Basic
auto *power_supply = App.make_power_supply(12);
// Inverted, for ATX
auto *atx = App.make_power_supply(GPIOOutputPin(12, OUTPUT, true));
API Reference
-------------
.. cpp:namespace:: nullptr
PowerSupplyComponent
********************
.. doxygenclass:: PowerSupplyComponent
:members:
:protected-members:
:undoc-members:

17
api/core/web-server.rst Normal file
View File

@ -0,0 +1,17 @@
Web Server
==========
API Reference
-------------
.. cpp:namespace:: nullptr
.. doxygenclass:: WebServer
:members:
:protected-members:
:undoc-members:
.. doxygenstruct:: UrlMatch
:members:
:protected-members:
:undoc-members:

37
api/core/wifi.rst Normal file
View File

@ -0,0 +1,37 @@
WiFi
====
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
-------------
.. cpp:namespace:: nullptr
WiFiComponent
*************
.. doxygenclass:: WiFiComponent
:members:
:protected-members:
:undoc-members:
.. doxygenstruct:: ManualIP
:members:
:protected-members:
:undoc-members:

65
api/fan/index.rst Normal file
View File

@ -0,0 +1,65 @@
Fan
====
.. cpp:namespace:: fan
Fans in esphomelib are implemented like lights. Both the hardware and the MQTT frontend
access a combined :cpp:class:`FanState` object and use only that to set state and receive
state updates.
Example Usage
-------------
.. code-block:: cpp
// Basic
auto fan = App.make_fan("Fan");
fan.output->set_binary(App.make_gpio_output(34));
// Speed
auto speed_fan = App.make_fan("Speed Fan");
fan.output->set_speed(App.make_ledc_output(34));
// Oscillation
auto oscillating_fan = App.make_fan("Oscillating Fan");
oscillating_fan.output->set_binary(App.make_gpio_output(34));
oscillating_fan.output->set_oscillation(App.make_gpio_output(35));
.. cpp:namespace:: esphomelib
See :cpp:func:`Application::make_fan`.
API Reference
-------------
.. cpp:namespace:: nullptr
FanState
********
.. doxygenclass:: fan::FanState
:members:
:protected-members:
:undoc-members:
FanTraits
*********
.. doxygenclass:: fan::FanTraits
:members:
:protected-members:
:undoc-members:
BasicFanComponent
*****************
.. doxygenclass:: fan::BasicFanComponent
:members:
:protected-members:
:undoc-members:
MQTTFanComponent
****************
.. doxygenclass:: fan::MQTTFanComponent
:members:
:protected-members:
:undoc-members:

14
api/index.rst Normal file
View File

@ -0,0 +1,14 @@
API Reference
=============
.. toctree::
:maxdepth: 2
Core <core/index>
Sensor <sensor/index>
Binary Sensor <binary_sensor/index>
Output <output/index>
Fan <fan/index>
Light <light/index>
Switch <switch/index>
Miscellaneous <misc/index>

113
api/light/index.rst Normal file
View File

@ -0,0 +1,113 @@
Light
=====
.. cpp:namespace:: light
Lights in esphomelib are implemented like fans. Both the hardware and the MQTT frontend
access a combined :cpp:class:`LightState` object and use only that to set state and receive
state updates.
Example Usage
-------------
.. code-block:: cpp
// Binary
App.make_binary_light("Desk Lamp", App.make_gpio_output(15));
// Brightness-only
App.make_monochromatic_light("Kitchen Lights", App.make_ledc_output(16));
// RGB, see output for information how to setup individual channels.
App.make_rgb_light("RGB Lights", red, green, blue);
App.make_rgbw_light("RGBW Lights", red, green, blue, white);
.. cpp:namespace:: esphomelib
See :cpp:func:`Application::make_binary_light`, :cpp:func:`Application::make_monochromatic_light`,
:cpp:func:`Application::make_rgb_light`, :cpp:func:`Application::make_rgbw_light`.
API Reference
-------------
.. cpp:namespace:: nullptr
LightColorValues
****************
.. doxygenclass:: light::LightColorValues
:members:
:protected-members:
:undoc-members:
LightEffect
***********
.. doxygenclass:: light::LightEffect
:members:
:protected-members:
:undoc-members:
.. doxygenclass:: light::NoneLightEffect
:members:
:protected-members:
:undoc-members:
.. doxygenclass:: light::RandomLightEffect
:members:
:protected-members:
:undoc-members:
LightOutput
***********
.. doxygenclass:: light::LightOutput
:members:
:protected-members:
:undoc-members:
.. doxygenclass:: light::LinearLightOutputComponent
:members:
:protected-members:
:undoc-members:
LightState
**********
.. doxygenclass:: light::LightState
:members:
:protected-members:
:undoc-members:
LightTraits
***********
.. doxygenclass:: light::LightTraits
:members:
:protected-members:
:undoc-members:
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:
MQTTJSONLightComponent
**********************
.. doxygenclass:: light::MQTTJSONLightComponent
:members:
:protected-members:
:undoc-members:

View File

@ -0,0 +1,37 @@
ESP32 Bluetooth Low Energy Tracker
==================================
Example Usage
-------------
.. code-block:: cpp
auto *tracker = App.make_esp32_ble_tracker();
// MAC address AC:37:43:77:5F:4C
App.register_binary_sensor(tracker->make_device("ESP32 Bluetooth Beacon", {
0xAC, 0x37, 0x43, 0x77, 0x5F, 0x4C
}));
.. cpp:namespace:: esphomelib
See :cpp:func:`Application::make_esp32_ble_tracker`.
API Reference
-------------
.. cpp:namespace:: nullptr
.. doxygenenum:: PCF8574GPIOMode
.. doxygenclass:: ESP32BLETracker
:members:
:protected-members:
:undoc-members:
.. doxygenclass:: ESP32BLEDevice
:members:
:protected-members:
:undoc-members:
.. doxygenvariable:: global_esp32_ble_tracker
.. doxygenvariable:: semaphore_scan_end

6
api/misc/index.rst Normal file
View File

@ -0,0 +1,6 @@
Miscellaneous Components
========================
.. toctree::
PCF8574 <pcf8574>
ESP32 Bluetooth Low Energy Tracker <esp32_ble_tracker>

44
api/misc/pcf8574.rst Normal file
View File

@ -0,0 +1,44 @@
PCF8574 I/O Expander
====================
The PCF8574 component allows you to use PCF8574 and PCF8575 I/O port expanders with many of
esphomelib's components. With most components, you are able to specify GPIOOutputPin or
GPIOInputPin for internal pins. The PCF8574 component subclasses those types.
Example Usage
-------------
.. code-block:: cpp
auto *pcf8574 = App.make_pcf8574_component(0x21);
App.make_gpio_binary_sensor("PCF pin 0 sensor", pcf8574->make_input_pin(0, PCF8574_INPUT));
App.make_gpio_binary_sensor("PCF pin 0 sensor", 0);
App.make_gpio_switch("PCF pin 1 switch", pcf8574->make_output_pin(1));
auto *out = App.make_gpio_output(pcf8574->make_output_pin(2));
App.make_binary_light("PCF pin 2 light", out);
.. cpp:namespace:: esphomelib
See :cpp:func:`Application::make_pcf8574_component`.
API Reference
-------------
.. cpp:namespace:: nullptr
.. doxygenenum:: PCF8574GPIOMode
.. doxygenclass:: io::PCF8574Component
:members:
:protected-members:
:undoc-members:
.. doxygenclass:: io::PCF8574GPIOInputPin
:members:
:protected-members:
:undoc-members:
.. doxygenclass:: io::PCF8574GPIOOutputPin
:members:
:protected-members:
:undoc-members:

View File

@ -0,0 +1,35 @@
ESP8266 Software PWM
====================
Software PWM for the ESP8266. Warning: This is a *software* PWM and therefore can have noticeable flickering.
Additionally, this software PWM can't output values higher than 80%. That's a known limitation.
Example Usage
-------------
.. code-block:: cpp
// Basic
auto *output = App.make_esp8266_pwm_output(D2);
// Create a brightness-only light with it:
App.make_monochromatic_light("Desk Lamp", output);
// Advanced: Setting a custom frequency globally
analogWriteFreq(500);
.. cpp:namespace:: esphomelib
See :cpp:func:`Application::make_esp8266_pwm_output`.
API Reference
-------------
.. cpp:namespace:: nullptr
ESP8266PWMOutput
****************
.. doxygenclass:: output::ESP8266PWMOutput
:members:
:protected-members:
:undoc-members:

View File

@ -0,0 +1,29 @@
GPIO Binary Output
==================
Example Usage
-------------
.. code-block:: cpp
// Create a binary output, *not a switch*
App.make_gpio_output(33);
// Custom pinMode
App.make_gpio_output(GPIOOutputPin(33, OUTPUT_OPEN_DRAIN));
.. cpp:namespace:: esphomelib
See :cpp:func:`Application::make_gpio_output` (and :cpp:func:`Application::make_gpio_switch`).
API Reference
-------------
.. cpp:namespace:: nullptr
GPIOBinaryOutputComponent
*************************
.. doxygenclass:: output::GPIOBinaryOutputComponent
:members:
:protected-members:
:undoc-members:

31
api/output/index.rst Normal file
View File

@ -0,0 +1,31 @@
Output
======
The `output` namespace contains all peripheral output components.
.. toctree::
GPIO Binary Output <gpio-binary>
LEDC PWM Output <ledc>
PCA9685 Output <pca9685>
ESP8266 Software PWM <esp8266-pwm>
API Reference
-------------
.. cpp:namespace:: nullptr
BinaryOutput
************
.. doxygenclass:: output::BinaryOutput
:members:
:protected-members:
:undoc-members:
FloatOutput
***********
.. doxygenclass:: output::FloatOutput
:members:
:protected-members:
:undoc-members:

31
api/output/ledc.rst Normal file
View File

@ -0,0 +1,31 @@
ESP32 LEDC Output
=================
Example Usage
-------------
.. code-block:: cpp
// Basic
App.make_ledc_output(33);
// Custom Frequency
App.make_ledc_output(33, 2000.0);
.. cpp:namespace:: esphomelib
See :cpp:func:`Application::make_ledc_output`.
API Reference
-------------
.. cpp:namespace:: nullptr
LEDCOutputComponent
*******************
.. doxygenclass:: output::LEDCOutputComponent
:members:
:protected-members:
:undoc-members:
.. doxygenvariable:: output::next_ledc_channel

31
api/output/pca9685.rst Normal file
View File

@ -0,0 +1,31 @@
PCA9685 PWM
===========
FloatOutput support for an `PCA9695 16-Channel PWM Driver`_.
Example Usage
-------------
.. code-block:: cpp
// Create the PCA9685 Output hub with frequency 500Hz.
auto *pca9685 = App.make_pca9685_component(500.0f);
.. cpp:namespace:: esphomelib
See :cpp:func:`Application::make_pca9685_component`.
API Reference
-------------
.. cpp:namespace:: nullptr
PCA9685OutputComponent
**********************
.. doxygenclass:: output::PCA9685OutputComponent
:members:
:protected-members:
:undoc-members:
.. _PCA9695 16-Channel PWM Driver: https://www.adafruit.com/product/815

31
api/sensor/adc-sensor.rst Normal file
View File

@ -0,0 +1,31 @@
ADC Sensor
==========
Example Usage
-------------
.. code-block:: cpp
// Basic
App.make_adc_sensor("Analog Voltage", 13);
// Custom update interval 30 seconds
App.make_adc_sensor("Analog Voltage", 13, 30000);
// Custom pinMode
App.make_adc_sensor("Analog Voltage", GPIOInputPin(13, INPUT_PULLUP));
// ESP32: Attenuation
auto adc = App.make_adc_sensor("Analog Voltage", 13);
adc.adc.set_attenuation(ADC_11db);
.. cpp:namespace:: esphomelib
See :cpp:func:`Application::make_adc_sensor`.
API Reference
-------------
.. cpp:namespace:: nullptr
.. doxygenclass:: sensor::ADCSensorComponent
:members:
:protected-members:
:undoc-members:

59
api/sensor/ads1115.rst Normal file
View File

@ -0,0 +1,59 @@
ADS1115 ADC Component
=====================
.. warning:: This sensor is experimental has not been tested yet. If you can verify it works, notify me on discord.
.. cpp:namespace:: input
This class allows using ADS1115 Analog to Digital converters (`datasheet`_, `adafruit`_) devices with esphomelib.
Doing so requires some steps:
.. _datasheet: http://www.ti.com/lit/ds/symlink/ads1115.pdf
.. _adafruit: https://www.adafruit.com/product/1085
.. cpp:namespace:: sensor::ADS1115Component
1. Initialize the i2c bus with the pins you have SDA and SCL connected to:
.. code-block:: cpp
// inside setup()
App.init_i2c(SDA_PIN, SCL_PIN);
2. Create the "hub" or the ADS1115 device itself. The parameter you pass in here is the i2c
address of the ADS1115. See :cpp:func:`set_address` for possible other addresses.
.. code-block:: cpp
// after init_i2c
auto *ads1115 = App.make_ads1115_component(0x48);
This will create an ADS1115 component which you can now use to create individual sensors.
3. Create the sensors, you can have multiple of these. Do so by calling :cpp:func:`get_sensor` with
the multiplexer channel you want (essentially between which pins you want to measure voltage) and
the gain for that sensor and register that sensor.
.. code-block:: cpp
auto *sensor = ads1115->get_sensor("ADS1115 Voltage #1", ADS1115_MUX_P0_N1, ADS1115_PGA_6P144);
App.register_sensor(sensor);
.. cpp:namespace:: esphomelib
See :cpp:func:`Application::make_ads1115_component`.
API Reference
-------------
.. cpp:namespace:: nullptr
.. doxygenclass:: sensor::ADS1115Component
:members:
:protected-members:
:undoc-members:
.. doxygenclass:: sensor::ADS1115Sensor
:members:
:protected-members:
:undoc-members:

39
api/sensor/bh1750.rst Normal file
View File

@ -0,0 +1,39 @@
BH1750 Ambient Light Sensor
===========================
.. warning::
This sensor is experimental has not been tested yet. If you can verify it works (or if it doesn't),
notify me on discord.
The BH1750 sensor allows you to use your BH1750 i2c-enabled ambient light sensor with
esphomelib (`datasheet <http://www.mouser.com/ds/2/348/bh1750fvi-e-186247.pdf>`__).
It requires i2c to be setup to work.
Example Usage
-------------
.. code-block:: cpp
// Basic
auto bh1750 = App.make_bh1750_sensor("BH1750 Illuminance");
// Advanced settings
// default resolution is 0.5 LX
bh1750.bh1750->set_resolution(sensor::BH1750_RESOLUTION_1P0_LX);
.. cpp:namespace:: esphomelib
See :cpp:func:`Application::make_bh1750_sensor`.
API Reference
-------------
.. cpp:namespace:: nullptr
.. doxygenclass:: sensor::BH1750Sensor
:members:
:protected-members:
:undoc-members:
.. doxygenenum:: sensor::BH1750Resolution

52
api/sensor/bme280.rst Normal file
View File

@ -0,0 +1,52 @@
BME280 Temperature/Pressure/Humidity Sensor
===========================================
.. warning::
This sensor is experimental has not been tested yet. If you can verify it works (or if it doesn't),
notify me on discord.
The BME280 sensor allows you to use your BME280 i2c-enabled temperature+pressure+humidity sensor with
esphomelib (`datasheet <https://cdn-shop.adafruit.com/datasheets/BST-BME280_DS001-10.pdf>`__,
`adafruit <https://www.adafruit.com/product/2652>`__). It requires i2c to be setup to work.
Example Usage
-------------
.. code-block:: cpp
// Basic
auto bme280 = App.make_bme280_sensor("BME280 Temperature", "BME280 Pressure", "BME280 Humidity");
// Advanced settings
// set infinite impulse response filter, default is OFF.
bme280.bme280->set_iir_filter(sensor::BME280_IIR_FILTER_4X);
// set over value sampling, default is 16x
bme280.bme280->set_temperature_oversampling(sensor::BME280_OVERSAMPLING_16X);
bme280.bme280->set_humidity_oversampling(sensor::BME280_OVERSAMPLING_4X);
bme280.bme280->set_pressure_oversampling(sensor::BME280_OVERSAMPLING_16X);
.. cpp:namespace:: esphomelib
See :cpp:func:`Application::make_bme280_sensor`.
API Reference
-------------
.. doxygenclass:: sensor::BME280Component
:members:
:protected-members:
:undoc-members:
.. doxygenenum:: sensor::BME280Oversampling
.. doxygenenum:: sensor::BME280IIRFilter
.. doxygentypdef:: sensor::BME280TemperatureSensor
.. doxygentypdef:: sensor::BME280PressureSensor
.. doxygentypdef:: sensor::BME280HumiditySensor
.. doxygenstruct:: sensor::BME280CalibrationData
:members:
:protected-members:
:undoc-members:

After

Width:  |  Height:  |  Size: 1.6 KiB

53
api/sensor/bme680.rst Normal file
View File

@ -0,0 +1,53 @@
BME680 Temperature/Pressure/Humidity/Gas Sensor
===============================================
.. warning::
This sensor is experimental has not been tested yet. If you can verify it works (or if it doesn't),
notify me on discord.
The BME680 sensor allows you to use your BME680 i2c-enabled temperature+pressure+humidity+gas
sensor with esphomelib (`datasheet <https://cdn-shop.adafruit.com/product-files/3660/BME680.pdf>`__,
`adafruit <https://www.adafruit.com/product/3660>`__). It requires i2c to be setup to work.
Example Usage
-------------
.. code-block:: cpp
// Basic
auto bme680 = App.make_bme680_sensor("BME680 Temperature",
"BME680 Pressure",
"BME680 Humidity",
"BME680 Gas Resistance");
// default is no iir filter
bme680.bme680->set_iir_filter(sensor::BME680_IIR_FILTER_15X);
// set heater to 200°C for 100ms, default is off
bme680.bme680->set_heater(200, 100);
.. cpp:namespace:: esphomelib
See :cpp:func:`Application::make_bme680_sensor`.
API Reference
-------------
.. doxygenclass:: sensor::BME680Component
:members:
:protected-members:
:undoc-members:
.. doxygenenum:: sensor::BME680Oversampling
.. doxygenenum:: sensor::BME680IIRFilter
.. doxygentypdef:: sensor::BME680TemperatureSensor
.. doxygentypdef:: sensor::BME680PressureSensor
.. doxygentypdef:: sensor::BME680HumiditySensor
.. doxygentypdef:: sensor::BME2680GasResistanceSensor
.. doxygenstruct:: sensor::BME680CalibrationData
:members:
:protected-members:
:undoc-members:

After

Width:  |  Height:  |  Size: 1.6 KiB

36
api/sensor/bmp085.rst Normal file
View File

@ -0,0 +1,36 @@
BMP085 Pressure/Temperature Sensor
==================================
The BMP085 component allows you get the temperature and pressure from your BMP085
(`datasheet <https://www.sparkfun.com/datasheets/Components/General/BST-BMP085-DS000-05.pdf>`_,
`adafruit <https://www.adafruit.com/product/391>`_), BMP180
(`datasheet <https://cdn-shop.adafruit.com/datasheets/BST-BMP180-DS000-09.pdf>`_,
`adafruit <https://www.adafruit.com/product/1603>`_) and BMP280
(`datasheet <https://cdn-shop.adafruit.com/datasheets/BST-BMP280-DS001-11.pdf>`_,
`adafruit <https://www.adafruit.com/product/2651>`_) sensors with esphomelib. To use these
i2c-based devices, first initialize the i2c bus using the pins you have for SDA and SCL and
then create the sensors themselves as in below example.
Example Usage
-------------
.. code-block:: cpp
// inside setup()
App.init_i2c(SDA_PIN, SCL_PIN); // change these values for your pins.
// create sensors
App.make_bmp085_sensor("Outside Temperature", "Outside Pressure");
.. cpp:namespace:: esphomelib
See :cpp:func:`Application::make_bmp085_sensor`.
API Reference
-------------
.. cpp:namespace:: nullptr
.. doxygenclass:: sensor::BMP085Component
:members:
:protected-members:
:undoc-members:

After

Width:  |  Height:  |  Size: 1.2 KiB

45
api/sensor/dallas.rst Normal file
View File

@ -0,0 +1,45 @@
Dallas Component
================
.. cpp:namespace:: input
This class allows using Dallas (DS18b20) devices with esphomelib. You first have to
create a hub or bus where all sensors are connected to (:cpp:class:`DallasComponent`).
.. cpp:namespace:: sensor::DallasComponent
Next, use :cpp:func:`get_sensor_by_address` and :cpp:func:`get_sensor_by_index` to get
individual sensors. You can get the addresses of dallas sensors by observing the log output
at startup time.
Example Usage
-------------
.. code-block:: cpp
// Bus setup
auto *dallas = App.make_dallas_component(15);
// By address
App.register_sensor(dallas->get_sensor_by_address("Ambient Temperature", 0xfe0000031f1eaf29));
// By index
App.register_sensor(dallas->get_sensor_by_index("Ambient Temperature", 0));
.. cpp:namespace:: esphomelib
See :cpp:func:`Application::make_dallas_component` and :cpp:func:`Application::register_sensor`.
API Reference
-------------
.. cpp:namespace:: nullptr
.. doxygenclass:: sensor::DallasComponent
:members:
:protected-members:
:undoc-members:
.. doxygenclass:: sensor::DallasTemperatureSensor
:members:
:protected-members:
:undoc-members:

24
api/sensor/dht.rst Normal file
View File

@ -0,0 +1,24 @@
DHT Temperature/Humidity Sensor
===============================
Example Usage
-------------
.. code-block:: cpp
// Basic
App.make_dht_sensor("Outside Temperature", "Outside Humidity", 12);
.. cpp:namespace:: esphomelib
See :cpp:func:`Application::make_dht_sensor`.
API Reference
-------------
.. cpp:namespace:: nullptr
.. doxygenclass:: sensor::DHTComponent
:members:
:protected-members:
:undoc-members:

32
api/sensor/hdc1080.rst Normal file
View File

@ -0,0 +1,32 @@
HDC1080 Temperature/Humidity Sensor
===================================
The HDC1080 component allows you get accurate temperature and humidity readings from your HDC1080
(`datasheet <http://www.ti.com/lit/ds/symlink/hdc1080.pdf>`_,
`adafruit <https://www.adafruit.com/product/2635>`_) sensors with esphomelib. To use these
i2c-based devices, first initialize the i2c bus using the pins you have for SDA and SCL and
then create the sensors themselves as in below example.
Example Usage
-------------
.. code-block:: cpp
// inside setup()
App.init_i2c(SDA_PIN, SCL_PIN); // change these values for your pins.
// create sensors
App.make_hdc1080_sensor("Outside Temperature", "Outside Humidity");
.. cpp:namespace:: esphomelib
See :cpp:func:`Application::make_hdc1080_sensor`.
API Reference
-------------
.. cpp:namespace:: nullptr
.. doxygenclass:: sensor::HDC1080Component
:members:
:protected-members:
:undoc-members:

32
api/sensor/htu21d.rst Normal file
View File

@ -0,0 +1,32 @@
HTU21D Temperature/Humidity Sensor
==================================
The HTU21D component allows you get accurate temperature and humidity readings from your HTU21D
(`datasheet <https://cdn-shop.adafruit.com/datasheets/1899_HTU21D.pdf>`_,
`adafruit <https://www.adafruit.com/product/1899>`_) sensors with esphomelib. To use these
i2c-based devices, first initialize the i2c bus using the pins you have for SDA and SCL and
then create the sensors themselves as in below example.
Example Usage
-------------
.. code-block:: cpp
// inside setup()
App.init_i2c(SDA_PIN, SCL_PIN); // change these values for your pins.
// create sensors
App.make_htu21d_sensor("Outside Temperature", "Outside Humidity");
.. cpp:namespace:: esphomelib
See :cpp:func:`Application::make_htu21d_sensor`.
API Reference
-------------
.. cpp:namespace:: nullptr
.. doxygenclass:: sensor::HTU21DComponent
:members:
:protected-members:
:undoc-members:

126
api/sensor/index.rst Normal file
View File

@ -0,0 +1,126 @@
Sensor
======
The `sensor` namespace contains all sensors.
.. cpp:namespace:: esphomelib
See :cpp:func:`Application::register_sensor`.
.. toctree::
:maxdepth: 1
adc-sensor.rst
dallas.rst
dht.rst
pulse-counter.rst
ultrasonic.rst
ads1115.rst
bmp085.rst
htu21d.rst
hdc1080.rst
mpu6050.rst
tsl2561.rst
bht1750.rst
bme280.rst
bme680.rst
sht3xd.rst
API Reference
-------------
.. cpp:namespace:: nullptr
Sensor
******
.. doxygenclass:: sensor::Sensor
:members:
:protected-members:
:undoc-members:
.. doxygentypedef:: sensor::sensor_callback_t
.. doxygenclass:: sensor::PollingSensorComponent
:members:
:protected-members:
:undoc-members:
.. doxygenclass:: sensor::EmptySensor
:members:
:protected-members:
:undoc-members:
.. doxygenclass:: sensor::EmptyPollingParentSensor
:members:
:protected-members:
:undoc-members:
.. doxygenvariable:: sensor::ICON_EMPTY
.. doxygenvariable:: sensor::ICON_WATER_PERCENT
.. doxygenvariable:: sensor::ICON_GAUGE
.. doxygenvariable:: sensor::ICON_FLASH
.. doxygenvariable:: sensor::ICON_SCREEN_ROTATION
.. doxygenvariable:: sensor::ICON_BRIEFCASE_DOWNLOAD
.. doxygenvariable:: sensor::UNIT_C
.. doxygenvariable:: sensor::UNIT_PERCENT
.. doxygenvariable:: sensor::UNIT_HPA
.. doxygenvariable:: sensor::UNIT_V
.. doxygenvariable:: sensor::UNIT_DEGREES_PER_SECOND
.. doxygenvariable:: sensor::UNIT_M_PER_S_SQUARED
Filter
******
.. doxygenclass:: sensor::Filter
:members:
:protected-members:
:undoc-members:
.. doxygenclass:: sensor::SlidingWindowMovingAverageFilter
:members:
:protected-members:
:undoc-members:
.. doxygenclass:: sensor::ExponentialMovingAverageFilter
:members:
:protected-members:
:undoc-members:
.. doxygentypedef:: sensor::lambda_filter_t
.. doxygenclass:: sensor::LambdaFilter
:members:
:protected-members:
:undoc-members:
.. doxygenclass:: sensor::OffsetFilter
:members:
:protected-members:
:undoc-members:
.. doxygenclass:: sensor::MultiplyFilter
:members:
:protected-members:
:undoc-members:
.. doxygenclass:: sensor::FilterOutValueFilter
:members:
:protected-members:
:undoc-members:
.. doxygenclass:: sensor::FilterOutNANFilter
:members:
:protected-members:
:undoc-members:
MQTTSensorComponent
*******************
.. doxygenclass:: sensor::MQTTSensorComponent
:members:
:protected-members:
:undoc-members:

43
api/sensor/mpu6050.rst Normal file
View File

@ -0,0 +1,43 @@
MPU6050 Accelerometer/Gyroscope Component
=========================================
The MPU6050 allows you to use your MPU6050 i2c-enabled accelerometers/gyroscopes with
esphomelib (`datasheet <https://www.invensense.com/wp-content/uploads/2015/02/MPU-6000-Datasheet1.pdf>`__,
`Sparkfun <https://www.sparkfun.com/products/11028>`__). It requires i2c to be setup to work.
This component only supports reading in the measurements directly from the registers of the chip
at the moment. If you do need some more complicated signal processing and/or configuration options,
I would recommend copying the code over and creating your own custom component, as supporting every
single possible configuration is not esphomelib's ultimate goal with a chip that supports such a
variety of options.
Example Usage
-------------
.. code-block:: cpp
// inside setup()
App.init_i2c(SDA_PIN, SCL_PIN); // change these values for your pins.
// create sensors
auto *mpu6050 = App.make_mpu6050_sensor();
App.register_sensor(mpu6050->make_accel_x_sensor("MPU6050 Accel X"));
App.register_sensor(mpu6050->make_accel_y_sensor("MPU6050 Accel Y"));
App.register_sensor(mpu6050->make_accel_z_sensor("MPU6050 Accel Z"));
App.register_sensor(mpu6050->make_gyro_x_sensor("MPU6050 Gyro X"));
App.register_sensor(mpu6050->make_gyro_y_sensor("MPU6050 Gyro Y"));
App.register_sensor(mpu6050->make_gyro_z_sensor("MPU6050 Gyro Z"));
App.register_sensor(mpu6050->make_temperature_sensor("MPU6050 Temperature"));
.. cpp:namespace:: esphomelib
See :cpp:func:`Application::make_mpu6050_sensor`.
API Reference
-------------
.. cpp:namespace:: nullptr
.. doxygenclass:: sensor::MPU6050Component
:members:
:protected-members:
:undoc-members:

View File

@ -0,0 +1,34 @@
ESP32 Pulse Counter Sensor
==========================
This component allows you to count pulses on a PIN using the internal
`pulse counter <http://esp-idf.readthedocs.io/en/latest/api-reference/peripherals/pcnt.html>`_ peripheral of
the ESP32. By default, the values by this sensor are reported in "pulses/min". You can convert
that to your own unit like in below example.
Example Usage
-------------
.. code-block:: cpp
// Basic
App.make_pulse_counter_sensor("Stromverbrauch Wärmepumpe", 13);
// Unit conversion
auto strom_warme = App.make_pulse_counter_sensor("Stromverbrauch Wärmepumpe", 13);
strom_warme.mqtt->set_unit_of_measurement("kW");
strom_warme.mqtt->clear_filters();
strom_warme.mqtt->add_multiply_filter(0.06f); // convert from Wh pulse to kW
.. cpp:namespace:: esphomelib
See :cpp:func:`Application::make_pulse_counter_sensor`.
API Reference
-------------
.. cpp:namespace:: nullptr
.. doxygenclass:: sensor::PulseCounterSensorComponent
:members:
:protected-members:
:undoc-members:

48
api/sensor/sht3xd.rst Normal file
View File

@ -0,0 +1,48 @@
SHT3XD Temperature/Humidity Sensor
==================================
.. warning::
This sensor is experimental has not been tested yet. If you can verify it works (or if it doesn't),
notify me on discord.
The SHT3XD component allows you to use your SHT3x-DIS i2c-enabled temperature+humidity+gas
sensor with esphomelib (`datasheet <https://cdn-shop.adafruit.com/product-files/2857/Sensirion_Humidity_SHT3x_Datasheet_digital-767294.pdf>`__,
`adafruit <https://www.adafruit.com/product/2857>`__). It requires i2c to be setup to work.
Example Usage
-------------
.. code-block:: cpp
// Basic
auto sht3xd = App.make_sht3xd_sensor("SHT31D Temperature", "SHT31D Humidity");
// Advanced
// default accuracy is high
sht3xd.sht3xd->set_accuracy(sensor::SHT3XD_ACCURACY_LOW);
.. cpp:namespace:: esphomelib
See :cpp:func:`Application::make_sht3xd_sensor`.
API Reference
-------------
.. doxygenclass:: sensor::SHT3XDComponent
:members:
:protected-members:
:undoc-members:
.. doxygenenum:: sensor::SHT3XDAccuracy
.. doxygenclass:: sensor::SHT3XDTemperatureSensor
:members:
:protected-members:
:undoc-members:
.. doxygenclass:: sensor::SHT3XDHumiditySensor
:members:
:protected-members:
:undoc-members:

42
api/sensor/tsl2561.rst Normal file
View File

@ -0,0 +1,42 @@
TSL2561 Ambient Light Sensor
============================
.. warning::
This sensor is experimental has not been tested yet. If you can verify it works (or if it doesn't),
notify me on discord.
The TSL2561 sensor allows you to use your TSL2561 i2c-enabled ambient light sensor with
esphomelib (`datasheet <https://cdn-shop.adafruit.com/datasheets/TSL2561.pdf>`__,
`Adafruit <https://www.adafruit.com/product/439>`__). It requires i2c to be setup to work.
Example Usage
-------------
.. code-block:: cpp
// Basic
auto tsl2561 = App.make_tsl2561_sensor("TSL2561 Illuminance Sensor");
// Advanced settings
// set the time the sensor will take for value accumulation, default: 402 ms
tsl2561.tsl2561->set_integration_time(sensor::TSL2561_INTEGRATION_14MS);
// set a higher gain for low light conditions, default: 1x
tsl2561.tsl2561->set_gain(sensor::TSL2561_GAIN_16X);
.. cpp:namespace:: esphomelib
See :cpp:func:`Application::make_tsl2561_sensor`.
API Reference
-------------
.. cpp:namespace:: nullptr
.. doxygenclass:: sensor::TSL2561Sensor
:members:
:protected-members:
:undoc-members:
.. doxygenenum:: sensor::TSL2561IntegrationTime
.. doxygenenum:: sensor::TSL2561Gain

31
api/sensor/ultrasonic.rst Normal file
View File

@ -0,0 +1,31 @@
Ultrasonic Sensor
=================
Example Usage
-------------
.. code-block:: cpp
// Basic
App.make_ultrasonic("Ultrasonic", 12, 13); // trigger pin: 12, echo pin: 13
// Filter out timeouts
auto ultrasonic = App.make_ultrasonic("Ultrasonic", 12, 13);
ultrasonic.mqtt->set_filters({
new sensor::FilterOutNANFilter(), // filter out timeouts
});
// Set timeout, 4 meters
ultrasonic.sensor->set_timeout_m(4.0f);
.. cpp:namespace:: esphomelib
See :cpp:func:`Application::make_ultrasonic_sensor`.
API Reference
-------------
.. cpp:namespace:: nullptr
.. doxygenclass:: sensor::UltrasonicSensorComponent
:members:
:protected-members:
:undoc-members:

39
api/switch/index.rst Normal file
View File

@ -0,0 +1,39 @@
Switch
======
The `switch_` namespace contains all switch helpers.
.. toctree::
IR Transmitter <ir-transmitter>
Restart Switch <restart>
Shutdown Switch <shutdown>
API Reference
-------------
.. cpp:namespace:: nullptr
Switch
******
.. doxygenclass:: switch_::Switch
:members:
:protected-members:
:undoc-members:
SimpleSwitch
************
.. doxygenclass:: switch_::SimpleSwitch
:members:
:protected-members:
:undoc-members:
MQTTSwitchComponent
*******************
.. doxygenclass:: switch_::MQTTSwitchComponent
:members:
:protected-members:
:undoc-members:

View File

@ -0,0 +1,44 @@
IR Transmitter
==============
Example Usage
-------------
.. code-block:: cpp
// at the top of your file:
using namespace switch_::ir_;
// Create the hub
auto *ir = App.make_ir_transmitter(32);
// Create switches
auto *panasonic_on = ir->create_transmitter("Panasonic TV On", SendData::from_panasonic(0x4004, 0x100BCBD).repeat(25));
App.register_switch(panasonic_on);
App.register_switch(ir->create_transmitter("Panasonic TV Volume Up", SendData::from_panasonic(0x4004, 0x1000405)));
.. cpp:namespace:: esphomelib
See :cpp:func:`Application::make_ir_transmitter` and :cpp:func:`Application::register_switch`.
API Reference
-------------
.. cpp:namespace:: nullptr
IRTransmitterComponent
**********************
.. doxygenclass:: switch_::IRTransmitterComponent
:members:
:protected-members:
:undoc-members:
.. doxygenvariable:: switch_::next_rmt_channel
SendData
********
.. doxygennamespace:: switch_::ir
:members:
:protected-members:
:undoc-members:

25
api/switch/restart.rst Normal file
View File

@ -0,0 +1,25 @@
Restart Switch
==============
This platform allows you to restart your ESP8266/ESP32 with a simple MQTT message.
Example Usage
-------------
.. code-block:: cpp
App.make_restart_switch("Livingroom Restart");
.. cpp:namespace:: esphomelib
See :cpp:func:`Application::make_restart_switch`.
API Reference
-------------
.. cpp:namespace:: nullptr
.. doxygenclass:: switch_::RestartSwitch
:members:
:protected-members:
:undoc-members:

29
api/switch/shutdown.rst Normal file
View File

@ -0,0 +1,29 @@
Shutdown Switch
===============
This platform allows you to put your ESP8266/ESP32 to sleep until it is manually restarted
by either pressing the reset button or toggling the power supply.
It is especially useful if you're using esphomelib with battery cells that must not
be discharged too much.
Example Usage
-------------
.. code-block:: cpp
App.make_shutdown_switch("Livingroom Shutdown");
.. cpp:namespace:: esphomelib
See :cpp:func:`Application::make_shutdown_switch`.
API Reference
-------------
.. cpp:namespace:: nullptr
.. doxygenclass:: switch_::ShutdownSwitch
:members:
:protected-members:
:undoc-members:

191
conf.py Normal file
View File

@ -0,0 +1,191 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# esphomelib documentation build configuration file, created by
# sphinx-quickstart on Mon Jan 22 21:44:07 2018.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
# import os
# import sys
# sys.path.insert(0, os.path.abspath('.'))
import os
import subprocess
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
if on_rtd:
subprocess.call('doxygen', shell=True)
# -- General configuration ------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
#
# needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'breathe',
]
breathe_projects = {"esphomelib": "./_doxyxml/"}
breathe_default_project = "esphomelib"
breathe_domain_by_extension = {"h" : "cpp"}
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
# source_suffix = ['.rst', '.md']
source_suffix = '.rst'
# The master toctree document.
master_doc = 'index'
# General information about the project.
project = 'esphomelib'
copyright = '2018, Otto Winter'
author = 'Otto Winter'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = '1.4'
# The full version, including alpha/beta/rc tags.
release = '1.4.0'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This patterns also effect to html_static_path and html_extra_path
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
# The reST default role (used for this markup: `text`) to use for all documents.
# default_role = 'cpp:any'
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
# highlight_language = 'yaml'
primary_domain = None
# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = False
# -- Options for HTML output ----------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'alabaster'
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#
html_theme_options = {
'github_user': 'OttoWinter',
'github_repo': 'esphomelib',
}
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
# Custom sidebar templates, must be a dictionary that maps document names
# to template names.
#
# This is required for the alabaster theme
# refs: http://alabaster.readthedocs.io/en/latest/installation.html#sidebars
html_sidebars = {
'**': [
'relations.html', # needs 'show_related': True theme option to display
'searchbox.html',
]
}
# -- Options for HTMLHelp output ------------------------------------------
# Output file base name for HTML help builder.
htmlhelp_basename = 'esphomelibdoc'
# -- Options for LaTeX output ---------------------------------------------
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',
# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
}
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'esphomelib.tex', 'esphomelib Documentation',
'Otto Winter', 'manual'),
]
# -- Options for manual page output ---------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'esphomelib', 'esphomelib Documentation',
[author], 1)
]
# -- Options for Texinfo output -------------------------------------------
# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'esphomelib', 'esphomelib Documentation',
author, 'esphomelib', 'One line description of project.',
'Miscellaneous'),
]

BIN
esphomeyaml/ads1115.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

BIN
esphomeyaml/bmp180.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 143 KiB

View File

@ -0,0 +1,4 @@
<svg fill="#000000" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg">
<path d="M0 0h24v24H0z" fill="none"/>
<path d="M20 15.31L23.31 12 20 8.69V4h-4.69L12 .69 8.69 4H4v4.69L.69 12 4 15.31V20h4.69L12 23.31 15.31 20H20v-4.69zM12 18V6c3.31 0 6 2.69 6 6s-2.69 6-6 6z"/>
</svg>

After

Width:  |  Height:  |  Size: 309 B

View File

@ -0,0 +1,4 @@
<svg fill="#000000" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg">
<path d="M0 0h24v24H0z" fill="none"/>
<path d="M20 8h-2.81c-.45-.78-1.07-1.45-1.82-1.96L17 4.41 15.59 3l-2.17 2.17C12.96 5.06 12.49 5 12 5c-.49 0-.96.06-1.41.17L8.41 3 7 4.41l1.62 1.63C7.88 6.55 7.26 7.22 6.81 8H4v2h2.09c-.05.33-.09.66-.09 1v1H4v2h2v1c0 .34.04.67.09 1H4v2h2.81c1.04 1.79 2.97 3 5.19 3s4.15-1.21 5.19-3H20v-2h-2.09c.05-.33.09-.66.09-1v-1h2v-2h-2v-1c0-.34-.04-.67-.09-1H20V8zm-6 8h-4v-2h4v2zm0-4h-4v-2h4v2z"/>
</svg>

After

Width:  |  Height:  |  Size: 538 B

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="M16.5,16H8A3,3 0 0,1 5,13A3,3 0 0,1 8,10C8.05,10 8.09,10 8.14,10C8.58,8.28 10.13,7 12,7A4,4 0 0,1 16,11H16.5A2.5,2.5 0 0,1 19,13.5A2.5,2.5 0 0,1 16.5,16M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z" /></svg>

After

Width:  |  Height:  |  Size: 523 B

View File

@ -0,0 +1,47 @@
ADS1115 Hub
===========
The ``ads1115`` domain creates a global hub so that you can later create
individual sensors using the `ADS1115 Sensor
Platform </esphomeyaml/components/sensor/ads1115.html>`__. To use this
hub, first setup the `I²C Bus </esphomeyaml/components/i2c.html>`__ and
connect the sensor to the pins specified there.
.. figure:: /esphomeyaml/components/sensor/ads1115-full.jpg
:align: center
:target: `Adafruit`_
:width: 50.0%
ADS1115 16-Bit ADC. Image by `Adafruit`_.
.. _Adafruit: https://www.adafruit.com/product/1085
.. code:: yaml
ads1115:
- address: 0x48
Configuration variables:
~~~~~~~~~~~~~~~~~~~~~~~~
- **address** (**Required**, int): The i²c address of the sensor. See
`I²C Addresses <#i2c-addresses>`__ for more information.
- **rate** (*Optional*, int): The internal rate the sensor is using for
its conversions in the unit samples per second. One of ``8``, ``16``,
``32``, ``64``, ``128``, ``250``, ``475``, ``860``. Defaults to
``128``.
- **id** (*Optional*,
`id </esphomeyaml/configuration-types.html#id>`__): Manually specify the ID for this ADS1115 Hub. Use this if you want to use multiple ADS1115 hubs at once.
I²C Addresses
~~~~~~~~~~~~~
In order to allow multiple sensors to be connected to the same i²c bus,
the creators of this sensor hardware have included some options to
change the i²c address.
- If the address pin is pulled to GND, the address is ``0x48``
(Default).
- If the address pin is pulled to VCC, the address is ``0x49``.
- If the address pin is tied to SDA, the address is ``0x4a``.
- If the address pin is tied to SCL, the address is ``0x4B``.

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

@ -0,0 +1,35 @@
GPIO Binary Sensor
==================
The GPIO Binary Sensor platform allows you to use any input pin on your
device as a binary sensor.
|image0|
.. code:: yaml
# Example configuration entry
binary_sensor:
- platform: gpio
pin: D2
name: "Living Room Window"
device_class: window
Configuration variables:
~~~~~~~~~~~~~~~~~~~~~~~~
- **pin** (**Required**, `Pin
Schema </esphomeyaml/configuration-types.html#pin-schema>`__): The
pin to periodically check.
- **name** (**Required**, string): The name of the binary sensor.
- **id** (*Optional*,
`id </esphomeyaml/configuration-types.html#id>`__): Manually specify
the ID used for code generation.
- All other options from `Binary
Sensor </esphomeyaml/components/binary_sensor/index.html#base-binary-sensor-configuration>`__
and `MQTT
Component </esphomeyaml/components/mqtt.html#mqtt-component-base-configuration>`__.
.. |image0| image:: /esphomeyaml/components/binary_sensor/gpio.png
:class: align-center
:width: 80.0%

View File

@ -0,0 +1,47 @@
Binary Sensor Component
=======================
With esphomelib you can use different types of binary sensors. They will
automatically appear in the Home Assistant front-end and have several
configuration options.
Currently supported binary sensor platforms:
====================== ====================== ======================
|GPIO|_ |Status|_
---------------------- ---------------------- ----------------------
`GPIO`_ `Status`_
====================== ====================== ======================
.. |GPIO| image:: /esphomeyaml/pin.svg
:class: component-image
.. _GPIO: /esphomeyaml/components/binary_sensor/gpio.html
.. |Status| image:: /esphomeyaml/server-network.svg
:class: component-image
.. _Status: /esphomeyaml/components/binary_sensor/status.html
Base Binary Sensor Configuration
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
All binary sensors have a platform and an optional device class. By
default, the binary will chose the appropriate device class itself, but
you can always override it.
.. code:: yaml
binary_sensor:
- platform: ...
device_class: Device Class
Configuration variables:
- **device_class** (*Optional*, string): The device class for the
sensor. See https://www.home-assistant.io/components/binary_sensor/
for a list of available options.
- **inverted** (*Optional*, boolean): Whether to invert the binary
sensor output, i.e. report ON states as OFF and vice versa. Defaults
to ``False``.
- All other options from `MQTT
Component </esphomeyaml/components/mqtt.html#mqtt-component-base-configuration>`__.

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

@ -0,0 +1,33 @@
Status Binary Sensor
====================
The Status Binary Sensor exposes the node state (if its connected to
MQTT or not) for Home Assistant. It uses the `MQTT birth and last will
messages </esphomeyaml/components/mqtt.html#last-will-and-birth-messages>`__
to do this.
|image0|
.. code:: yaml
# Example configuration entry
binary_sensor:
- platform: status
name: "Living Room Status"
Configuration variables:
~~~~~~~~~~~~~~~~~~~~~~~~
- **name** (**Required**, string): The name of the binary sensor.
- **id** (*Optional*,
`id </esphomeyaml/configuration-types.html#id>`__): Manually specify
the ID used for code generation.
- All other options from `Binary
Sensor </esphomeyaml/components/binary_sensor/index.html#base-binary-sensor-configuration>`__
and `MQTT
Component </esphomeyaml/components/mqtt.html#mqtt-component-base-configuration>`__.
Inverted is not supported.
.. |image0| image:: /esphomeyaml/components/binary_sensor/status.png
:class: align-center
:width: 80.0%

View File

@ -0,0 +1,38 @@
Dallas Temperature Component
============================
The ``dallas`` component allows you to use your
`DS18b20 <https://www.adafruit.com/product/374>`__
(`datasheet <https://datasheets.maximintegrated.com/en/ds/DS18B20.pdf>`__)
and similar temperature sensors.
To use your dallas sensor, first define a dallas “hub” with a pin and
id, which you will later use to create the sensors. The 1-Wire bus the
sensors are connected to should have an external pullup resistor of
about 4.7KΩ.
.. code:: yaml
# Example configuration entry
dallas:
- id: dallas_hub1
pin: 23
# Individual sensors
sensor:
- platform: dallas
dallas_id: "dallas_hub1"
address: 0x1c0000031edd2a28
name: "Livingroom Temperature"
Configuration variables:
~~~~~~~~~~~~~~~~~~~~~~~~
- **pin** (**Required**, number): The pin the sensor bus is connected
to.
- **update_interval** (*Optional*,
`time </esphomeyaml/configuration-types.html#time>`__): The interval
that the sensors should be checked. Defaults to 15 seconds.
- **id** (*Optional*,
`id </esphomeyaml/configuration-types.html#id>`__): Manually specify
the ID used for code generation.

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

View File

@ -0,0 +1,21 @@
Debug Component
===============
The ``debug`` component can be used to debug problems with esphomelib. At startup, it prints
a bunch of useful information like reset reason, free heap size, esphomelib version and so on.
.. figure:: /esphomeyaml/components/debug.png
:align: center
Example debug component output.
.. code:: yaml
# Example configuration entry
debug:
# Logger must be at least debug (default)
logger:
level: debug
There are no configuration variables for this component.

View File

@ -0,0 +1,42 @@
Deep Sleep Component
====================
The ``deep_sleep`` component can be used to automatically enter a deep sleep mode on the
ESP8266/ESP32 after a certain amount of time. This is especially useful with nodes that operate
on batteries and therefore need to conserve as much energy as possible.
To use ``deep_sleep`` first specify how long the node should be active, i.e. how long it should
check sensor values and report them, using the ``run_duration`` and ``run_cycles`` options. If you
use both in your configuration, any time either one of them is finished, the node will go into deep
sleep mode.
Next, tell the node how it should wakeup. On the ESP8266, you can only put the node into deep sleep
for a duration using ``sleep_duration``, note that on the ESP8266 ``GPIO16`` must be connected to
the ``RST`` pin so that it will wake up again. On the ESP32, you additionally have the option
to wake up on any RTC pin (0, 2, 4, 12, 13, 14, 15, 25, 26, 27, 32, 39).
While in deep sleep mode, the node will not do any work and not respond to any network traffic,
even Over The Air updates.
.. code:: yaml
# Example configuration entry
deep_sleep:
run_duration: 10s
sleep_duration: 10min
Configuration variables:
~~~~~~~~~~~~~~~~~~~~~~~~
- **run_duration** (*Optional*, `time </esphomeyaml/configuration-types.html#time>`__):
The time duration the node should be active, i.e. run code.
- **run_cycles** (*Optional*, int): The number of ``loop()`` cycles to go through before
entering deep sleep mode.
- **sleep_duration** (*Optional*, `time </esphomeyaml/configuration-types.html#time>`__):
The time duration to stay in deep sleep mode.
- **wakeup_pin** (*Optional*, `Pin Schema </esphomeyaml/configuration-types.html#pin-schema>`__):
Only on ESP32. A pin to wake up to once in deep sleep mode. Use the inverted property to wake up
to LOW signals.
- **id** (*Optional*,
`id </esphomeyaml/configuration-types.html#id>`__): Manually specify
the ID used for code generation.

View File

@ -0,0 +1,46 @@
esphomeyaml Core Configuration
==============================
Here you specify some core information that esphomeyaml needs to create
firmwares. Most importantly, this is the section of the configuration
where you specify the **name** of the node, the **platform** and
**board** youre using.
.. code:: yaml
# Example configuration entry
esphomeyaml:
name: livingroom
platform: ESP32
board: nodemcu-32s
Configuration variables:
~~~~~~~~~~~~~~~~~~~~~~~~
- **name** (**Required**, string): This is the name of the node. It
should always be unique to the node and no other node in your system
can use the same name. It can also only contain upper/lowercase
characters, digits and underscores.
- **platform** (**Required**, string): The platform your board is on,
either ``ESP32`` or ``ESP8266``.
- **board** (**Required**, string): The board esphomeyaml should
specify for platformio. For the ESP32, choose the appropriate one
from `this
list <http://docs.platformio.org/en/latest/platforms/espressif32.html#boards>`__
and use `this
list <http://docs.platformio.org/en/latest/platforms/espressif8266.html#boards>`__
for ESP8266-based boards.
- **library_uri** (*Optional*, string): You can manually specify the
`version of
esphomelib <https://github.com/OttoWinter/esphomelib/releases>`__ to
use here. Accepts all parameters of `platformio lib
install <http://docs.platformio.org/en/latest/userguide/lib/cmd_install.html#id2>`__.
Use ``https://github.com/OttoWinter/esphomelib.git`` for the latest
(unstable) build. Defaults to ``esphomelib``.
- **simplify** (*Optional*, boolean): Whether to simplify the
auto-generated code, i.e. whether to remove unused variables, use
``auto`` types and so on. Defaults to ``true``.
- **use_build_flags** (*Optional*, boolean): If esphomeyaml should manually set
build flags that specifically set what should be included in the binary. Most of
this is already done automatically by the linker but this option can help with
shrinking the firmware size while slowing down compilation. Defaults to ``false``.

View File

@ -0,0 +1,37 @@
Binary Fan
==========
The ``binary`` fan platform lets you represent any binary `ouput
component </esphomeyaml/components/output/index.html>`__ as a fan.
|image0|
.. code:: yaml
# Example configuration entry
fan:
- platform: binary
output: myoutput_1
name: "Living Room Fan"
Configuration variables:
~~~~~~~~~~~~~~~~~~~~~~~~
- **output** (**Required**,
`id </esphomeyaml/configuration-types.html#id>`__): The id of the
binary output component to use for this fan.
- **name** (**Required**, string): The name for this fan.
- **oscillation_output** (*Optional*,
`id </esphomeyaml/configuration-types.html#id>`__): The output to use
for the oscillation state of this fan. Default is empty.
- **id** (*Optional*,
`id </esphomeyaml/configuration-types.html#id>`__): Manually specify
the ID used for code generation.
- All other options from `MQTT
Component </esphomeyaml/components/mqtt.html#mqtt-component-base-configuration>`__
and `Fan
Component </esphomeyaml/components/fan/index.html#base-fan-configuration>`__.
.. |image0| image:: /esphomeyaml/components/fan/fan.png
:class: align-center
:width: 80.0%

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -0,0 +1,52 @@
Fan Component
=============
With the ``fan`` domain you can create components that appear as fans in
the Home Assistant frontend. A fan can be switched ON or OFF, optionally
has a speed setting (``LOW``, ``MEDIUM``, ``HIGH``) and can have an
oscillate output.
|image0|
Currently supported fan platforms:
======================== ======================== ========================
|Binary Fan|_ |Speed Fan|_
------------------------ ------------------------ ------------------------
`Binary Fan`_ `Speed Fan`_
======================== ======================== ========================
.. |Binary Fan| image:: /esphomeyaml/fan.svg
:class: component-image
.. _Binary Fan: /esphomeyaml/components/fan/binary.html
.. |Speed Fan| image:: /esphomeyaml/fan.svg
:class: component-image
.. _Speed Fan: /esphomeyaml/components/fan/speed.html
Base Fan Configuration
~~~~~~~~~~~~~~~~~~~~~~
.. code:: yaml
fan:
- platform: ...
name: ...
Configuration variables:
- **name** (**Required**, string): The name of the fan.
- **oscillation_state_topic** (*Optional*, string): The topic to
publish fan oscillaiton state changes to.
- **oscillation_command_topic** (*Optional*, string): The topic to
receive oscillation commands on.
- **speed_state_topic** (*Optional*, string): The topic to publish fan
speed state changes to.
- **speed_command_topic** (*Optional*, string): The topic to receive
speedcommands on.
- All other options from `MQTT
Component </esphomeyaml/components/mqtt.html#mqtt-component-base-configuration>`__.
.. |image0| image:: /esphomeyaml/components/fan/fan.png
:class: align-center
:width: 70.0%

View File

@ -0,0 +1,47 @@
Speed Fan
=========
The ``speed`` fan platform lets you represent any float `ouput
component </esphomeyaml/components/output/index.html>`__ as a fan that
supports speed settings.
|image0|
.. code:: yaml
# Example configuration entry
fan:
- platform: speed
output: myoutput_1
name: "Living Room Fan"
Configuration variables:
~~~~~~~~~~~~~~~~~~~~~~~~
- **output** (**Required**,
`id </esphomeyaml/configuration-types.html#id>`__): The id of the
binary output component to use for this fan.
- **name** (**Required**, string): The name for this fan.
- **oscillation_output** (*Optional*,
`id </esphomeyaml/configuration-types.html#id>`__): The output to use
for the oscillation state of this fan. Default is empty.
- **speed** (*Optional*): Set the float values for each speed setting:
- **low** (*Required*, float): Set the value for the low speed
setting. Must be in range 0 to 1. Defaults to 0.33.
- **medium** (*Required*, float): Set the value for the medium speed
setting. Must be in range 0 to 1. Defaults to 0.66.
- **high** (*Required*, float): Set the value for the high speed
setting. Must be in range 0 to 1. Defaults to 1.
- **id** (*Optional*,
`id </esphomeyaml/configuration-types.html#id>`__): Manually specify
the ID used for code generation.
- All other options from `MQTT
Component </esphomeyaml/components/mqtt.html#mqtt-component-base-configuration>`__
and `Fan
Component </esphomeyaml/components/fan/index.html#base-fan-configuration>`__.
.. |image0| image:: /esphomeyaml/components/fan/fan.png
:class: align-center
:width: 80.0%

View File

@ -0,0 +1,66 @@
I²C Bus
=======
This component sets up the i²c bus for your ESP32 or ESP8266. Its used
for several other components:
======================= ======================= =======================
|PCA9685 PWM|_ |ADS1115|_ |BMP085|_
----------------------- ----------------------- -----------------------
`PCA9685 PWM`_ `ADS1115`_ `BMP085`_
----------------------- ----------------------- -----------------------
|HDC1080|_ |HTU21D|_ |MPU6050|_
----------------------- ----------------------- -----------------------
`HDC1080`_ `HTU21D`_ `MPU6050`_
======================= ======================= =======================
.. |PCA9685 PWM| image:: /esphomeyaml/pca9685.jpg
:class: component-image
.. _PCA9685 PWM: /esphomeyaml/components/output/pca9685.html
.. |ADS1115| image:: /esphomeyaml/ads1115.jpg
:class: component-image
.. _ADS1115: /esphomeyaml/components/sensor/ads1115.html
.. |BMP085| image:: /esphomeyaml/bmp180.jpg
:class: component-image
.. _BMP085: /esphomeyaml/components/sensor/bmp085.html
.. |HDC1080| image:: /esphomeyaml/HDC1080.jpg
:class: component-image
.. _HDC1080: /esphomeyaml/components/sensor/hdc1080.html
.. |HTU21D| image:: /esphomeyaml/htu21d.jpg
:class: component-image
.. _HTU21D: /esphomeyaml/components/sensor/htu21d.html
.. |MPU6050| image:: /esphomeyaml/mpu6050.jpg
:class: component-image
.. _MPU6050: /esphomeyaml/components/sensor/mpu6050.html
In order for those components to work correctly, you need to define the
i²c bus in your configuration.
.. code:: yaml
# Example configuration entry
i2c:
sda: 21
scl: 22
scan: False
Configuration variables:
~~~~~~~~~~~~~~~~~~~~~~~~
- **sda** (*Optional*, `pin </esphomeyaml/configuration-types.html#pin>`__): The pin for the data line of the i²c bus.
Defaults to the default of your board (usually GPIO21 for ESP32 and
GPIO4 for ESP8266).
- **sdc** (*Optional*, `pin </esphomeyaml/configuration-types.html#pin>`__): The pin for the clock line of the i²c bus.
Defaults to the default of your board (usually GPIO22 for ESP32 and
GPIO5 for ESP8266).
- **scan** (*Optional*, boolean): If esphomelib should do a search of the i2c address space on startup.
Note that this can slow down startup and is only recommended for when setting up new sensors. Defaults to
``False``.
- **frequency** (*Optional*, float): Only on ESP32. Set the frequency
the i²c bus should operate on. Defaults to “100kHz”. Accepts most
metric suffixes.

View File

@ -0,0 +1,40 @@
ESP32 IR Transmitter Component
==============================
The IR transmitter component lets you use the `remote
peripheral <https://esp-idf.readthedocs.io/en/latest/api-reference/peripherals/rmt.html>`__
on your ESP32 to send infrared messages to control devices in your home.
First, you need to setup a global hub that specifies which pin your IR
led is connected to. Afterwards you can create `individual
switches </esphomeyaml/components/switch/ir_transmitter.html>`__ that
each send a pre-defined IR code to a device.
.. code:: yaml
# Example configuration entry
ir_transmitter:
- id: 'ir_hub1'
pin: 32
# Individual switches
switch:
- platform: ir_transmitter
ir_transmitter_id: 'ir_hub1'
name: "Panasonic TV Off"
panasonic:
address: 0x4004
command: 0x100BCBD
Configuration variables:
~~~~~~~~~~~~~~~~~~~~~~~~
- **pin** (**Required**,
`pin </esphomeyaml/configuration-types.html#pin>`__): The pin of the
IR LED.
- **carrier_duty_percent** (*Optional*, int): The duty percentage of
the carrier. 50 for example means that the LED will be on 50% of the
time. Must be in range from 0 to 100. Defaults to 50.
- **id** (*Optional*,
`id </esphomeyaml/configuration-types.html#id>`__): Manually specify
the ID used for code generation. Use this if you have multiple IR
transmitters.

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View File

@ -0,0 +1,35 @@
Binary Light
============
The ``binary`` light platform creates a simple light from an `output
component </esphomeyaml/components/output/index.html>`__ and can only be
turned ON or OFF.
|image0|
.. code:: yaml
# Example configuration entry
light:
- platform: binary
name: "Desk Lamp"
output: output_component1
Configuration variables:
~~~~~~~~~~~~~~~~~~~~~~~~
- **name** (**Required**, string): The name of the light.
- **output** (**Required**,
`id </esphomeyaml/configuration-types.html#id>`__): The id of the
binary `output
component </esphomeyaml/components/output/index.html>`__ to use for
this light.
- **id** (*Optional*,
`id </esphomeyaml/configuration-types.html#id>`__): Manually specify
the ID used for code generation.
- All other options from `MQTT
Component </esphomeyaml/components/mqtt.html#mqtt-component-base-configuration>`__.
.. |image0| image:: /esphomeyaml/components/light/binary-light.png
:class: align-center
:width: 80.0%

View File

@ -0,0 +1,41 @@
Light Component
===============
The ``light`` domain in esphomeyaml lets you create lights that will
automatically be shown in Home Assistants frontend and have many
features such as RGB colors, transitions, flashing and effects.
|image0|
Currently supported light platforms:
======================== ======================== ========================
|Binary Light|_ |Monochromatic Light|_ |RGB Light|_
------------------------ ------------------------ ------------------------
`Binary Light`_ `Monochromatic Light`_ `RGB Light`_
------------------------ ------------------------ ------------------------
|RGBW Light|_
------------------------ ------------------------ ------------------------
`RGBW Light`_
======================== ======================== ========================
.. |Binary Light| image:: /esphomeyaml/lightbulb.svg
:class: component-image
.. _Binary Light: /esphomeyaml/components/light/binary.html
.. |Monochromatic Light| image:: /esphomeyaml/brightness-medium.svg
:class: component-image
.. _Monochromatic Light: /esphomeyaml/components/light/monochromatic.html
.. |RGB Light| image:: /esphomeyaml/rgb.png
:class: component-image
.. _RGB Light: /esphomeyaml/components/light/rgb.html
.. |RGBW Light| image:: /esphomeyaml/rgbw.png
:class: component-image
.. _RGBW Light: /esphomeyaml/components/light/rgbw.html
.. |image0| image:: /esphomeyaml/components/light/light-rgb.png
:class: align-center
:width: 30.0%

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

View File

@ -0,0 +1,41 @@
Monochromatic Light
===================
The ``monochromatic`` light platform creates a simple light
brightness-only from an `output
component </esphomeyaml/components/output/index.html>`__.
|image0|
.. code:: yaml
# Example configuration entry
light:
- platform: monochromatic
name: "Kitchen Lights"
output: output_component1
Configuration variables:
~~~~~~~~~~~~~~~~~~~~~~~~
- **name** (**Required**, string): The name of the light.
- **output** (**Required**,
`id </esphomeyaml/configuration-types.html#id>`__): The id of the
float `output component </esphomeyaml/components/output/index.html>`__
to use for this light.
- **gamma_correct** (*Optional*, float): The `gamma correction
factor <https://en.wikipedia.org/wiki/Gamma_correction>`__ for the
light. Defaults to ``2.8``.
- **default_transition_length** (*Optional*,
`time </esphomeyaml/configuration-types.html#time>`__): The length of
the transition if no transition parameter is provided by Home
Assistant. Defaults to ``1s``.
- **id** (*Optional*,
`id </esphomeyaml/configuration-types.html#id>`__): Manually specify
the ID used for code generation.
- All other options from `MQTT
Component </esphomeyaml/components/mqtt.html#mqtt-component-base-configuration>`__.
.. |image0| image:: /esphomeyaml/components/light/kitchen-lights.png
:class: align-center
:width: 80.0%

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

View File

@ -0,0 +1,51 @@
RGB Light
=========
The ``rgb`` light platform creates an RGB light from 3 `output
components </esphomeyaml/components/output/index.html>`__ (one for each
color channel).
|image0|
.. code:: yaml
# Example configuration entry
light:
- platform: rgb
name: "Living Room Lights"
red: output_component1
green: output_component2
blue: output_component3
Configuration variables:
~~~~~~~~~~~~~~~~~~~~~~~~
- **name** (**Required**, string): The name of the light.
- **red** (**Required**,
`id </esphomeyaml/configuration-types.html#id>`__): The id of the
float `output component </esphomeyaml/components/output/index.html>`__
to use for the red channel.
- **green** (**Required**,
`id </esphomeyaml/configuration-types.html#id>`__): The id of the
float `output component </esphomeyaml/components/output/index.html>`__
to use for the green channel.
- **blue** (**Required**,
`id </esphomeyaml/configuration-types.html#id>`__): The id of the
float `output component </esphomeyaml/components/output/index.html>`__
to use for the blue channel.
- **gamma_correct** (*Optional*, float): The `gamma correction
factor <https://en.wikipedia.org/wiki/Gamma_correction>`__ for the
light. Defaults to ``2.8``.
- **default_transition_length** (*Optional*,
`time </esphomeyaml/configuration-types.html#time>`__): The length of
the transition if no transition parameter is provided by Home
Assistant. Defaults to ``1s``.
- **id** (*Optional*,
`id </esphomeyaml/configuration-types.html#id>`__): Manually specify
the ID used for code generation.
- All other options from `MQTT
Component </esphomeyaml/components/mqtt.html#mqtt-component-base-configuration>`__.
.. |image0| image:: /esphomeyaml/components/light/rgb-light.png
:class: align-center
:width: 40.0%

View File

@ -0,0 +1,50 @@
RGBW Light
==========
The ``rgbw`` light platform creates an RGBW light from 4 `output
components </esphomeyaml/components/output/index.html>`__ (one for each
channel).
.. code:: yaml
# Example configuration entry
light:
- platform: rgb
name: "Livingroom Lights"
red: output_component1
green: output_component2
blue: output_component3
white: output_component4
Configuration variables:
~~~~~~~~~~~~~~~~~~~~~~~~
- **name** (**Required**, string): The name of the light.
- **red** (**Required**,
`id </esphomeyaml/configuration-types.html#id>`__): The id of the
float `output component </esphomeyaml/components/output/index.html>`__
to use for the red channel.
- **green** (**Required**,
`id </esphomeyaml/configuration-types.html#id>`__): The id of the
float `output component </esphomeyaml/components/output/index.html>`__
to use for the green channel.
- **blue** (**Required**,
`id </esphomeyaml/configuration-types.html#id>`__): The id of the
float `output component </esphomeyaml/components/output/index.html>`__
to use for the blue channel.
- **white** (**Required**,
`id </esphomeyaml/configuration-types.html#id>`__): The id of the
float `output component </esphomeyaml/components/output/index.html>`__
to use for the white channel.
- **gamma_correct** (*Optional*, float): The `gamma correction
factor <https://en.wikipedia.org/wiki/Gamma_correction>`__ for the
light. Defaults to ``2.8``.
- **default_transition_length** (*Optional*,
`time </esphomeyaml/configuration-types.html#time>`__): The length of
the transition if no transition parameter is provided by Home
Assistant. Defaults to ``1s``.
- **id** (*Optional*,
`id </esphomeyaml/configuration-types.html#id>`__): Manually specify
the ID used for code generation.
- All other options from `MQTT
Component </esphomeyaml/components/mqtt.html#mqtt-component-base-configuration>`__.

Binary file not shown.

After

Width:  |  Height:  |  Size: 124 KiB

View File

@ -0,0 +1,78 @@
Logger Component
================
The logger component automatically logs all log messages through the
serial port and through MQTT topics. By default, all logs with a
severity higher than ``DEBUG`` will be shown. Decreasing the log level
can help with the performance of the application and memory size.
.. code:: yaml
# Example configuration entry
logger:
level: DEBUG
Configuration variables:
~~~~~~~~~~~~~~~~~~~~~~~~
- **baud_rate** (*Optional*, int): The baud rate to use for the serial
UART port. Defaults to 115200.
- **log_topic** (*Optional*, string): The MQTT topic to write log
messages to. Defaults to ``<MQTT_TOPIC_PREFIX>/debug``. Empty string
disables MQTT logging.
- **tx_buffer_size** (*Optional*, string): The size of the buffer used
for log messages. Decrease this if youre having memory problems.
Defaults to 512.
- **level** (*Optional*, string): The global log level. Any log message
with a lower severity will not be shown. Defaults to DEBUG.
- **logs** (*Optional*, mapping): Manually set the log level for a
specific component or tag. See `Manual Log Levels for more
information <#manual-tag-specific-log-levels>`__.
- **id** (*Optional*,
`id </esphomeyaml/configuration-types.html#id>`__): Manually specify
the ID used for code generation.
Log Levels
~~~~~~~~~~
Possible log levels are (sorted by severity):
- ``NONE``
- ``ERROR``
- ``WARN``
- ``INFO``
- ``DEBUG``
- ``VERBOSE``
Manual Tag-Specific Log Levels
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If some component is spamming the logs and you want to manually set the
log level for it, first identify the tag of the log messages in question
and then disable them in your configuration.
Suppose we want to have verbose log messages globally, but the MQTT
client spams too much. In the following example, wed first see that the
tag of the MQTT client is ``mqtt.client`` (before the first colon) and
the tag for MQTT components is ``mqtt.component``.
|image0|
Next, we can manually set the log levels in the configuration like this:
.. code:: yaml
logger:
level: VERBOSE
logs:
mqtt.component: DEBUG
mqtt.client: ERROR
Please note that the global log level determines what log messages are
saved in the binary. So for example a ``INFO`` global log message will
purge all ``DEBUG`` log statements from the binary in order to conserve
space. This however means that you cannot set tag-specific log levels
that have a lower severity than the global log level.
.. |image0| image:: /esphomeyaml/components/logger-manual-log-level.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

View File

@ -0,0 +1,248 @@
MQTT Client Component
=====================
The MQTT Client Component sets up the MQTT connection to your broker and
is currently required for esphomelib to work. In most cases, you will
just be able to copy over the `MQTT
section <https://www.home-assistant.io/components/mqtt/>`__ of your Home
Assistant configuration.
.. code:: yaml
# Example configuration entry
mqtt:
broker: 10.0.0.2
username: livingroom
password: MyMQTTPassword
Configuration variables:
~~~~~~~~~~~~~~~~~~~~~~~~
- **broker** (**Required**, string): The host of your MQTT broker.
- **port** (*Optional*, int): The port to connect to. Defaults to 1883.
- **username** (*Optional*, string): The username to use for
authentication. Empty (the default) means no authentication.
- **password** (*Optional*, string): The password to use for
authentication. Empty (the default) means no authentication.
- **client_id** (*Optional*, string): The client id to use for opening
connections. See `Defaults <#defaults>`__ for more information.
- **discovery** (*Optional*, boolean): If Home Assistant automatic
discovery should be enabled. Defaults to ``True``.
- **discovery_retain** (*Optional*, boolean): Whether to retain MQTT
discovery messages so that entities are added automatically on Home
Assistant restart. Defaults to ``True``.
- **discovery_prefix** (*Optional*, string): The prefix to use for Home
Assistants MQTT discovery. Should not contain trailing slash.
Defaults to ``homeassistant``.
- **topic_prefix** (*Optional*, string): The prefix used for all MQTT
messages. Should not contain trailing slash. Defaults to
``<APP_NAME>``.
- **log_topic** (*Optional*, `MQTTMessage <#mqttmessage>`__) The topic to send MQTT log
messages to.
- **birth_message** (*Optional*, `MQTTMessage <#mqttmessage>`__): The message to send when
a connection to the broker is established. See `Last Will And Birth
Messages <#last-will-and-birth-messages>`__ for more information.
- **will_message** (*Optional*, `MQTTMessage <#mqttmessage>`__): The message to send when
the MQTT connection is dropped. See `Last Will And Birth
Messages <#last-will-and-birth-messages>`__ for more information.
- **ssl_fingerprints** (*Optional*, list): Only on ESP8266. A list of SHA1 hashes used
for verifying SSL connections. See `SSL Fingerprints <#ssl-fingerprints>`__
for more information.
- **keepalive** (*Optional*, `time </esphomeyaml/configuration-types.html#time>`__): The time
to keep the MQTT socket alive, decreasing this can help with overall stability due to more
WiFi traffic with more pings. Defaults to 15 seconds.
- **id** (*Optional*,
`id </esphomeyaml/configuration-types.html#id>`__): Manually specify
the ID used for code generation.
MQTTMessage
~~~~~~~~~~~
With the MQTT Message schema you can tell esphomeyaml how a specific MQTT message should be sent.
It is used in several places like last will and birth messages or MQTT log options.
.. code:: yaml
# Simple:
some_option: topic/to/send/to
# Disable:
some_option:
# Advanced:
some_option:
topic: topic/to/send/to
payload: online
qos: 0
retain: True
Configuration options:
- **topic** (*Required*, string): The MQTT topic to publish the message.
- **payload** (*Required*, string): The message content. Will be filled by the actual payload with some
options, like log_topic.
- **qos** (*Optional*, int): The `Quality of
Service <https://www.hivemq.com/blog/mqtt-essentials-part-6-mqtt-quality-of-service-levels>`__
level of the topic. Defaults to 0.
- **retain** (*Optional*, boolean): If the published message should
have a retain flag on or not. Defaults to ``True``.
Using with Home Assistant
~~~~~~~~~~~~~~~~~~~~~~~~~
Using esphomelib with Home Assistant is easy, simply setup an MQTT
broker (like `mosquitto <https://mosquitto.org/>`__) and point both your
Home Assistant installation and esphomelib to that broker. Next, enable
discovery in your Home Assistant configuration with the following:
.. code:: yaml
# Example Home Assistant configuration.yaml entry
mqtt:
broker: ...
discovery: True
And that should already be it 🎉 All devices defined through
esphomelib/esphomeyaml should show up automatically in the entities
section of Home Assistant.
When adding new entities, you might run into trouble with old entities
still appearing in Home Assistants front-end. This is because in order
to have Home Assistant “discover” your devices on restart, all discovery
MQTT messages need to be retained. Therefore the old entities will also
re-appear on every Home Assistant restart even though theyre in
eshomeyaml anymore.
To fix this, esphomeyaml has a simple helper script that purges stale
retained messages for you:
.. code:: bash
esphomeyaml configuration.yaml clean-mqtt
This will remove all retained messages with the topic
``<DISCOVERY_PREFIX>/+/NODE_NAME/#``. If you want to purge on another
topic, simply add ``--topic <your_topic>`` to the command.
Defaults
~~~~~~~~
By default, esphomelib will prefix all messages with your node name or
``topic_prefix`` if you have specified it manually. The client id will
automatically be generated by using your node name and adding the MAC
address of your device to it. Next, discovery is enabled by default with
Home Assistants default prefix ``homeassistant``.
If you want to prefix all MQTT messages with a different prefix, like
``home/living_room``, you can specify a custom ``topic_prefix`` in the
configuration. That way, you can use your existing wildcards like
``home/+/#`` together with esphomelib. All other features of esphomelib
(like availabilty) should still work correctly.
Last Will And Birth Messages
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
esphomelib (and esphomeyaml) uses the `last will
testament <https://www.hivemq.com/blog/mqtt-essentials-part-9-last-will-and-testament>`__
and birth message feature of MQTT to achieve availabilty reporting for
Home Assistant. If the node is not connected to MQTT, Home Assistant
will show all its entities as unavailable (a feature 😉).
|image0|
By default, esphomelib will send a retained MQTT message to
``<TOPIC_PREFIX>/status`` with payload ``online``, and will tell the
broker to send a message ``<TOPIC_PREFIX>/status`` with payload
``offline`` if the connection drops.
You can change these messages by overriding the ``birth_message`` and
``will_message`` with the following options.
.. code:: yaml
mqtt:
# ...
birth_message:
topic: myavailability/topic
payload: online
will_message:
topic: myavailability/topic
payload: offline
- **birth_message** (*Optional*, `MQTTMessage <#mqttmessage>`__)
- **will_message** (*Optional*, `MQTTMessage <#mqttmessage>`__)
If the birth message and last will message have empty topics or topics
that are different from each other, availabilty reporting will be
disabled.
SSL Fingerprints
~~~~~~~~~~~~~~~~
On the ESP8266 you have the option to use SSL connections for MQTT. This feature
will get expanded to the ESP32 once the base library, AsyncTCP, supports it. Please
note that the SSL feature only checks the SHA1 hash of the SSL certificate to verify
the integrity of the connection, so every time the certificate changes, you'll have to
update the fingerprints variable. Additionally, SHA1 is known to be partially insecure
and with some computing power the fingerprint can be faked.
To get this fingerprint, first put the broker and port options in the configuration and
then run the ``mqtt-fingerprint`` script of esphomeyaml to get the certificate:
.. code:: bash
esphomeyaml livingroom.yaml mqtt-fingerprint
> SHA1 Fingerprint: a502ff13999f8b398ef1834f1123650b3236fc07
> Copy above string into mqtt.ssl_fingerprints section of livingroom.yaml
.. code:: yaml
mqtt:
# ...
ssl_fingerprints:
- a502ff13999f8b398ef1834f1123650b3236fc07
MQTT Component Base Configuration
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
All components in esphomelib that do some sort of communication through
MQTT can have some overrides for specific options.
.. code:: yaml
name: "Component Name"
# Optional variables:
retain: True
discovery: True
availabilty:
topic: livingroom/status
payload_available: online
payload_not_available: offline
state_topic: livingroom/custom_state_topic
command_topic: livingroom/custom_command_topic
Configuration variables:
- **name** (**Required**, string): The name to use for the MQTT
Component.
- **retain** (*Optional*, boolean): If all MQTT state messages should
be retained. Defaults to ``True``.
- **discovery** (*Optional*, boolean): Manually enable/disable
discovery for a component. Defaults to the global default.
- **availabilty** (*Optional*): Manually set what should be sent to
Home Assistant for showing entity availabilty. Default derived from
`global birth/last will message <#last-will-and-birth-messages>`__.
- **state_topic** (*Optional*, string): The topic to publish state
updates to. Defaults to
``<TOPIC_PREFIX>/<COMPONENT_TYPE>/<COMPONENT_NAME>/state``
(non-alphanumeric characters from the name are removed).
- **command_topic** (*Optional*, string): The topic to subscribe to for
commands from the remote. Defaults to
``<TOPIC_PREFIX>/<COMPONENT_TYPE>/<COMPONENT_NAME>/command``
(non-alphanumeric characters from the name are removed).
.. |image0| image:: /esphomeyaml/components/mqtt-availability.png
:class: align-center
:width: 50.0%

View File

@ -0,0 +1,38 @@
OTA Update Component
====================
With the OTA (Over The Air) update component you can upload your
firmware binaries to your node without having to use an USB cable for
uploads. esphomeyaml natively supports this through its ``run`` and
``upload`` helper scripts.
Optionally, you can also define a password to use for OTA updates so
that an intruder isnt able to upload any firmware to the ESP without
having hardware access to it. This password is also hashed
automatically, so an intruder cant extract the password from the
binary.
esphomelib also supports an “OTA safe mode”. If for some reason your
node gets into a boot loop, esphomelib will automatically try to detect
this and will go over into a safe mode after 10 unsuccessful boot
attempts. In that mode, all components are disabled and only Serial
Logging+WiFi+OTA are initialized, so that you can upload a new binary.
.. code:: yaml
# Example configuration entry
ota:
safe_mode: True
password: VERYSECURE
Configuration variables:
~~~~~~~~~~~~~~~~~~~~~~~~
- **safe_mode** (*Optional*, boolean): Whether to enable safe mode.
Defaults to ``True``.
- **password** (*Optional*, string): The password to use for updates.
- **port** (*Optional*, int): The port to use for OTA updates. Defaults
to ``3232`` for the ESP32 and ``8266`` for the ESP8266.
- **id** (*Optional*,
`id </esphomeyaml/configuration-types.html#id>`__): Manually specify
the ID used for code generation.

View File

@ -0,0 +1,39 @@
ESP8266 Software PWM Output
===========================
The ESP8266 Software PWM platform allows you to use a software PWM on
the pins GPIO0-GPIO16 on your ESP8266. As this is only a software PWM
and not a hardware PWM (like the `ESP32 LEDC
PWM </esphomeyaml/components/output/ledc.html>`__) and has a few
limitations.
- There can be a noticeable amount of flickering with increased WiFi
activity.
- The output range only goes up to about 80%.
- Its mostly fixed to a frequency of 1kHz, you can `increase this a
bit manually </api/output/esp8266-pwm.html#example-usage>`__ in code
though.
If you need a stable PWM signal, its definitely recommended to use the
successor of the ESP8266, the ESP32, and its `LEDC
peripheral </esphomeyaml/components/output/ledc.html>`__ instead.
.. code:: yaml
# Example configuration entry
output:
- platform: esp8266_pwm
pin: D1
id: pwm-output
Configuration variables:
~~~~~~~~~~~~~~~~~~~~~~~~
- **pin** (**Required**, `Pin
Schema </esphomeyaml/configuration-types.html#pin-schema>`__): The
pin to use PWM on.
- **id** (**Required**,
`id </esphomeyaml/configuration-types.html#id>`__): The id to use for
this output component.
- All other options from
`Output </esphomeyaml/components/output/index.html#base-output-configuration>`__.

View File

@ -0,0 +1,26 @@
GPIO Output
===========
The GPIO output component is quite simple: It exposes a single GPIO pin
as an output component. Note that output components are **not** switches and
will not show up in Home Assistant. See `GPIO Switch </esphomeyaml/components/switch/gpio.html>`__.
.. code:: yaml
# Example configuration entry
output:
- platform: gpio
pin: D1
id: gpio-d1
Configuration variables:
~~~~~~~~~~~~~~~~~~~~~~~~
- **pin** (**Required**, `Pin
Schema </esphomeyaml/configuration-types.html#pin-schema>`__): The
pin to use PWM on.
- **id** (**Required**,
`id </esphomeyaml/configuration-types.html#id>`__): The id to use for
this output component.
- All other options from
`Output </esphomeyaml/components/output/index.html#base-output-configuration>`__.

View File

@ -0,0 +1,62 @@
Output Component
================
Each platform of the ``output`` domain exposes some output to
esphomelib. These are grouped into two categories: ``binary`` outputs
(that can only be ON/OFF) and ``float`` outputs (like PWM, can output
any rational value between 0 and 1).
======================== ======================== ========================
|ESP8266 Software PWM|_ |GPIO Output|_ |ESP32 LEDC|_
------------------------ ------------------------ ------------------------
`ESP8266 Software PWM`_ `GPIO Output`_ `ESP32 LEDC`_
------------------------ ------------------------ ------------------------
|PCA9685|_
------------------------ ------------------------ ------------------------
`PCA9685`_
======================== ======================== ========================
.. |ESP8266 Software PWM| image:: /esphomeyaml/pwm.png
:class: component-image
.. _ESP8266 Software PWM: /esphomeyaml/components/output/esp8266_pwm.html
.. |GPIO Output| image:: /esphomeyaml/pin.svg
:class: component-image
.. _GPIO Output: /esphomeyaml/components/output/gpio.html
.. |ESP32 LEDC| image:: /esphomeyaml/pwm.png
:class: component-image
.. _ESP32 LEDC: /esphomeyaml/components/output/ledc.html
.. |PCA9685| image:: /esphomeyaml/pca9685.jpg
:class: component-image
.. _PCA9685: /esphomeyaml/components/output/pca9685.html
Base Output Configuration
~~~~~~~~~~~~~~~~~~~~~~~~~
Each output platform extends this configuration schema.
.. code:: yaml
# Example configuration entry
output:
- platform: ...
id: myoutput_id
power_supply: power_supply_id
inverted: False
max_power: 0.75
Configuration variables:
- **id** (**Required**, `id </esphomeyaml/configuration-types.html#id>`__): The id to use for this output component.
- **power_supply** (*Optional*, `id </esphomeyaml/configuration-types.html#id>`__): The `power
supply </esphomeyaml/components/power_supply.html>`__ to connect to
this output. When the output is enabled, the power supply will
automatically be switched on too.
- **inverted** (*Optional*, boolean): If the output should be treated
as inverted. Defaults to ``False``.
- **max_power** (*Optional*, float): Only for float outputs. Sets the
maximum output value of this output platform. Each value will be
multiplied by this. Must be in range from 0 to 1. Defaults to 1.

View File

@ -0,0 +1,34 @@
ESP32 LEDC Output
=================
The LEDC output component exposes a `LEDC PWM
channel <https://esp-idf.readthedocs.io/en/latest/api-reference/peripherals/ledc.html>`__
of the ESP32 as an output component.
.. code:: yaml
# Example configuration entry
output:
- platform: ledc
pin: 19
id: gpio-d1
Configuration variables:
~~~~~~~~~~~~~~~~~~~~~~~~
- **pin** (**Required**,
`pin </esphomeyaml/configuration-types.html#pin>`__): The pin to use
LEDC on. Can only be GPIO0-GPIO33.
- **id** (**Required**,
`id </esphomeyaml/configuration-types.html#id>`__): The id to use for
this output component.
- **frequency** (*Optional*, float): At which frequency to run the LEDC
channels timer. Two LEDC channels always share the same timer and
therefore also the same frequency. Defaults to 1000Hz.
- **bit_depth** (*Optional*, int): The bit depth to use for the LEDC
channel. Defaults to 12.
- **channel** (*Optional*, int): Manually set the `LEDC
channel <https://esp-idf.readthedocs.io/en/latest/api-reference/peripherals/ledc.html#configure-channel>`__
to use. Two adjacent channels share the same timer.
- All other options from
`Output </esphomeyaml/components/output/index.html#base-output-configuration>`__.

Binary file not shown.

After

Width:  |  Height:  |  Size: 199 KiB

View File

@ -0,0 +1,39 @@
PCA9685 PWM Output
==================
The PCA9685 output component exposes a PCA9685 PWM channel of a global
`PCA9685 hub </esphomeyaml/components/pca9685.html>`__ as a float
output.
.. figure:: /esphomeyaml/components/output/pca9685-full.jpg
:align: center
:target: `Adafruit`_
:width: 50.0%
PCA9685 16-Channel PWM Driver. Image by `Adafruit`_.
.. _Adafruit: https://www.adafruit.com/product/815
.. code:: yaml
# Example configuration entry
pca9685:
- id: 'pca9685_hub1'
frequency: 500
# Individual outputs
output:
- platform: pca9685
id: 'pca9685_output1'
pca9685_id: 'pca9685_hub1'
channel: 0
Configuration variables:
~~~~~~~~~~~~~~~~~~~~~~~~
- **id** (**Required**, `id </esphomeyaml/configuration-types.html#id>`__): The id to use for this output component.
- **channel** (**Required**, int): Chose the channel of the PCA9685 of
this output component. Must be in range from 0 to 15.
- All other options from
`Output </esphomeyaml/components/output/index.html#base-output-configuration>`__.
- **pca9685_id** (*Optional* `id </esphomeyaml/configuration-types.html#id>`__): Manually specify the ID of the `PCA9685 hub </esphomeyaml/components/pca9685.html`__. Use this if you have multiple PCA9685s you want to use at the same time.

Some files were not shown because too many files have changed in this diff Show More