reformatted

blakadder 2019-10-25 20:54:46 +02:00
parent fc29d0f283
commit ffe3a2b21b
1 changed files with 20 additions and 55 deletions

@ -1,57 +1,20 @@
## Identification of FunctionIDs and DpIds
Before proceeding identify dpId's and their function.
As mentioned, the hardware is controlled by an MCU. The Wi-Fi module sends commands to MCU over serial to control the hardware. Each hardware component has a DpId which can have different functions on each model. See [this list](tuya-protocols) for *possible* combinations.
We need to identify these DpIds:
1. Go to `Configure` -> `Console` option in Tasmota web interface.
2. Use command `weblog 4` to enable verbose logging in web interface.
3. Observe the log. After every 9-10 seconds you should see log messages such as:
```
TYA: Heartbeat
TYA: RX Packet: "55aa0107000501010001000f"
TYA: FnId=0 is set for dpId=1
TYA: RX Packet: "55aa01070005020100010010"
TYA: FnId=0 is set for dpId=2
TYA: RX Packet: "55aa01070005030100010011"
TYA: FnId=0 is set for dpId=3
TYA: RX Packet: "55aa01070005040100010012"
TYA: FnId=0 is set for dpId=4
TYA: RX Packet: "55aa0107000807020004000000001c"
TYA: FnId=0 is set for dpId=7
TYA: RX Packet: "55aa0107000808020004000000001d"
TYA: FnId=0 is set for dpId=8
TYA: RX Packet: "55aa0107000809020004000000001e"
TYA: FnId=0 is set for dpId=9
TYA: RX Packet: "55aa010700080a020004000000001f"
TYA: FnId=0 is set for dpId=0
TYA: RX Packet: "55aa0107000865020004000000007a"
TYA: FnId=0 is set for dpId=101
TYA: RX Packet: "55aa0107000866020004000000007b"
TYA: FnId=0 is set for dpId=102
TYA: RX Packet: "55aa0107000867020004000000007c"
TYA: FnId=0 is set for dpId=103
TYA: RX Packet: "55aa0107000868020004000009870d"
TYA: FnId=0 is set for dpId=104
```
4. The function ids are printed as `TYA: FnId=0 is set for dpId=XXX` We will use these `XXX` ids in the guide ahead
### Setting up a Dimmer
## Dimmer
We need to configure four functions of a dimmer:
1. Dimming DpId
1. Dimming dpId
2. Dimming Range
3. Power metering if supported.
4. Dimming less than 10%
#### Dimming DpId
The dimmer FunctionId is `21`. On a dimmer DpId generally is `2` or `3`. Try both.
### Dimming dpId
The dimmer FunctionId is `21`. On a dimmer dpId generally is `2` or `3`. Try both.
1. Go to the Tasmota Console and type `TuyaMCU 21,2` and wait for it to reboot.
2. Enter `Backlog Dimmer 10; Dimmer 100` in the Console.
- If your bulb responds to `Dimmer` commands, you have successfully configured the dimmer FunctionId. Make note of it.
- If not try id `3` and if even `3` doesn't work keep trying Ids from all unknown Ids from the log until one works.
#### Dimming Range
### Dimming Range
Once you have figured out the dimming functionId, we need to find the maximum dimming range. Once the dimming Id is set, the logs will continue
```
TYA: Heartbeat
@ -67,9 +30,9 @@ Now we need to tell Tasmota to use maximum and minimum values. This controlled b
Once set, try `dimmer 100` in the Console and check if the brightness of bulb is same is the same as when the maximum was set using hardware buttons.
#### Power metering
### Power metering
<a id="power-metering"></a>
Some Tuya MCU devices support Power measurement support over serial. For this its better to use an bulb with known wattage rating.
Some Tuya MCU devices support Power measurement support over serial. For this its better to use a bulb with known wattage rating.
Observe the logs in the Console
```
@ -143,20 +106,20 @@ In the `RX Packet` we are interested in the 3 digits before last 2 digits. For e
```
13. Power and current should change on dimming high / low. The Tasmota web UI should show power values now.
### Setting up Switches
## Switches
For switches we need to
1. Configure the number of relays.
2. Configure Power metering.
#### Configure number of relays
### Configure number of relays
By default, the TuyaMCU module expects a 1 gang switch. There is currenty no way to detect the number of relays present in an MCU based switch. We need to tell the number of relays to Tasmota using FunctionIDs 12 to 18 for Relay2 to Relay4.
* For a 4 gang switch set `TuyaMCU 12,2`, `TuyaMCU 13,3` and `TuyaMCU 14,4` if the DpIds for Relays 2-4 are `2`,`3`,`4`.
* For a 4 gang switch set `TuyaMCU 12,2`, `TuyaMCU 13,3` and `TuyaMCU 14,4` if the dpIds for Relays 2-4 are `2`,`3`,`4`.
> You can configure all at once by using `Backlog TuyaMCU 12,2; TuyaMCU 13,3; TuyaMCU 14,4`
#### Configure power metering
### Configure power metering
Power metering configuration is same as for [dimmers](#power-metering).
### Setting up a Curtain Motor
## Curtain Motor
The Zemismart WiFi curtain motor uses a Tuya TYWE1S inside the little white dongle as a radio modem.
`U1TX` is connected to "USB D+", `U1RX` is connected to "USB D-", and there is a blue LED in the dongle connected to "USB3 R-" controlled by the MCU. To flash Tasmota, we need `U0RX`, `U0TX`, and `GPIO0`. None of which are broken out on the PCB, so soldering or Tuya-Convert are necessary.
@ -165,7 +128,7 @@ The stock Tuya App communicates with the PIC Micro inside the motor housing at 9
* `dpId 102` is a "fully open/fully close" command with a 1-byte Boolean field.
* `dpId 103` is unknown.
#### Debugging
### Debugging
```
55 aa 00 06 "deliver dp" 0005 "len=5" 66 04 00 01 <00=close100%,01=open0%> <chksum> is the fully open/close command
07 "report dp" 0005 (len) 66 04 00 01 <00 or 01> <chksum> is the reply.
@ -175,7 +138,7 @@ The stock Tuya App communicates with the PIC Micro inside the motor housing at 9
There may first be a reply of 65 02 00 04 <oldvalue.32> <chksum> before the motor engages
#### Tasmota
### Tasmota
1. `module 54` # TuyaMCU (will reboot)
2. `backlog gpio1 0; gpio3 0; gpio15 107; gpio13 108` # change GPIO assignments. The dongle uses gpio15 for U1TX and gpio13 for U1RX (will reboot)
3. `tuyamcu 21,101` # declare curtain as a dimmer (will reboot)
@ -197,15 +160,17 @@ tuyamcu 11,103 # make 0x67 a relay
```
Does not appear to have any impact on the curtain.
## dpId functions in different devices
- ID: Identification number associated with the function.
## dpId functions tables
***This information is just for orientation. Functions are assigned by the manufacturer and can be on different dpId's***
- DP ID: dpId.
- Function PointUsed to describe the product function.
- Identifier: Function codename. Can only be letters, numbers and underscores
- Data type
- Issue and report: command data can be sent and status data can be reported back to the Wi-Fi module
- Report only: supports only status reporting, no control options
- Function Typevalues used for command data
- Function Type (Referred as Data Type in [TuyaMCU](tuyamcu) article):
- Boolean (bool): non-true or false binary variable, such as: switch function, on / off
- Value (value): suitable for linear adjustment of the type of data, such as: temperature regulation, temperature range 20-40 ℃
- Enum (enum): custom finite set value, such as: working levels, low / mid / high