Skip to content

Commit 8d91d65

Browse files
committed
Updates
1 parent 7299d1e commit 8d91d65

14 files changed

+136
-100
lines changed

changelog/v1.10.0.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ of time to find+fix some final bugs.
5555

5656
First, make sure you run at least Home Assistant 0.85.0 (currently a
5757
`beta release <https://www.home-assistant.io/docs/installation/updating/#run-the-beta-version>`__).
58-
Then, go through the :ref:`migration guide here <api-mqtt_to_native>`.
58+
Then, go through the migration guide here (removed).
5959

6060
Python 3 Compatibility
6161
----------------------

components/api.rst

+34-83
Original file line numberDiff line numberDiff line change
@@ -34,91 +34,9 @@ Configuration variables:
3434
- **reboot_timeout** (*Optional*, :ref:`time <config-time>`): The amount of time to wait before rebooting when no
3535
client connects to the API. This is needed because sometimes the low level ESP functions report that
3636
the ESP is connected to the network, when in fact it is not - only a full reboot fixes it.
37-
Can be disabled by setting this to ``0s``. Defaults to ``5min``.
37+
Can be disabled by setting this to ``0s``. Defaults to ``15min``.
3838
- **id** (*Optional*, :ref:`config-id`): Manually specify the ID used for code generation.
3939

