Skip to content

Commit 21d9622

Browse files
authored
Merge branch 'current' into guide_for_noobs
2 parents 33f813d + f53ecbe commit 21d9622

File tree

15 files changed

+173
-14
lines changed

15 files changed

+173
-14
lines changed

Doxygen

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ PROJECT_NAME = "ESPHome"
3838
# could be handy for archiving the generated documentation or if some version
3939
# control system is used.
4040

41-
PROJECT_NUMBER = 2024.10.2
41+
PROJECT_NUMBER = 2024.10.3
4242

4343
# Using the PROJECT_BRIEF tag one can provide an optional one line description
4444
# for a project that appears at the top of each page and should give viewer a

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
ESPHOME_PATH = ../esphome
2-
ESPHOME_REF = 2024.10.2
2+
ESPHOME_REF = 2024.10.3
33
PAGEFIND_VERSION=1.1.1
44
PAGEFIND=pagefind
55
NET_PAGEFIND=../pagefindbin/pagefind

_static/version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2024.10.2
1+
2024.10.3

changelog/2024.10.0.rst

+7
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,13 @@ Release 2024.10.2 - October 24
6565
- [lvgl] Some properties were not templatable (Bugfix) :esphomepr:`7655` by :ghuser:`clydebarrow`
6666
- [voice_assistant] Bugfix: Fix crash on start :esphomepr:`7662` by :ghuser:`kahrendt`
6767

68+
Release 2024.10.3 - November 8
69+
------------------------------
70+
71+
- [rpi_dpi_rgb] Fix get_width and height (Bugfix) :esphomepr:`7675` by :ghuser:`clydebarrow`
72+
- Fixes modbus timing error :esphomepr:`7674` by :ghuser:`exciton`
73+
- [lvgl] Ensure images are configured before using them. (Bugfix) :esphomepr:`7721` by :ghuser:`clydebarrow`
74+
6875
Full list of changes
6976
--------------------
7077

components/cover/current_based.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ Configuration example:
132132
scl: GPIO14
133133
134134
sensor:
135-
- platform: ade7953
135+
- platform: ade7953_i2c
136136
irq_pin: GPIO16
137137
voltage:
138138
name: Shelly 2.5 Mains Voltage

components/http_request.rst

+13-3
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,10 @@ can assign values to keys by using the ``root["KEY_NAME"] = VALUE;`` syntax as s
246246
247247
GET values from a JSON body response
248248
************************************
249+
If you want to retrieve the value for the vol key and assign it to a template sensor or number component whose id is
250+
set to player_volume you can do this, but note that checking for the presence of the key will prevent difficult-to-read
251+
error messages:
252+
249253

250254
This example assumes that the server returns a response as a JSON object similar to this:
251255
``{"status":"play","vol":"42","mute":"0"}``
@@ -263,14 +267,20 @@ whose ``id`` is set to ``player_volume``:
263267
then:
264268
- lambda: |-
265269
json::parse_json(body, [](JsonObject root) -> bool {
266-
id(player_volume).publish_state(root["vol"]);
267-
return true;
270+
if (root["vol"]) {
271+
id(player_volume).publish_state(root["vol"]);
272+
return true;
273+
}
274+
else {
275+
ESP_LOGD(TAG,"No 'vol' key in this json!");
276+
return false;
277+
}
268278
});
269279
270-
271280
See Also
272281
--------
273282

274283
- :doc:`index`
275284
- :apiref:`http_request/http_request.h`
285+
- :doc:`/components/json`
276286
- :ghedit:`Edit`

components/json.rst

