Merge branch 'current' into beta

This commit is contained in:
Jesse Hills 2022-03-16 14:05:42 +13:00
commit e09f8921a3
No known key found for this signature in database
GPG Key ID: BEAAE804EFD8E83A
12 changed files with 155 additions and 27 deletions

View File

@ -68,7 +68,7 @@ unsigned integer.
then:
- mqtt.publish:
topic: rdm6300/tag
payload: !lambda 'return uint32_to_string(x);'
payload: !lambda 'return to_string(x);'
A tag scanned event can also be sent to the Home Assistant tag component
using :ref:`api-homeassistant_tag_scanned_action`.
@ -79,7 +79,7 @@ using :ref:`api-homeassistant_tag_scanned_action`.
# ...
on_tag:
then:
- homeassistant.tag_scanned: !lambda 'return uint32_to_string(x);'
- homeassistant.tag_scanned: !lambda 'return to_string(x);'
.. _rdm6300-tag:

View File

@ -150,20 +150,39 @@ ESP32 CAN Component
-------------------
The ESP32 has an integrated CAN controller and therefore doesn't need an external controller necessarily.
You only need to specify the RX and TX pins.
You only need to specify the RX and TX pins. Any GPIO will work.
.. code-block:: yaml
# Example configuration entry
canbus:
- platform: esp32_can
tx_pin: GPIO1
rx_pin: GPIO3
tx_pin: GPIO5
rx_pin: GPIO4
can_id: 4
bit_rate: 50kbps
on_frame:
...
Wiring options
**************
5V CAN transceivers are cheap and generate compliant levels. If you power your
board with 5V this is the preferred option. R501 is important to reduce the 5V
logic level down to 3.3V, to avoid damaging the ESP32. You can alternatively
use a voltage divider here instead.
.. figure:: images/canbus_esp32_5v.png
:align: center
:target: ../_images/canbus_esp32_5v.png
If you prefer to only have a 3.3V power supply, special 3.3V CAN transceivers are available.
.. figure:: images/canbus_esp32_3v3.png
:align: center
:target: ../_images/canbus_esp32_3v3.png
Configuration variables:
************************
@ -217,7 +236,8 @@ Configuration variables:
- All other options from :ref:`Canbus <config-canbus>`.
Wiring options
---------------
**************
Easiest approach is to just use fully assembled boards and just add one resistor in the MISO line.
This runs MOSI, SCK and CS out of specification which is nearly never a problem.

View File

@ -174,8 +174,8 @@ Templatable values
return id(my_sensor).state;
Body in JSON format (syntax 1)
******************************
POST Body in JSON format (syntax 1)
***********************************
**Note:** all values of the map should be a strings.
It's impossible to send ``boolean`` or ``numbers`` with this syntax.
@ -194,8 +194,8 @@ It's impossible to send ``boolean`` or ``numbers`` with this syntax.
# Will send:
# {"key": "42.0", "greeting": "Hello World"}
Body in JSON format (syntax 2)
******************************
POST Body in JSON format (syntax 2)
***********************************
**Note:** use this syntax to send ``boolean`` or ``numbers`` in JSON.
@ -217,6 +217,29 @@ as seen below.
# Will send:
# {"key": 42.0, "greeting": "Hello World"}
GET values from a JSON body response
************************************
Assuming that the server returns a response in a JSON object over HTTP similar to this:
``{"status":"play","vol":"42","mute":"0"}``
If you want to retrieve the value for the ``vol`` key and assign it to a template ``sensor`` or ``number`` component (with ``id`` set to ``player_volume``):
.. code-block:: yaml
on_...:
- http_request.get:
url: https://esphome.io
on_response:
then:
- lambda: |-
json::parse_json(id(http_request_data).get_string(), [](JsonObject root) {
id(player_volume).publish_state(root["vol"]);
});
**Note:** don't forget to set the ``id`` for the main ``http_request`` component, to ``http_request_data``.
See Also
--------

Binary file not shown.

After

Width:  |  Height:  |  Size: 865 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 876 KiB

View File