40-
.. _api-mqtt_to_native:
41-
42-
Migrating from MQTT to Native API Setup in Home Assistant
43-
---------------------------------------------------------
44-
45-
The native API is the best way to use ESPHome together with Home Assistant - it's fast,
46-
highly efficient and requires almost zero setup (whereas MQTT requires you to set up an MQTT broker first).
47-
48-
If you've previously used ESPHome with Home Assistant via MQTT and have enabled MQTT discovery,
49-
the upgrade process is unfortunately not just swapping out the ``mqtt`` for ``api`` in your configuration:
50-
Home Assistant's `entity registry <https://developers.home-assistant.io/docs/en/entity_registry_index.html>`__ complicates
51-
things a bit. If you don't follow these steps, all your new native API entities will have a trailing
52-
``_2`` at the end of the entity ID.
53-
54-
You can repeat these steps for all your nodes, or convert them over to the new native API one by one.
55-
56-
1. Disable MQTT discovery on ESP side. In your ESPHome configuration, set a special "clean" discovery flag:
57-
58-
.. code-block:: yaml
59-
60-
# In your ESPHome configuration! Not HA config!
61-
mqtt:
62-
# Other settings ...
63-
discovery: clean
64-
65-
2. Compile and upload this new firmware. All entities should now be gone from Home Assistant.
66-
67-
3. Go to your Home Assistant configuration folder and go to the ``.storage`` folder (might be hidden
68-
depending on your operating system). In there you will find a file called ``core.entity_registry`` - open
69-
the file with a text editor and paste the contents below
70-
71-
72-
.. raw:: html
73-
74-
<textarea rows="10" cols="50" id="entity-reg-converter"></textarea>
75-
<button type="button" id="entity-reg-button">Convert Entity Registry</button>
76-
<script>
77-
var elem = document.getElementById("entity-reg-converter");
78-
elem.addEventListener("click", function() {
79-
elem.focus();
80-
elem.select();
81-
});
82-
document.getElementById("entity-reg-button").addEventListener("click", function() {
83-
try {
84-
data = JSON.parse(elem.value);
85-
} catch(e) {
86-
alert(e);
87-
}
88-
var entities = data.data.entities;
89-
var newEntities = [];
90-
for (var i = 0; i < entities.length; i++) {
91-
var entity = entities[i];
92-
if (entity.platform != "mqtt") {
93-
newEntities.push(entity);
94-
}
95-
}
96-
data.data.entities = newEntities;
97-
elem.value = JSON.stringify(data, null, 4);
98-
});
99-
</script>
100-
101-
4. Stop Home Assistant - this is necessary for the entity registry changes not to become overriden.
102-
103-
5. Convert the Entity Registry file above using the "Convert Entity Registry Button", and
104-
override the ``.storage/core.entity_registry`` file with the new contents.
105-
106-
6. Start Home Assistant.
107-
108-
7. Now you can enable the ESPHome native API (and upload the new firmware)
109-
110-
.. code-block:: yaml
111-
112-
# Example configuration entry
113-
api:
114-
115-
8. In Home Assistant, go to "Configuration" -> "Integrations" - if you've set up the ``discovery:`` component,
116-
you'll already see the ESP as a suggestion to be configured. But if you're having issues with that, you can
117-
always manually set up an ESPHome device using "Set up a new integration" -> "ESPHome".
118-
119-
9. Now you can remove ``mqtt:`` from your ESPHome configuration. You don't have to, but doing so will
120-
free up resources (of which these ESPs don't have too much).
121-
12240
.. _api-homeassistant_service_action:
12341

12442
``homeassistant.service`` Action
@@ -220,6 +138,11 @@ There are currently 4 types of variables:
220138
- float: A floating point number. C++ type: ``float``
221139
- string: A string. C++ type: ``std::string``
222140

141+
Each of these also exist in array form:
142+
143+
- bool[]: An array of boolean values. C++ type: ``std::vector<bool>``
144+
- ... - Same for other types.
145+
223146
.. _api-connected_condition:
224147

225148
``api.connected`` Condition
@@ -257,6 +180,34 @@ never be removed. Features of native API (vs. MQTT):
257180
- **Low Latency:** The native API is optimized for very low latency, usually this is only
258181
a couple of milliseconds and far less than can be noticed by the eye.
259182

183+
184+
.. _api-homeassistant_event_action:
185+
186+
``homeassistant.event`` Action
187+
------------------------------
188+
189+
When using the native API with Home Assistant, you can create events in the Home Assistant event bus
190+
straight from ESPHome :ref:`Automations <automation>`.
191+
192+
.. code-block:: yaml
193+
194+
# In some trigger
195+
on_...:
196+
# Simple
197+
- homeassistant.event:
198+
event: esphome.button_pressed
199+
data:
200+
title: Button was pressed
201+
202+
Configuration options:
203+
204+
- **event** (**Required**, string): The event to create - must begin with ``esphome.``
205+
- **data** (*Optional*, mapping): Optional *static* data to pass along with the event.
206+
- **data_template** (*Optional*, mapping): Optional template data to pass along with the event.
207+
This is evaluated on the Home Assistant side with Home Assistant's templating engine.
208+
- **variables** (*Optional*, mapping): Optional variables that can be used in the ``data_template``.
209+
Values are :ref:`lambdas <config-lambda>` and will be evaluated before sending the request.
210+
260211
See Also
261212
--------
262213

components/captive_portal.rst

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
Captive Portal
2+
==============
3+
4+
.. seo::
5+
:description: Instructions for setting up the Captive Portal fallback mechanism in ESPHome.
6+
:image: wifi-strength-alert-outline.png
7+
8+
The captive portal component in ESPHome is a fallback mechanism for when connecting to the
9+
configured :doc:`WiFi <wifi>` fails.
10+
11+
After 1 minute of unsuccesful wifi connection attempts, the ESP will start a WiFi hotspot
12+
(with the credentials from your configuration)
13+
14+
.. figure:: images/captive_portal-ui.png
15+
:align: center
16+
:width: 70.0%
17+
18+
In this web interface, you can manually override the WiFi settings of the device (please note
19+
this will be overwritten by any subsequent upload, so make sure to also update your YAML configuration).
20+
21+
Additionally, you can upload a new firmware file.
22+
23+
When you connect to the fallback network, the web interface should open automatically (see also
24+
login to network notifications). If that does not work, you can also navigate to http://192.168.4.1/
25+
manually in your browser.
26+
27+
.. code-block:: yaml
28+
29+
# Example configuration entry
30+
wifi:
31+
# ...
32+
ap:
33+
ssid: "Livingroom Fallback Hotspot"
34+
password: "W1PBGyrokfLz"
35+
36+
captive_portal:
37+
38+
39+
No configuration variables.
40+
41+
See Also
42+
--------
43+
44+
- :doc:`wifi`
45+
- :apiref:`captive_portal/captive_portal.h`
46+
- :ghedit:`Edit`
23.9 KB
Loading

components/mqtt.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ Configuration variables:
6060
for verifying SSL connections. See :ref:`mqtt-ssl_fingerprints`
6161
for more information.
6262
- **reboot_timeout** (*Optional*, :ref:`time <config-time>`): The amount of time to wait before rebooting when no
63-
MQTT connection exists. Can be disabled by setting this to ``0s``. Defaults to ``5min``.
63+
MQTT connection exists. Can be disabled by setting this to ``0s``. Defaults to ``15min``.
6464
- **keepalive** (*Optional*, :ref:`config-time`): The time
6565
to keep the MQTT socket alive, decreasing this can help with overall stability due to more
6666
WiFi traffic with more pings. Defaults to 15 seconds.

components/sensor/ads1115.rst

+3
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ Configuration variables:
3333

3434
- **address** (**Required**, int): The i²c address of the sensor.
3535
See :ref:`I²C Addresses <ads1115_i2c_addresses>` for more information.
36+
- **continuous_mode** (*Optional*, boolean): Set if the ADS1115 should continuously measure voltages or
37+
only measure them when an update is called. Please enable this for the :doc:`ct_clamp` integration.
38+
Defaults to ``off``.
3639
- **id** (*Optional*, :ref:`config-id`): Manually specify the ID for this ADS1115 Hub. Use this if you
3740
want to use multiple ADS1115 hubs at once.
3841

components/sensor/custom.rst

-6
Original file line numberDiff line numberDiff line change
@@ -360,12 +360,6 @@ Configuration variables:
360360

361361
- All options from :ref:`Sensor <config-sensor>`.
362362

363-
.. note::
364-
365-
The ``id()`` wrapper for ESPHome-lambdas is not available in custom code. However, in most
366-
cases you can drop the ``id()`` wrapper and use the ID directly: ``id(my_var).state`` ->
367-
``my_var->state``
368-
369363
Logging in Custom Components
370364
----------------------------
371365

components/sensor/index.rst

+25
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ the value the sensor shows.
152152
- platform: dht
153153
# ...
154154
temperature:
155+
name: "DHT22 Temperature"
155156
filters:
156157
- calibrate_linear:
157158
# Map 0.0 (from sensor) to 0.0 (true value)
@@ -162,6 +163,30 @@ The arguments are a list of data points, each in the form ``MEASURED -> TRUTH``.
162163
then fit a linear equation to the values (using least squares). So you need to supply at least
163164
two values.
164165

166+
``calibrate_polynomial``
167+
************************
168+
169+
Calibrate your sensor values by fitting them to a polynomial functions. This is similar to
170+
the ``calibrate_linear`` filter, but also allows for higher-order functions like quadratic polynomials.
171+
172+
.. code-block:: yaml
173+
174+
# Example configuration entry
175+
- platform: adc
176+
# ...
177+
filters:
178+
- calibrate_polynomial:
179+
degree: 2
180+
datapoints:
181+
# Map 0.0 (from sensor) to 0.0 (true value)
182+
- 0.0 -> 0.0
183+
- 10.0 -> 12.1
184+
- 13.0 -> 14.0
185+
186+
The arguments are a list of data points, each in the form ``MEASURED -> TRUTH``. Additionally, you need
187+
to specify the degree of the resulting polynomial, the datapoints will then be fitted to the given
188+
degree with a least squares solver.
189+
165190
``filter_out``
166191
**************
167192

components/wifi.rst

+7-7
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,16 @@ Configuration variables:
5656
Defaults to 1.
5757
- **manual_ip** (*Optional*): Manually set the IP options for the AP. Same options as
5858
manual_ip for station mode.
59+
- **ap_timeout** (*Optional*, :ref:`time <config-time>`): The time after which to enable the
60+
configured fallback hotspot. Defaults to ``1min``.
5961

6062
- **domain** (*Optional*, string): Set the domain of the node hostname used for uploading.
6163
For example, if it's set to ``.local``, all uploads will be sent to ``<HOSTNAME>.local``.
6264
Defaults to ``.local``.
6365
- **reboot_timeout** (*Optional*, :ref:`time <config-time>`): The amount of time to wait before rebooting when no
6466
WiFi connection exists. Can be disabled by setting this to ``0s``, but note that the low level IP stack currently
65-
seems to have issues with WiFi where a full reboot is required to get the interface back working. Defaults to ``5min``.
66-
- **power_save_mode** (*Optional*, string): The power save mode for the WiFi interface. Defaults to no power saving.
67+
seems to have issues with WiFi where a full reboot is required to get the interface back working. Defaults to ``15min``.
68+
- **power_save_mode** (*Optional*, string): The power save mode for the WiFi interface.
6769
See :ref:`wifi-power_save_mode`
6870

6971
- **fast_connect** (*Optional*, boolean): If enabled, directly connects to WiFi network without doing a full scan
@@ -126,11 +128,8 @@ WiFi. While some options *can* reduce the power usage of the ESP, they generally
126128
reliability of the WiFi connection, with frequent disconnections from the router in the highest
127129
power saving mode.
128130

129-
The default is ``none`` (a bit of power saving). If you experience frequent WiFi disconnection problems,
130-
please also try ``light``.
131-
132-
- ``NONE`` (least power saving, Default)
133-
- ``LIGHT``
131+
- ``NONE`` (least power saving, Default for ESP8266)
132+
- ``LIGHT`` (Default for ESP32)
134133
- ``HIGH`` (most power saving)
135134

136135
.. code-block:: yaml
@@ -192,5 +191,6 @@ This :ref:`Condition <config-condition>` checks if the WiFi client is currently
192191
See Also
193192
--------
194193

194+
- :doc:`captive_portal`
195195
- :apiref:`wifi/wifi_component.h`
196196
- :ghedit:`Edit`

guides/automations.rst

+2
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,8 @@ There is one caveat though: ESPHome automatically reboots if no connection to th
307307
made. This is because the ESPs typically have issues in their network stacks that require a reboot to fix.
308308
You can adjust this behavior (or even disable automatic rebooting) using the ``reboot_timeout`` option
309309
in the :doc:`wifi component </components/wifi>` and :doc:`mqtt component </components/mqtt>`.
310+
(Beware that effectively disables the reboot watchdog, so you will need to power cycle the device
311+
if it fails to connect to the network without a reboot)
310312

311313
All Triggers
312314
------------

guides/cli.rst

+10-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,16 @@ ESPHome's command line interface always has the following format
1111

1212
.. code-block:: console
1313
14-
esphome <CONFIGURATION> <COMMAND> [ARGUMENTS]
14+
esphome <CONFIGURATION...> <COMMAND> [ARGUMENTS]
15+
16+
.. note::
17+
18+
You can specify multiple configuration files in the command line interface,
19+
just list all files in front of the <COMMAND> like so:
20+
21+
.. code-block:: console
22+
23+
esphome livingroom.yaml kitchen.yaml run
1524
1625
1726
``run`` Command
+1
Loading

index.rst

+2
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,8 @@ Misc Components
300300
PCF8574 I/O Expander, components/pcf8574, pcf8574.jpg
301301
MCP23017 I/O Expander, components/mcp23017, mcp23017.svg
302302
SIM800L, components/sim800l, sim800l.jpg
303+
304+
Captive Portal, components/captive_portal, wifi-strength-alert-outline.svg
303305
Debug Component, components/debug, bug-report.svg
304306

305307
Additional Custom Components

sitemap.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,12 @@ def setup(app):
77
app.connect('html-page-context', add_html_link)
88
app.connect('build-finished', create_sitemap)
99
app.sitemap_links = []
10+
11+
is_production = os.getenv('PRODUCTION') == 'YES'
12+
1013
return {"version": "1.0.0",
1114
"parallel_read_safe": True,
12-
"parallel_write_safe": True}
15+
"parallel_write_safe": not is_production}
1316

1417

1518
def add_html_link(app, pagename, templatename, context, doctree):

0 commit comments

Comments
 (0)