+132
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
json Component
2+
==============
3+
4+
.. seo::
5+
:description: Instructions for parsing and building json within ESPHome.
6+
:keywords: json
7+
8+
The ``json`` component enables ESPHome to work with JSON data in automations, sensors, and HTTP requests. This is particularly useful for:
9+
10+
- Processing API responses
11+
- Sending structured data to external services
12+
- Parsing configuration from JSON files
13+
14+
What is JSON?
15+
16+
JSON is a text syntax that facilitates structured data interchange between all programming languages. JSON
17+
is a syntax of braces, brackets, colons, and commas that is useful in many contexts, profiles, and applications.
18+
JSON stands for JavaScript Object Notation and was inspired by the object literals of JavaScript aka
19+
ECMAScript as defined in the `ECMAScript Language Specification, Third Edition <https://ecma-international.org/wp-content/uploads/ECMA-404_2nd_edition_december_2017.pdf>`_ .
20+
21+
Example 1: Relatively complex JSON
22+
23+
.. code-block:: json
24+
25+
{
26+
"first_name": "John",
27+
"last_name": "Smith",
28+
"is_alive": true,
29+
"age": 27,
30+
"address": {
31+
"street_address": "21 2nd Street",
32+
"city": "New York",
33+
"state": "NY",
34+
"postal_code": "10021-3100"
35+
},
36+
"phone_numbers": [
37+
{
38+
"type": "home",
39+
"number": "212 555-1234"
40+
},
41+
{
42+
"type": "office",
43+
"number": "646 555-4567"
44+
}
45+
],
46+
"children": [
47+
"Catherine",
48+
"Thomas",
49+
"Trevor"
50+
],
51+
"spouse": null
52+
}
53+
54+
Example 2: Simple JSON:
55+
56+
.. code-block:: json
57+
58+
{"key": 42.0, "greeting": "Hello World"}
59+
60+
61+
Parsing JSON:
62+
-------------
63+
64+
This example assumes that the server returns a response as a JSON object similar to this:
65+
``{"status":"play","vol":"42","mute":"0"}``
66+
67+
68+
If you want to retrieve the value for the ``vol`` key and assign it to a template ``sensor`` or ``number`` component
69+
whose ``id`` is set to ``player_volume`` you can do this, but note that checking for the presence of the key will prevent difficult-to-read error messages:
70+
71+
.. code-block:: yaml
72+
73+
on_...:
74+
- http_request.get:
75+
url: https://esphome.io
76+
capture_response: true
77+
on_response:
78+
then:
79+
- lambda: |-
80+
json::parse_json(body, [](JsonObject root) -> bool {
81+
if (root["vol"]) {
82+
id(player_volume).publish_state(root["vol"]);
83+
return true;
84+
}
85+
else {
86+
ESP_LOGD(TAG,"No 'vol' key in this json!");
87+
return false;
88+
}
89+
});
90+
91+
92+
Building JSON:
93+
--------------
94+
95+
You can build JSON in a lambda with a nested array like this:
96+
97+
.. code-block::
98+
99+
on_...:
100+
- http_request.post:
101+
url: https://esphome.io
102+
json: |-
103+
root["key"] = id(my_sensor).state;
104+
root["greeting"] = "Hello World";
105+
106+
This will send::
107+
``{"key": 42.0, "greeting": "Hello World"}``
108+
109+
110+
Troubleshooting Errors:
111+
-----------------------
112+
A very common error when deserializing is:
113+
114+
.. code-block::
115+
116+
JSON parse error: InvalidInput
117+
118+
The software ESPHome uses does not provide particularly informative messages as to why, but
119+
the people at ArduinoJson have created a `wonderful troubleshooter <https://arduinojson.org/troubleshooter>`__.
120+
121+
Another important resource is `JSONLint <https://jsonlint.com/>`__. It will help you determine if the JSON you are using is valid. It must be valid to work with ESPHome's deserializer and it probably needs to be valid for the destination, if you are sending it.
122+
123+
124+
See Also
125+
--------
126+
127+
- :doc:`index`
128+
- :apiref:`http_request/http_request.h`
129+
- :apiref:`json/json_util.h`
130+
- `ArduinoJson <https://arduinojson.org/>`
131+
- :ghedit:`Edit`
132+

components/mqtt.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ in which case this is not needed.
1212

1313
.. warning::
1414

15-
If you enable MQTT and you do *not* use the "native API" for Home Assistant, you must
16-
remove the ``api:`` line from your ESPHome configuration, otherwise the ESP will
15+
If you enable MQTT and you do *not* use the :doc:`/components/api`, you must
16+
remove the ``api:`` configuration or set ``reboot_timeout: 0s``, otherwise the ESP will
1717
reboot every 15 minutes because no client connected to the native API.
1818