@ -117,6 +117,90 @@ Technically there is no difference between the "inline" and the standard definit
value_type: U_WORD
Bitmasks
--------
Some devices use decimal values in read registers to show multiple binary states occupying only one register address. To decode them, you can use bitmasks according to the table below. The decimal value corresponding to a bit is always double of the previous one in the row. Multiple bits can be represented in a single register by making a sum of all the values corresponding to the bits.
+------------+------------------+-----------+-----------+
| Alarm bit | Description | DEC value | HEX value |
+============+==================+===========+===========+
| bit 0 | Binary Sensor 0 | 1 | 1 |
+------------+------------------+-----------+-----------+
| bit 1 | Binary Sensor 1 | 2 | 2 |
+------------+------------------+-----------+-----------+
| bit 2 | Binary Sensor 2 | 4 | 4 |
+------------+------------------+-----------+-----------+
| bit 3 | Binary Sensor 3 | 8 | 8 |
+------------+------------------+-----------+-----------+
| bit 4 | Binary Sensor 4 | 16 | 10 |
+------------+------------------+-----------+-----------+
| bit 5 | Binary Sensor 5 | 32 | 20 |
+------------+------------------+-----------+-----------+
| bit 6 | Binary Sensor 6 | 64 | 40 |
+------------+------------------+-----------+-----------+
| bit 7 | Binary Sensor 7 | 128 | 80 |
+------------+------------------+-----------+-----------+
| bit 8 | Binary Sensor 8 | 256 | 100 |
+------------+------------------+-----------+-----------+
| bit 9 | Binary Sensor 9 | 512 | 200 |
+------------+------------------+-----------+-----------+
| bit 10 | Binary Sensor 10 | 1024 | 400 |
+------------+------------------+-----------+-----------+
| bit 11 | Binary Sensor 11 | 2048 | 800 |
+------------+------------------+-----------+-----------+
| bit 12 | Binary Sensor 12 | 4096 | 1000 |
+------------+------------------+-----------+-----------+
| bit 13 | Binary Sensor 13 | 8192 | 2000 |
+------------+------------------+-----------+-----------+
| bit 14 | Binary Sensor 14 | 16384 | 4000 |
+------------+------------------+-----------+-----------+
| bit 15 | Binary Sensor 15 | 32768 | 8000 |
+------------+------------------+-----------+-----------+
For example, when reading register ``15``, a decimal value of ``12288`` is the sum of ``4096`` + ``8192``, meaning the corresponding bits ``12`` and ``13`` are ``1``, the other bits are ``0``.
To gather some of these bits as binary sensors in ESPHome, use ``bitmask``:
.. code-block:: yaml
binary_sensor:
- platform: modbus_controller
modbus_controller_id: ventilation_system
name: Alarm bit0
entity_category: diagnostic
device_class: problem
register_type: read
address: 15
bitmask: 0x1
- platform: modbus_controller
modbus_controller_id: ventilation_system
name: Alarm bit1
entity_category: diagnostic
device_class: problem
register_type: read
address: 15
bitmask: 0x2
- platform: modbus_controller
modbus_controller_id: ventilation_system
name: Alarm bit10
entity_category: diagnostic
device_class: problem
register_type: read
address: 15
bitmask: 0x400
- platform: modbus_controller
modbus_controller_id: ventilation_system
name: Alarm bit15
entity_category: diagnostic
device_class: problem
register_type: read
address: 15
bitmask: 0x8000
Protocol decoding example
-------------------------
@ -233,6 +317,7 @@ The response is mapped to the sensor based on register_count and offset in bytes
+-----------+-----------------------------------------+
**Response**
+--------+------------+--------------------+--------------------------------------------+

View File

@ -40,7 +40,7 @@ Configuration variables:
- **sample_duration** (*Optional*, :ref:`config-time`): The time duration to sample the current clamp
with. Higher values can increase accuracy. Defaults to ``200ms`` which would be 10 whole cycles on a 50Hz system.
- **update_interval** (*Optional*, :ref:`config-time`): The interval
to check the sensor. Defaults to ``60s``.
to check the sensor. Defaults to ``60s``. The **update_interval** for ``ct_clamp`` has to be greater than **sample_duration**.
- **id** (*Optional*, :ref:`config-id`): Manually specify the ID used for code generation.
- All other options from :ref:`Sensor <config-sensor>`.

View File

@ -1,15 +1,17 @@
HTU21D Temperature+Humidity Sensor
==================================
HTU21D | Si7021 | SHT21 Temperature & Humidity Sensor
=====================================================
.. seo::
:description: Instructions for setting up HTU21D temperature and humidity sensors.
:image: htu21d.jpg
:keywords: HTU21D
The HTU21D Temperature+Humidity sensor allows you to use your HTU21D
(`Adafruit <https://www.adafruit.com/product/1899>`__) sensors with
ESPHome. The :ref:`I²C Bus <i2c>` is
required to be set up in your configuration for this sensor to work.
The HTU21D Temperature & Humidity component allows you to use HTU21D, Si7021 and SHT21 sensors with
ESPHome. The :ref:`I²C Bus <i2c>` is required to be set up in your configuration for this sensor to work.
Example sensors:
- (`Adafruit <https://www.adafruit.com/product/1899>`__)
.. figure:: images/htu21d-full.jpg
:align: center
@ -23,10 +25,6 @@ required to be set up in your configuration for this sensor to work.
:align: center
:width: 80.0%
.. note::
The **SI7021** sensor also works with this integration.
.. code-block:: yaml
# Example configuration entry

