This repository will teach you how to get the relays of the S6E Tuya Smart working with Home Assistant.
So you got yourself a new sweet banger Tuya S6E Android 8.1 Smart Touch Panel. Congrats, probably blew a hole in your wallet.
You probably went through how to sideload the device and get the Home Assistant Companion app working on it, now what?
You realised your device already have relays and there is no way to get it to work. Fret not, there is a way.
Go through these 3 guides in order by the Legend himself, Blakadder before continuing here.
The Tuya S6E Panel is able to control its GPIO Pins 114 and 115 respectively for the relays through sending an echo command to its pins. This was discovered when I decompiled the test application and research how they control the Relays.
Assuming you have completed all the guides from Blakadder, you can pick up from there.
This will create an Automation to wait for a HTTP Request and then send an ADB Command to trigger the relays.
http://IPAddressOfDevice:8080/relay1on
, http://IPAddressOfDevice:8080/relay1off
, http://IPAddressOfDevice:8080/relay2on
, http://IPAddressOfDevice:8080/relay2off
on your web browser.rest_command:
relay1on:
url: http://192.168.2.162:8080/relay1on
relay1off:
url: http://192.168.2.162:8080/relay1off
relay2on:
url: http://192.168.2.162:8080/relay2on
relay2off:
url: http://192.168.2.162:8080/relay2off
This will essentially retrieve HTTP JSON Response from the Panel to check for the state of the Switch.
sensor:
- platform: rest
resource: http://192.168.2.162:8080/relay1state
name: Relay 1 State
scan_interval: 5
value_template: "{{ value_json }}"
- platform: rest
resource: http://192.168.2.162:8080/relay2state
name: Relay 2 State
scan_interval: 5
value_template: "{{ value_json }}"
switch:
- platform: template
switches:
s6e_relay_1:
friendly_name: "T6E - Relay 1"
unique_id: "t6erelay1"
value_template: "{{ is_state('sensor.relay_1_state', '1') }}"
turn_on:
service: rest_command.relay1on
turn_off:
service: rest_command.relay1off
s6e_relay_2:
friendly_name: "T6E - Relay 2"
unique_id: "t6erelay2"
value_template: "{{ is_state('sensor.relay_2_state', '1') }}"
turn_on:
service: rest_command.relay2on
turn_off:
service: rest_command.relay2off
Now you can create a Lovelace Dashboard specially for the Switch and add in these 2 switches to control the built-in relays! Congrats!
Its not the best method because, if the network or homeassistant goes down. You lose functionality of the switch. This can be easily countered by using the Test Application for emergency purposes or creating a new APK that executes the ADB Shell Command.
If the state is giving you problems, you can remove the value_template
from the template switch.