From 794d7abc7c47ad4f9cc8a4199b3bad98ee21c302 Mon Sep 17 00:00:00 2001 From: Otto Winter Date: Sun, 20 Feb 2022 21:13:39 +0100 Subject: [PATCH] Add copy integration (#1932) --- components/copy.rst | 197 ++++++++++++++++++++++++++++++++++++++++ images/content-copy.svg | 1 + index.rst | 1 + 3 files changed, 199 insertions(+) create mode 100644 components/copy.rst create mode 100644 images/content-copy.svg diff --git a/components/copy.rst b/components/copy.rst new file mode 100644 index 000000000..3035d41b9 --- /dev/null +++ b/components/copy.rst @@ -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 `. + +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 `. + +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 `. + +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 `. + +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 `. + +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 `. + +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 `. + +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 `. + +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 `. + +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 `. + +See Also +-------- + +- :ghedit:`Edit` diff --git a/images/content-copy.svg b/images/content-copy.svg new file mode 100644 index 000000000..0968db1a7 --- /dev/null +++ b/images/content-copy.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/index.rst b/index.rst index b3a82adb3..fc1948276 100644 --- a/index.rst +++ b/index.rst @@ -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 ----------------------------