View File

@ -46,9 +46,9 @@ Configuration variables:
************************
- **id** (**Required**, :ref:`config-id`): The id to use for this SN74HC595 component.
- **data_pin** (**Required**, :ref:`Pin Schema <config-pin_schema>`): Pin connected to SN74HC595 SER input.
- **clock_pin** (**Required**, :ref:`Pin Schema <config-pin_schema>`): Pin connected to SN74HC595 SRCLK pin
- **latch_pin** (**Required**, :ref:`Pin Schema <config-pin_schema>`): Pin connected to SN74HC595 RCLK pin
- **data_pin** (**Required**, :ref:`Pin Schema <config-pin_schema>`): Pin connected to SN74HC595 SER (SD) input.
- **clock_pin** (**Required**, :ref:`Pin Schema <config-pin_schema>`): Pin connected to SN74HC595 SRCLK (SH_CP) pin
- **latch_pin** (**Required**, :ref:`Pin Schema <config-pin_schema>`): Pin connected to SN74HC595 RCLK (ST_CP) pin
- **oe_pin** (*Optional*, :ref:`Pin Schema <config-pin_schema>`): Pin connected to SN74HC595 OE pin
- **sr_count** (*Optional*, int): Number of daisy-chained shift registers, up-to 4. Defaults to ``1``.

View File

@ -240,7 +240,7 @@ This :ref:`Action <config-action>` allows you to set the acceleration of a stepp
on_...:
- stepper.set_acceleration:
id: my_stepper
speed: 250 steps/s^2
acceleration: 250 steps/s^2
Configuration variables:
@ -260,7 +260,7 @@ This :ref:`Action <config-action>` allows you to set the deceleration of a stepp
on_...:
- stepper.set_deceleration:
id: my_stepper
speed: 250 steps/s^2
deceleration: 250 steps/s^2
Configuration variables:

View File

@ -52,6 +52,8 @@ Blog Posts & Videos
- `Display TM1637 with ESPHome and MQTT showing Youtube subscribers count and other info <https://youtu.be/27JZEky0h1Q>`__ by :ghuser:`electrofun-smart`
- `Automate your garage door with ESP8266 lysignal Yunshan 7v-30v <https://www.haade.fr/en/blog/home-automation-smarthome-jeedom-homeassistant/tutos-haade-lab/domotiser-sa-porte-de-garage-pour-5e/>`__ by :ghuser:`haade-administrator`
- `Embedded controller for Audioengine A5+ <https://github.com/chatziko/audioengine-a5-controller/>`__ by :ghuser:`chatziko`
- `Cheap 10$ Air quality monitor WP6003: ESP32, Bluetooth & Home assistant <https://omarghader.github.io/esp32-airquality-box-wp6003-homeassistant/>`__ by `Omar GHADER <https://omarghader.github.io/post>`__
- `ESP32 AM312 motion sensor : light automation <https://omarghader.github.io/esp32-am312-pir-motion-sensor/>`__ by `Omar GHADER <https://omarghader.github.io/post>`__
Custom Components & Code
------------------------

View File

@ -294,7 +294,7 @@ Environmental
DHT12, components/sensor/dht12, dht12.jpg, Temperature & Humidity
HDC1080, components/sensor/hdc1080, hdc1080.jpg, Temperature & Humidity
Honeywell ABP, components/sensor/honeywellabp, honeywellabp.jpg, Pressure & Temperature
HTU21D, components/sensor/htu21d, htu21d.jpg, Temperature & Humidity
HTU21D / Si7021 / SHT21, components/sensor/htu21d, htu21d.jpg, Temperature & Humidity
Inkbird IBS-TH1 Mini, components/sensor/inkbird_ibsth1_mini, inkbird_isbth1_mini.jpg, Temperature & Humidity
MCP9808, components/sensor/mcp9808, mcp9808.jpg, Temperature
MH-Z19, components/sensor/mhz19, mhz19.jpg, CO2 & Temperature