Add Tuya Switch docs (#625)

* Add Tuya Switch docs

* Fix underline

* Remove common tuya documentation

* use tuya image for tuya stuff

Co-authored-by: Guillermo Ruffino <glm.net@gmail.com>
This commit is contained in:
Jesse Hills 2020-07-12 09:12:47 +12:00 committed by GitHub
parent 6b7c18a919
commit 547a8de3e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 51 additions and 2 deletions

View File

@ -0,0 +1,48 @@
Tuya Switch
===========
.. seo::
:description: Instructions for setting up a Tuya device switch.
:image: upload.svg
The ``tuya`` switch platform creates a sensor from a tuya serial component
and requires :doc:`/components/tuya` to be configured.
.. code-block:: text
[13:46:01][C][tuya:023]: Tuya:
[13:46:01][C][tuya:032]: Datapoint 1: switch (value: OFF)
[13:46:01][C][tuya:032]: Datapoint 2: switch (value: OFF)
[13:46:01][C][tuya:034]: Datapoint 3: int value (value: 19)
[13:46:01][C][tuya:034]: Datapoint 4: int value (value: 17)
[13:46:01][C][tuya:034]: Datapoint 5: int value (value: 0)
[13:46:01][C][tuya:036]: Datapoint 7: enum (value: 1)
[13:46:01][C][tuya:046]: Product: '{"p":"ynjanlglr4qa6dxf","v":"1.0.0","m":0}'
On this controller, the datapoint 2 represents the child lock switch
setting which is what we are interested in controlling using this platform.
Based on this, you can create the switch as follows:
.. code-block:: yaml
# Create a switch
switch:
- platform: "tuya"
name: "MySwitch"
switch_datapoint: 2
Configuration variables:
------------------------
- **id** (*Optional*, :ref:`config-id`): Manually specify the ID used for code generation.
- **name** (**Required**, string): The name of the switch.
- **switch_datapoint** (**Required**, int): The datapoint id number of the switch.
- All other options from :ref:`Switch <config-switch>`.
See Also
--------
- :doc:`/components/switch/index`
- :apiref:`tuya/switch/tuya_switch.h`
- :ghedit:`Edit`

View File

@ -224,7 +224,7 @@ Light Components
NeoPixelBus Light, components/light/neopixelbus, color_lens.svg
Light Partition, components/light/partition, color_lens.svg
Tuya Dimmer, components/light/tuya, brightness-medium.svg
Tuya Dimmer, components/light/tuya, tuya.png
Custom Light, components/light/custom, language-cpp.svg
Looking for WS2811 and similar individually addressable lights? Have a look at the
@ -243,6 +243,7 @@ Switch Components
Template Switch, components/switch/template, description.svg
UART Switch, components/switch/uart, uart.svg
Custom Switch, components/switch/custom, language-cpp.svg
Tuya Switch, components/switch/tuya, tuya.png
Fan Components
--------------
@ -252,7 +253,7 @@ Fan Components
Fan Core, components/fan/index, folder-open.svg
Binary Fan, components/fan/binary, fan.svg
Speed Fan, components/fan/speed, fan.svg
Tuya Fan, components/fan/tuya, fan.svg
Tuya Fan, components/fan/tuya, tuya.png
Display Components
------------------