1919
.. code-block:: yaml

components/sensor/bme280.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ Configuration variables:
6060
See :ref:`Oversampling Options <bme280-oversampling>`.
6161
- All other options from :ref:`Sensor <config-sensor>`.
6262

63-
- **humidity** (*Optional*): The information for the pressure sensor.
63+
- **humidity** (*Optional*): The information for the humidity sensor.
6464

6565
- **oversampling** (*Optional*): The oversampling parameter for the temperature sensor.
6666
See :ref:`Oversampling Options <bme280-oversampling>`.

conf.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
# The short X.Y version.
7272
version = "2024.10"
7373
# The full version, including alpha/beta/rc tags.
74-
release = "2024.10.2"
74+
release = "2024.10.3"
7575

7676
# The language for content autogenerated by Sphinx. Refer to documentation
7777
# for a list of supported languages.

cookbook/lvgl.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -1875,8 +1875,8 @@ The weather condition icons we use are from MDI. We import just the ones corresp
18751875
width: 228
18761876
height: 250
18771877
pad_all: 10
1878-
pad_column: 0
18791878
layout:
1879+
pad_column: 0
18801880
type: GRID
18811881
grid_rows: [FR(48), FR(13), FR(13), FR(13), FR(13)]
18821882
grid_columns: [FR(10), FR(40), FR(40), FR(10)]

guides/supporters.rst

