Add copy integration (#1932)

This commit is contained in:
Otto Winter 2022-02-20 21:13:39 +01:00 committed by GitHub
parent 863a94be70
commit 794d7abc7c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 199 additions and 0 deletions

197
components/copy.rst Normal file
View File

@ -0,0 +1,197 @@
Copy Integration
================
.. seo::
:description: Instructions for setting up the copy integration in ESPHome
:image: content-copy.svg
The ``copy`` integration can be used to copy an existing component (like a sensor, switch, etc.)
and create a duplicate mirroring the source's state and forwarding actions such as turning on to the source.
For each of the supported platforms, the configuration consists of the required configuration
variable ``source_id``, which is used to indicate the source of the object being mirorred.
Copy Binary Sensor
------------------
.. code-block:: yaml
# Example configuration entry
binary_sensor:
- platform: copy
source_id: source_binary_sensor
name: "Copy of source_binary_sensor"
Configuration variables:
************************
- **source_id** (**Required**, :ref:`config-id`): The binary sensor that should be mirrored.
- **name** (**Required**, string): The name of the binary sensor.
- All other options from :ref:`Binary Sensor <config-binary_sensor>`.
Copy Button
-----------
.. code-block:: yaml
# Example configuration entry
button:
- platform: copy
source_id: source_button
name: "Copy of source_button"
Configuration variables:
************************
- **source_id** (**Required**, :ref:`config-id`): The button that should be mirrored.
- **name** (**Required**, string): The name of the button.
- All other options from :ref:`Button <config-button>`.
Copy Cover
----------
.. code-block:: yaml
# Example configuration entry
cover:
- platform: copy
source_id: source_cover
name: "Copy of source_cover"
Configuration variables:
************************
- **source_id** (**Required**, :ref:`config-id`): The cover that should be mirrored.
- **name** (**Required**, string): The name of the cover.
- All other options from :ref:`Cover <config-cover>`.
Copy Fan
--------
.. code-block:: yaml
# Example configuration entry
fan:
- platform: copy
source_id: source_fan
name: "Copy of source_fan"
Configuration variables:
************************
- **source_id** (**Required**, :ref:`config-id`): The fan that should be mirrored.
- **name** (**Required**, string): The name of the fan.
- All other options from :ref:`Fan <config-fan>`.
Copy Lock
---------
.. code-block:: yaml
# Example configuration entry
lock:
- platform: copy
source_id: source_lock
name: "Copy of source_lock"
Configuration variables:
************************
- **source_id** (**Required**, :ref:`config-id`): The lock that should be mirrored.
- **name** (**Required**, string): The name of the lock.
- All other options from :ref:`Lock <config-lock>`.
Copy Number
-----------
.. code-block:: yaml
# Example configuration entry
number:
- platform: copy
source_id: source_number
name: "Copy of source_number"
Configuration variables:
************************
- **source_id** (**Required**, :ref:`config-id`): The number that should be mirrored.
- **name** (**Required**, string): The name of the number.
- All other options from :ref:`Number <config-number>`.
Copy Select
-----------
.. code-block:: yaml
# Example configuration entry
select:
- platform: copy
source_id: source_select
name: "Copy of source_select"
Configuration variables:
************************
- **source_id** (**Required**, :ref:`config-id`): The select that should be mirrored.
- **name** (**Required**, string): The name of the select.
- All other options from :ref:`Select <config-select>`.
Copy Sensor
-----------
.. code-block:: yaml
# Example configuration entry
sensor:
- platform: copy
source_id: source_sensor
name: "Copy of source_sensor"
Configuration variables:
************************
- **source_id** (**Required**, :ref:`config-id`): The sensor that should be mirrored.
- **name** (**Required**, string): The name of the sensor.
- All other options from :ref:`Sensor <config-sensor>`.
Copy Switch
-----------
.. code-block:: yaml
# Example configuration entry
switch:
- platform: copy
source_id: source_switch
name: "Copy of source_switch"
Configuration variables:
************************
- **source_id** (**Required**, :ref:`config-id`): The switch that should be mirrored.
- **name** (**Required**, string): The name of the switch.
- All other options from :ref:`Switch <config-switch>`.
Copy Text Sensor
----------------
.. code-block:: yaml
# Example configuration entry
text_sensor:
- platform: copy
source_id: source_text_sensor
name: "Copy of source_text_sensor"
Configuration variables:
************************
- **source_id** (**Required**, :ref:`config-id`): The text sensor that should be mirrored.
- **name** (**Required**, string): The name of the text sensor.
- All other options from :ref:`Text Sensor <config-text_sensor>`.
See Also
--------
- :ghedit:`Edit`

1
images/content-copy.svg Normal file
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="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z" /></svg>

After

Width:  |  Height:  |  Size: 417 B

View File

@ -665,6 +665,7 @@ Misc Components
PipSolar - compatible PV Inverter, components/pipsolar, pipsolar.jpg
Grow Fingerprint Reader, components/fingerprint_grow, fingerprint.svg
Demo, components/demo, description.svg
Copy, components/copy, content-copy.svg
Additional Custom Components
----------------------------