From cf3055640505e6b2c22e653a0bc4332d223782a6 Mon Sep 17 00:00:00 2001 From: Michael Ingraham <34340210+meingraham@users.noreply.github.com> Date: Thu, 23 May 2019 21:44:31 -0400 Subject: [PATCH] Update to use LedLink Introduced in 6.5.0.12 --- Kesen-KS-604S.md | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/Kesen-KS-604S.md b/Kesen-KS-604S.md index 52d4a13d..84ab5a8b 100644 --- a/Kesen-KS-604S.md +++ b/Kesen-KS-604S.md @@ -2,7 +2,7 @@ This Tuya Wi-Fi module ESP8266 based device has a really attractive form factor -[@DavinKD](https://github.com/DavinKD) was able to flash this device OTA using [Tuya-Convert](https://github.com/ct-Open-Source/tuya-convert/wiki/Compatible-devices). This device **_must be flashed using this OTA method_**. Flashing this device by attaching leads to the serial interface requires disassembling and unsoldering the internal AC components to get access to the needed contacts. This makes flashing the device by this method highly undesirable. +This device **_must be flashed using using [Tuya-Convert](https://github.com/ct-Open-Source/tuya-convert/wiki/Compatible-devices)_**. Flashing this device by attaching leads to the serial interface requires disassembling and unsoldering the internal AC components to get access to the needed contacts. This makes flashing the device by this method highly undesirable. ## Shopping @@ -12,7 +12,7 @@ This Tuya Wi-Fi module ESP8266 based device has a really attractive form factor ## Configuration -It appears that there are different versions of the KS-604S. The device that @DavinKD flashed (likely purchased from Amazon in early to mid March 2019) has a different GPIO configuration than devices purchased from Alibaba in late March. +It appears that there are different versions of the KS-604S. The device that [@DavinKD](https://github.com/DavinKD) flashed (likely purchased from Amazon in early to mid March 2019) has a different GPIO configuration than devices purchased from Alibaba in late March. Rear @@ -34,30 +34,24 @@ The USB port on this variant is not switchable. ### Alibaba Device -{"NAME":"KS-604S","GPIO":[56,255,255,17,57,18,255,255,22,21,32,23,255],"FLAG":0,"BASE":18} +{"NAME":"KS-604S","GPIO":[158,255,255,17,56,18,255,255,22,21,57,23,255],"FLAG":0,"BASE":18} | GPIO | Function | Configuration | |:---|:---|:---| -| 0 | Device Status (Green) | LED1i (56) +| 0 | Device Status (Green) | LEDLinki (158) | 3 | Top Button | Button1 (17) -| 4 | Top LED (Orange) | LED2i (57) +| 4 | Top LED (Orange) | LED1i (56) | 5 | Bottom Button | Button2 (18) | 12 | Bottom Receptacle | Relay2 (22) | 13 | Top Receptacle | Relay1 (21) -| 14 | Bottom LED (Orange) | Relay4i (32) +| 14 | Bottom LED (Orange) | LED2i (57) | 15 | USB Port | Relay3 (23) -This configuration requires [LedMask](Commands#ledmask) (introduced in 6.5.0.7) and [SetOption63](Commands#setoption63) (introduced in 6.5.0.9). +This configuration requires the `LedLinki` [Component](Components) (introduced in 6.5.0.12) to associate the GPIO to the status LED indicator. In order for the LED power indicators to follow the state of each receptacle relay, [`LedState`](Commands#ledstate) must be set to show the power state on the LEDs. Select the desired power on state for the device's relays using [`PowerOnState`](Commands#poweronstate) and/or a `System#Boot` triggered rule. This device also requires [SetOption63](Commands#setoption63) (introduced in 6.5.0.9) in order to disable relay power feedback state scanning at restart. -Currently, Tasmota only supports up two LEDs to indicate relay state and connectivity status. With two LEDs defined, LED1 will act as the Wi-Fi/MQTT status LED and LED2 will act as the LED that indicates relay power. - -In order to have the power indicators follow the state of the relays, LedMask must be used to so that only Relay1 controls the second LED. The other orange LED GPIO must be configured as a virtual relay. A rule is used to change the state of the LED "relay" when the real relay is toggled. - -Also, to avoid excessive flash writes caused by the addition of the virtual relay, disable state saves using [`SetOption0`](Commands#setoption0). In this case, Tasmota will not be able to restore the last known state so [`PowerOnState`](Commands#poweronstate) 3 is not an option. Select the desired power on state for the device's relays. - -The following Console statements define the necessary settings and rules for configuring the indicator behavior as described above. +The following Console statements define the necessary settings and rules as described above. ``` -Backlog SerialLog 0; SetOption0 0; PowerOnState 0; SetOption63 1; LEDState 1; LEDMask 0x0001 -Rule1 ON System#Boot DO Power3 On ENDON ON Power2#State DO Power4 %value% ENDON +Backlog SerialLog 0; PowerOnState 0; SetOption63 1; LEDState 1 +Rule1 ON System#Boot DO Power3 On ENDON # Turn the USB port on Rule1 1 ``` \ No newline at end of file