diff --git a/components/fan/tuya.rst b/components/fan/tuya.rst index 186dfb770..65bb611ae 100644 --- a/components/fan/tuya.rst +++ b/components/fan/tuya.rst @@ -6,7 +6,7 @@ Tuya Fan :image: fan.svg The ``tuya`` fan platform creates a variable speed fan from a -tuya serial component. +tuya component. .. figure:: images/tuyafan.jpg :align: center @@ -14,35 +14,7 @@ tuya serial component. A Tuya based fan controller wall plate. -There are two components, the Tuya bus and the fan that uses it. The ``tuya`` -component requires a :ref:`UART bus ` to be configured. Put the ``tuya`` component in -the config and it will list the possible devices for you in the config log. - -.. code-block:: yaml - - # Example configuration entry - # Make sure your wifi will connect - wifi: - ssid: "ssid" - password: "password" - - # Make sure logging is not using the serial port - logger: - baud_rate: 0 - - # Enable Home Assistant API - api: - - # Make sure you can upload new firmware OTA - ota: - - uart: - rx_pin: GPIO3 - tx_pin: GPIO1 - baud_rate: 9600 - - # Register the Tuya MCU connection - tuya: +The Tuya fan requires a :doc:`/components/tuya` to be configured. Here is an example output for a Tuya fan controller: @@ -93,6 +65,7 @@ Configuration variables: See Also -------- +- :doc:`/components/tuya` - :doc:`/components/fan/index` - :apiref:`tuya/fan/tuya_fan.h` - :ghedit:`Edit` diff --git a/components/light/tuya.rst b/components/light/tuya.rst index db61d388d..e39a38a40 100644 --- a/components/light/tuya.rst +++ b/components/light/tuya.rst @@ -16,36 +16,7 @@ tuya serial component. The dimmer switch I got would hang if the logger was configured to use the serial port which meant it was bricked until I cut it open. -There are two components, the Tuya bus and the dimmer that uses it. The ``tuya`` -component requires a :ref:`UART bus ` to be configured. Put the ``tuya`` component in -the config and it will list the possible devices for you in the config log. - -.. code-block:: yaml - - # Example configuration entry - # Make sure your wifi will connect - wifi: - ssid: "ssid" - password: "password" - - # Make sure logging is not using the serial port - logger: - baud_rate: 0 - - # Enable Home Assistant API - api: - - # Make sure you can upload new firmware OTA - ota: - - # My dimmer used the hardware serial port on the alternate pins - uart: - rx_pin: GPIO13 - tx_pin: GPIO15 - baud_rate: 9600 - - # Register the Tuya MCU connection - tuya: +The Tuya dimmer requires a :doc:`/components/tuya` to be configured. Here is an example output for a Tuya dimmer: @@ -92,6 +63,7 @@ Configuration variables: See Also -------- +- :doc:`/components/tuya` - :doc:`/components/light/index` - :apiref:`tuya/light/tuya_light.h` - :ghedit:`Edit` diff --git a/components/tuya.rst b/components/tuya.rst new file mode 100644 index 000000000..8826b8281 --- /dev/null +++ b/components/tuya.rst @@ -0,0 +1,62 @@ +Tuya MCU +======== + +.. seo:: + :description: Instructions for setting up the Tuya component. + :image: tuya.png + +The ``tuya`` component creates a serial connection to the Tuya MCU for platforms to use. + +.. figure:: /images/tuya.png + :align: center + :width: 40% + +The ``tuya`` serial component requires a :ref:`UART bus ` to be configured. +Put the ``tuya`` component in the config and it will list the possible devices for you in the config log. + +.. code-block:: yaml + + # Example configuration entry + # Make sure your wifi will connect + wifi: + ssid: "ssid" + password: "password" + + # Make sure logging is not using the serial port + logger: + baud_rate: 0 + + # Enable Home Assistant API + api: + + # Make sure you can upload new firmware OTA + ota: + + uart: + rx_pin: GPIO3 + tx_pin: GPIO1 + baud_rate: 9600 + + # Register the Tuya MCU connection + tuya: + +Here is an example output for a Tuya fan controller: + +.. code-block:: text + + [12:39:45][C][tuya:023]: Tuya: + [12:39:45][C][tuya:032]: Datapoint 1: switch (value: ON) + [12:39:45][C][tuya:036]: Datapoint 3: enum (value: 1) + [12:39:45][C][tuya:036]: Datapoint 6: enum (value: 0) + [12:39:45][C][tuya:034]: Datapoint 7: int value (value: 0) + [12:39:45][C][tuya:032]: Datapoint 9: switch (value: OFF) + [12:39:45][C][tuya:046]: Product: '{"p":"hqq73kftvzh8c92u","v":"1.0.0","m":0}' + + +See Also +-------- + +- :doc:`/components/fan/tuya` +- :doc:`/components/light/tuya` +- :apiref:`tuya/tuya.h` +- :ghedit:`Edit` diff --git a/images/tuya.png b/images/tuya.png new file mode 100644 index 000000000..72a6f2bb0 Binary files /dev/null and b/images/tuya.png differ diff --git a/index.rst b/index.rst index 06eff1e18..2a68faee5 100644 --- a/index.rst +++ b/index.rst @@ -343,6 +343,7 @@ Misc Components Debug Component, components/debug, bug-report.svg TM1651 Battery Display, components/tm1651, tm1651_battery_display.jpg RF Bridge, components/rf_bridge, rf_bridge.jpg + Tuya MCU, components/tuya, tuya.png Additional Custom Components ----------------------------