mirror of
https://github.com/esphome/esphome-docs.git
synced 2025-01-12 20:10:50 +01:00
commit
fec8168bbc
2
Doxygen
2
Doxygen
@ -38,7 +38,7 @@ PROJECT_NAME = "ESPHome"
|
||||
# could be handy for archiving the generated documentation or if some version
|
||||
# control system is used.
|
||||
|
||||
PROJECT_NUMBER = 2022.1.0b2
|
||||
PROJECT_NUMBER = 2022.1.0b3
|
||||
|
||||
# Using the PROJECT_BRIEF tag one can provide an optional one line description
|
||||
# for a project that appears at the top of each page and should give viewer a
|
||||
|
6
Makefile
6
Makefile
@ -1,5 +1,5 @@
|
||||
ESPHOME_PATH = ../esphome
|
||||
ESPHOME_REF = 2022.1.0b2
|
||||
ESPHOME_REF = 2022.1.0b3
|
||||
|
||||
.PHONY: html html-strict cleanhtml deploy help webserver Makefile netlify netlify-api api netlify-dependencies svg2png copy-svg2png minify
|
||||
|
||||
@ -10,8 +10,8 @@ html-strict:
|
||||
sphinx-build -M html . _build -W -j auto -n $(O)
|
||||
|
||||
minify:
|
||||
minify -o _static/webserver-v1.min.js _static/webserver-v1.js
|
||||
minify -o _static/webserver-v1.min.css _static/webserver-v1.css
|
||||
minify _static/webserver-v1.js > _static/webserver-v1.min.js
|
||||
minify _static/webserver-v1.css > _static/webserver-v1.min.css
|
||||
|
||||
cleanhtml:
|
||||
rm -rf "_build/html/*"
|
||||
|
@ -1 +1 @@
|
||||
2022.1.0b2
|
||||
2022.1.0b3
|
@ -83,6 +83,15 @@ for (; row = states.rows[i]; i++) {
|
||||
});
|
||||
})(row.id);
|
||||
}
|
||||
if (row.classList.contains("number")) {
|
||||
(function(id) {
|
||||
row.children[2].children[0].addEventListener('change', function () {
|
||||
const xhr = new XMLHttpRequest();
|
||||
xhr.open("POST", '/number/' + id.substr(7) + '/set?value=' + encodeURIComponent(this.value), true);
|
||||
xhr.send();
|
||||
});
|
||||
})(row.id);
|
||||
}
|
||||
if (row.classList.contains("button")) {
|
||||
(function(id) {
|
||||
row.children[2].children[0].addEventListener('click', function () {
|
||||
|
2
_static/webserver-v1.min.js
vendored
2
_static/webserver-v1.min.js
vendored
@ -1 +1 @@
|
||||
const source=new EventSource("/events");source.addEventListener("log",(function(t){const n=document.getElementById("log");let e="";t.data.startsWith("[1;31m")?e="e":t.data.startsWith("[0;33m")?e="w":t.data.startsWith("[0;32m")?e="i":t.data.startsWith("[0;35m")?e="c":t.data.startsWith("[0;36m")?e="d":t.data.startsWith("[0;37m")?e="v":n.innerHTML+=t.data+"\n",n.innerHTML+='<span class="'+e+'">'+t.data.substr(7,t.data.length-10)+"</span>\n"})),source.addEventListener("state",(function(t){const n=JSON.parse(t.data);document.getElementById(n.id).children[1].innerText=n.state}));const states=document.getElementById("states");let row,i=0;for(;row=states.rows[i];i++)row.children[2].children.length&&(row.classList.contains("switch")&&function(t){row.children[2].children[0].addEventListener("click",(function(){const n=new XMLHttpRequest;n.open("POST","/switch/"+t.substr(7)+"/toggle",!0),n.send()}))}(row.id),row.classList.contains("fan")&&function(t){row.children[2].children[0].addEventListener("click",(function(){const n=new XMLHttpRequest;n.open("POST","/fan/"+t.substr(4)+"/toggle",!0),n.send()}))}(row.id),row.classList.contains("light")&&function(t){row.children[2].children[0].addEventListener("click",(function(){const n=new XMLHttpRequest;n.open("POST","/light/"+t.substr(6)+"/toggle",!0),n.send()}))}(row.id),row.classList.contains("cover")&&function(t){row.children[2].children[0].addEventListener("click",(function(){const n=new XMLHttpRequest;n.open("POST","/cover/"+t.substr(6)+"/open",!0),n.send()})),row.children[2].children[1].addEventListener("click",(function(){const n=new XMLHttpRequest;n.open("POST","/cover/"+t.substr(6)+"/close",!0),n.send()}))}(row.id),row.classList.contains("select")&&function(t){row.children[2].children[0].addEventListener("change",(function(){const n=new XMLHttpRequest;n.open("POST","/select/"+t.substr(7)+"/set?option="+encodeURIComponent(this.value),!0),n.send()}))}(row.id),row.classList.contains("button")&&function(t){row.children[2].children[0].addEventListener("click",(function(){const n=new XMLHttpRequest;n.open("POST","/button/"+t.substr(7)+"/press",!0),n.send()}))}(row.id));
|
||||
const source=new EventSource("/events");source.addEventListener("log",(function(t){const n=document.getElementById("log");let e="";t.data.startsWith("[1;31m")?e="e":t.data.startsWith("[0;33m")?e="w":t.data.startsWith("[0;32m")?e="i":t.data.startsWith("[0;35m")?e="c":t.data.startsWith("[0;36m")?e="d":t.data.startsWith("[0;37m")?e="v":n.innerHTML+=t.data+"\n",n.innerHTML+='<span class="'+e+'">'+t.data.substr(7,t.data.length-10)+"</span>\n"})),source.addEventListener("state",(function(t){const n=JSON.parse(t.data);document.getElementById(n.id).children[1].innerText=n.state}));const states=document.getElementById("states");let row,i=0;for(;row=states.rows[i];i++)row.children[2].children.length&&(row.classList.contains("switch")&&function(t){row.children[2].children[0].addEventListener("click",(function(){const n=new XMLHttpRequest;n.open("POST","/switch/"+t.substr(7)+"/toggle",!0),n.send()}))}(row.id),row.classList.contains("fan")&&function(t){row.children[2].children[0].addEventListener("click",(function(){const n=new XMLHttpRequest;n.open("POST","/fan/"+t.substr(4)+"/toggle",!0),n.send()}))}(row.id),row.classList.contains("light")&&function(t){row.children[2].children[0].addEventListener("click",(function(){const n=new XMLHttpRequest;n.open("POST","/light/"+t.substr(6)+"/toggle",!0),n.send()}))}(row.id),row.classList.contains("cover")&&function(t){row.children[2].children[0].addEventListener("click",(function(){const n=new XMLHttpRequest;n.open("POST","/cover/"+t.substr(6)+"/open",!0),n.send()})),row.children[2].children[1].addEventListener("click",(function(){const n=new XMLHttpRequest;n.open("POST","/cover/"+t.substr(6)+"/close",!0),n.send()}))}(row.id),row.classList.contains("select")&&function(t){row.children[2].children[0].addEventListener("change",(function(){const n=new XMLHttpRequest;n.open("POST","/select/"+t.substr(7)+"/set?option="+encodeURIComponent(this.value),!0),n.send()}))}(row.id),row.classList.contains("number")&&function(t){row.children[2].children[0].addEventListener("change",(function(){const n=new XMLHttpRequest;n.open("POST","/number/"+t.substr(7)+"/set?value="+encodeURIComponent(this.value),!0),n.send()}))}(row.id),row.classList.contains("button")&&function(t){row.children[2].children[0].addEventListener("click",(function(){const n=new XMLHttpRequest;n.open("POST","/button/"+t.substr(7)+"/press",!0),n.send()}))}(row.id));
|
||||
|
@ -67,6 +67,10 @@ Beta Changes
|
||||
|
||||
- Add factory to download name :esphomepr:`3040` by :ghuser:`balloob`
|
||||
- Bump dashboard to 20220113.2 :esphomepr:`3041` by :ghuser:`balloob`
|
||||
- Disable caching for binary download :esphomepr:`3054` by :ghuser:`lutzky`
|
||||
- Rename post_build scripts to fix codeowners script :esphomepr:`3057` by :ghuser:`oxan`
|
||||
- Remove deprecated attribute from virtual entity methods :esphomepr:`3056` by :ghuser:`oxan`
|
||||
- Add number setting to web_server/rest_api :esphomepr:`3055` by :ghuser:`jesserockz`
|
||||
|
||||
All changes
|
||||
^^^^^^^^^^^
|
||||
|
2
conf.py
2
conf.py
@ -69,7 +69,7 @@ author = "Otto Winter"
|
||||
# The short X.Y version.
|
||||
version = "2022.1"
|
||||
# The full version, including alpha/beta/rc tags.
|
||||
release = "2022.1.0b2"
|
||||
release = "2022.1.0b3"
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
|
@ -427,6 +427,7 @@ Contributors
|
||||
- `ludrao (@ludrao) <https://github.com/ludrao>`__
|
||||
- `Lukas Klass (@LukasK13) <https://github.com/LukasK13>`__
|
||||
- `Lumpusz (@Lumpusz) <https://github.com/Lumpusz>`__
|
||||
- `Ohad Lutzky (@lutzky) <https://github.com/lutzky>`__
|
||||
- `Luke Fitzgerald (@lwfitzgerald) <https://github.com/lwfitzgerald>`__
|
||||
- `Lewis Juggins (@lwis) <https://github.com/lwis>`__
|
||||
- `Alex Peters (@Lx) <https://github.com/Lx>`__
|
||||
@ -712,6 +713,7 @@ Contributors
|
||||
- `Thomas Klingbeil (@thomasklingbeil) <https://github.com/thomasklingbeil>`__
|
||||
- `Thomas Dietrich (@ThomDietrich) <https://github.com/ThomDietrich>`__
|
||||
- `Andrew Thompson (@thompsa) <https://github.com/thompsa>`__
|
||||
- `John (@thorrak) <https://github.com/thorrak>`__
|
||||
- `Tijs-B (@Tijs-B) <https://github.com/Tijs-B>`__
|
||||
- `Aidan Timson (@timmo001) <https://github.com/timmo001>`__
|
||||
- `Tim Niemueller (@timn) <https://github.com/timn>`__
|
||||
@ -785,4 +787,4 @@ Contributors
|
||||
- `ZTX18 (@ZTX18) <https://github.com/ZTX18>`__
|
||||
- `Christian Zufferey (@zuzu59) <https://github.com/zuzu59>`__
|
||||
|
||||
*This page was last updated January 13, 2022.*
|
||||
*This page was last updated January 17, 2022.*
|
||||
|
@ -63,7 +63,7 @@ There's also a simple REST API available which can be used to get and set the cu
|
||||
calls to this API follow the URL schema ``/<domain>/<id>[/<method>?<param>=<value>]``.
|
||||
The ``domain`` is the type of the component, for example ``sensor`` or ``light``. ``id`` refers
|
||||
to the id of the component - this ID is created by taking the name of the component, stripping out
|
||||
all non-alphanumeric characters, making everything lowercase and replacing all spaces by underscores.
|
||||
all non-alphanumeric characters, making everything lowercase and replacing all spaces by underscores.
|
||||
To confirm the ``<id>`` to use, you can set the :ref:`log level <logger-log_levels>`
|
||||
to ``VERY_VERBOSE`` and check the ``object_id:`` in the logs.
|
||||
|
||||
@ -161,7 +161,7 @@ the state of a light, send a GET request to ``/light/<id>``, for example ``light
|
||||
- **effect**: The currently active effect, only if the light supports effects.
|
||||
- **white_value**: The white value of RGBW lights. From 0 to 255. Only if the light supports white value.
|
||||
- **color_temp**: The color temperature of the RGBWW light. Between minimum mireds and maximum mireds of the light.
|
||||
Only if the light support color temperature.
|
||||
Only if the light support color temperature.
|
||||
|
||||
Setting light state can happen through three POST method calls: ``turn_on``, ``turn_off`` and ``toggle``.
|
||||
Turn on and off have additional URL encoded parameters that can be used to set other properties. For example
|
||||
@ -249,3 +249,51 @@ can be used:
|
||||
Creating a POST request to ``/cover/front_window_blinds/set?position=0.1&tilt=0.3`` will
|
||||
start moving the blinds towards an almost completely closed position and a new tilt
|
||||
angle.
|
||||
|
||||
Select
|
||||
******
|
||||
|
||||
Selects can be set to an option and will return their current option. For example sending
|
||||
a GET request to ``/select/house_mode`` could yield this payload:
|
||||
|
||||
.. code-block:: json
|
||||
|
||||
{
|
||||
"id": "select-house_mode",
|
||||
"state": "party",
|
||||
"value": "party"
|
||||
}
|
||||
|
||||
POST requests on the other hand allow setting the select, the available
|
||||
method is ``set``. The following parameter can be used:
|
||||
|
||||
- **option**: The string option to set it to. Must be a valid option.
|
||||
|
||||
For example POST ``/select/house_mode/set?option=guest`` will set the select to ``guest``.
|
||||
|
||||
Button
|
||||
******
|
||||
|
||||
A button can be ``pressed`` from the REST API by sending a POST request to ``button/do_something/press``.
|
||||
|
||||
Number
|
||||
******
|
||||
|
||||
Numbers can be set to a value within their minimum and maximum range and will return their current value. For example sending
|
||||
a GET request to ``/number/desired_delay`` could yield this payload:
|
||||
|
||||
.. code-block:: json
|
||||
|
||||
{
|
||||
"id": "number-desired_delay",
|
||||
"state": "20.0000",
|
||||
"value": 20
|
||||
}
|
||||
|
||||
POST requests on the other hand allow setting the number, the available
|
||||
method is ``set``. The following parameter can be used:
|
||||
|
||||
- **value**: The value you want to set the number to. The value must be within the
|
||||
minimum and maximum range of the number otherwise it will be ignored.
|
||||
|
||||
For example POST ``/number/desired_delay/set?value=24`` will set the number to 24.
|
||||
|
Loading…
Reference in New Issue
Block a user