+9-1
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ Contributors
157157
- `杨成锴 (@asjdf) <https://github.com/asjdf>`__
158158
- `Pavel Pletenev (@ASMfreaK) <https://github.com/ASMfreaK>`__
159159
- `Andreas Soehlke (@asoehlke) <https://github.com/asoehlke>`__
160+
- `Aaron Solochek (@asolochek) <https://github.com/asolochek>`__
160161
- `Mike Dunston (@atanisoft) <https://github.com/atanisoft>`__
161162
- `Glenn Morrison (@atomicpapa) <https://github.com/atomicpapa>`__
162163
- `Alexander Turlov (@aturlov) <https://github.com/aturlov>`__
@@ -313,6 +314,7 @@ Contributors
313314
- `Chris Feenstra (@cfeenstra1024) <https://github.com/cfeenstra1024>`__
314315
- `Filipe Mendonça (@cfilipem) <https://github.com/cfilipem>`__
315316
- `cg089 (@cg089) <https://github.com/cg089>`__
317+
- `Chad Matsalla (@ChadMatsalla) <https://github.com/ChadMatsalla>`__
316318
- `Kostas Chatzikokolakis (@chatziko) <https://github.com/chatziko>`__
317319
- `chbmuc (@chbmuc) <https://github.com/chbmuc>`__
318320
- `Audric Schiltknecht (@chemicalstorm) <https://github.com/chemicalstorm>`__
@@ -961,6 +963,7 @@ Contributors
961963
- `João Vitor M. Roma (@jvmr1) <https://github.com/jvmr1>`__
962964
- `Jack Wozny (@jwozny) <https://github.com/jwozny>`__
963965
- `Jozef Zuzelka (@jzlka) <https://github.com/jzlka>`__
966+
- `Jordan Zucker (@jzucker2) <https://github.com/jzucker2>`__
964967
- `Kris (@K-r-i-s-t-i-a-n) <https://github.com/K-r-i-s-t-i-a-n>`__
965968
- `k0rtina (@k0rtina) <https://github.com/k0rtina>`__
966969
- `Harald Nagel (@k7hpn) <https://github.com/k7hpn>`__
@@ -1135,6 +1138,7 @@ Contributors
11351138
- `Kasper Malfroid (@malfroid) <https://github.com/malfroid>`__
11361139
- `Malle355 (@Malle355) <https://github.com/Malle355>`__
11371140
- `raymonder jin (@mamil) <https://github.com/mamil>`__
1141+
- `Manish Madan (@manishxmadan) <https://github.com/manishxmadan>`__
11381142
- `manonfgoo (@manonfgoo) <https://github.com/manonfgoo>`__
11391143
- `Manuel Kasper (@manuelkasper) <https://github.com/manuelkasper>`__
11401144
- `Manuel Díez (@manutenfruits) <https://github.com/manutenfruits>`__
@@ -1273,6 +1277,7 @@ Contributors
12731277
- `Sam Hughes (@MrEditor97) <https://github.com/MrEditor97>`__
12741278
- `MrEditor97 (@mreditor97) <https://github.com/mreditor97>`__
12751279
- `MRemy2 (@MRemy2) <https://github.com/MRemy2>`__
1280+
- `Mathieu Rene (@mrene) <https://github.com/mrene>`__
12761281
- `Morgan Robertson (@mrgnr) <https://github.com/mrgnr>`__
12771282
- `Simon Sasburg (@MrHacky) <https://github.com/MrHacky>`__
12781283
- `Mariusz Kryński (@mrk-its) <https://github.com/mrk-its>`__
@@ -1643,6 +1648,7 @@ Contributors
16431648
- `Sean True (@seantrue) <https://github.com/seantrue>`__
16441649
- `Sebastian Rasor (@sebastianrasor) <https://github.com/sebastianrasor>`__
16451650
- `sebcaps (@sebcaps) <https://github.com/sebcaps>`__
1651+
- `SeByDocKy (@SeByDocKy) <https://github.com/SeByDocKy>`__
16461652
- `Seganku (@seganku) <https://github.com/seganku>`__
16471653
- `Stefan Seyfried (@seife) <https://github.com/seife>`__
16481654
- `sekkr1 (@sekkr1) <https://github.com/sekkr1>`__
@@ -1692,6 +1698,7 @@ Contributors
16921698
- `smischny (@smischny) <https://github.com/smischny>`__
16931699
- `Jacob Masen-Smith (@smithjacobj) <https://github.com/smithjacobj>`__
16941700
- `John Mueller (@softplus) <https://github.com/softplus>`__
1701+
- `Kyle Cascade (@solarkennedy) <https://github.com/solarkennedy>`__
16951702
- `Luca Zimmermann (@soundstorm) <https://github.com/soundstorm>`__
16961703
- `Sourabh Jaiswal (@sourabhjaiswal) <https://github.com/sourabhjaiswal>`__
16971704
- `Philip Allgaier (@spacegaier) <https://github.com/spacegaier>`__
@@ -1962,6 +1969,7 @@ Contributors
19621969
- `Mike Brown (@xenoxaos) <https://github.com/xenoxaos>`__
19631970
- `xheronimo (@xheronimo) <https://github.com/xheronimo>`__
19641971
- `Huw Percival (@xhuw) <https://github.com/xhuw>`__
1972+
- `Luciano Martin (@xluciano) <https://github.com/xluciano>`__
19651973
- `Péter Sárközi (@Xmister) <https://github.com/Xmister>`__
19661974
- `xmos-jenkins (@xmos-jenkins) <https://github.com/xmos-jenkins>`__
19671975
- `xmos-jmccarthy (@xmos-jmccarthy) <https://github.com/xmos-jmccarthy>`__
@@ -2006,4 +2014,4 @@ Contributors
20062014
- `Christian Zufferey (@zuzu59) <https://github.com/zuzu59>`__
20072015
- `Zynth-dev (@Zynth-dev) <https://github.com/Zynth-dev>`__
20082016

2009-
*This page was last updated October 24, 2024.*
2017+
*This page was last updated November 8, 2024.*

images/json.svg

+1
Loading

index.rst

+1
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ ESPHome-specific components or components supporting ESPHome device provisioning
172172
Improv via BLE, components/esp32_improv, improv.svg, dark-invert
173173
Improv via Serial, components/improv_serial, improv.svg, dark-invert
174174
Interval, components/interval, description.svg, dark-invert
175+
JSON, components/json, json.svg, dark-invert
175176
Script, components/script, description.svg, dark-invert
176177

177178
ESPHome Configuration

requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
sphinx==7.1.2
22
sphinx-autobuild==2021.3.14
3-
sphinx-tabs==3.4.5
3+
sphinx-tabs==3.4.7
44
sphinx-toolbox==3.8.0

0 commit comments

Comments
 (0)