Open banter7702 opened 8 months ago
You probably need to add the "remote_receiver" component to ESPHome. This device doesn't look like it has TuyaMCU, so the 433 MHz receiver chip is probably directly connected to a GPIO. You need to find that GPIO and add an appropriate component.
You probably need to add the "remote_receiver" component to ESPHome. This device doesn't look like it has TuyaMCU, so the 433 MHz receiver chip is probably directly connected to a GPIO. You need to find that GPIO and add an appropriate component.
Is there a way to find the gpio thru firmware dump? Just like ltchiptool that grabs automatically? Is there a detailed guide about this?
We might be able to find the GPIO if you post the firmware dump here (or "Source data" from ltchiptool).
We might be able to find the GPIO if you post the firmware dump here (or "Source data" from ltchiptool).
Ok. Before posting it here, is there anything that I should consider like any identifiable info such as usernames and passwords? Is there a way I could do to redact them?
I dumped them already connected to tuya.
But if there is nothing I could do, can I DM it to you? I would rather have a working relay with RF433 functionality.
If you've paired it to Tuya before dumping, your wifi SSID and password will be there. They're encrypted, so you can't redact it easily.
However, you can post the source data from ltchiptool. It is unencrypted, and you'll find the SSID and password fields there - just mask them out and you'll be fine.
If you've paired it to Tuya before dumping, your wifi SSID and password will be there. They're encrypted, so you can't redact it easily.
However, you can post the source data from ltchiptool. It is unencrypted, and you'll find the SSID and password fields there - just mask them out and you'll be fine.
Hi,
Is this what we need? I dont know what I'm looking at, sorry. I hope we can find what we need to restore the RF functionality. Please tell me if I masked a lot of info so I could restore it:
{
"gw_bi": {
"uuid": "redacted",
"psk_key": "redacted",
"auth_key": "redacted",
"ap_ssid": "SmartLife",
"ap_passwd": null,
"country_code": "CN",
"bt_mac": null,
"bt_hid": null,
"prod_test": false,
"fac_pin": "redacted"
},
"user_param_key": {
"bt1_lv": 0,
"bt1_pin": 8,
"bt2_lv": 0,
"bt2_pin": 9,
"bt3_lv": 0,
"bt3_pin": 10,
"bt4_lv": 0,
"bt4_pin": 11,
"ch_cddpid1": 9,
"ch_cddpid2": 10,
"ch_cddpid3": 11,
"ch_cddpid4": 12,
"ch_dpid1": 1,
"ch_dpid2": 2,
"ch_dpid3": 3,
"ch_dpid4": 4,
"ch_num": 4,
"crc": 109,
"cyc_dpid": 43,
"inch_dp": 44,
"init_conf": 38,
"jv": 100,
"module": "CB3S",
"net_trig": 4,
"net_type": 0,
"netled1_lv": 0,
"netled1_pin": 22,
"netn_led": 0,
"nety_led": 0,
"on_off_cnt": 10,
"onoff_clear_t": 6,
"onoff_rst_m": 0,
"onoff_rst_type": 2,
"onoff_type": 2,
"rand_dpid": 42,
"remote_add_dp": 49,
"remote_io": 20,
"remote_list_dp": 50,
"remote_select": 1,
"reset_t": 5,
"rf_width": 345,
"rl1_lv": 1,
"rl1_pin": 24,
"rl2_lv": 1,
"rl2_pin": 6,
"rl3_lv": 1,
"rl3_pin": 26,
"rl4_lv": 1,
"rl4_pin": 14,
"series_ctrl": 0,
"total_bt_lv": 0,
"total_bt_pin": 7,
"total_stat": 0,
"zero_select": 0
},
"gw_di": {
"abi": 0,
"id": "redacted",
"swv": "1.3.10",
"bv": "40.00",
"pv": "2.2",
"lpv": "3.4",
"pk": "redacted",
"firmk": "redacted",
"cadv": "1.0.5",
"cdv": "1.0.0",
"dev_swv": "1.3.10",
"s_id": "redacted",
"dtp": 0,
"sync": 0,
"attr_num": 1,
"mst_tp_0": 100,
"mst_ver_0": "100",
"mst_md5_0": "redacted",
"mst_tp_1": 0,
"mst_ver_1": null,
"mst_md5_1": null,
"mst_tp_2": 0,
"mst_ver_2": null,
"mst_md5_2": null,
"mst_tp_3": 0,
"mst_ver_3": null,
"mst_md5_3": null
},
"timer_arr": {
"lastFetchTime": 0,
"cnt": 0
},
"inch_time_key": "\u0000\u0000\u0002\u0002\u0000\u0002\u0004\u0000\u0002\u0006\u0000\u0002",
"gw_wsm": {
"nc_tp": 4,
"ssid": "redacted",
"passwd": "redacted",
"md": 0,
"random": 0,
"wfb64": 1,
"stat": 2,
"token": "redacted",
"region": "AZ",
"reg_key": "redacted",
"dns_prio": 0
},
"wf_start_md": 3,
"tls_ca_cnt": 0,
"is_stride": 0,
"gw_ai": {
"key": "redacted",
"lckey": "redacted",
"h_url": "http://a.tuyaus.com/d.json",
"h_ip": "54.203.227.253",
"hs_url": null,
"hs_ip": null,
"hs_psk": "https://a3.tuyaus.com/d.json",
"hs_psk_ip": "34.218.147.23",
"mqs_url": null,
"mqs_ip": null,
"mq_url": "m2.tuyaus.com:1883",
"mq_ip": "54.212.163.173",
"ai_sp": null,
"ai_sp_ip": null,
"mq_psk": "m2.tuyaus.com:8886",
"mq_psk_ip": "54.212.163.173",
"lp_url": "baal.tuyaus.com",
"lp_ip": "52.25.248.208",
"time_z": "+08:00",
"s_time_z": "[]",
"wx_app_id": null,
"wx_uuid": null,
"dy_tls_m": 2,
"cloud_cap": 1025,
"psk21_key": null
},
"000004g6t2": [
{
"type": "obj",
"mode": "rw",
"property": {
"type": "bool"
},
"id": 1
},
{
"type": "obj",
"mode": "rw",
"property": {
"type": "bool"
},
"id": 2
},
{
"type": "obj",
"mode": "rw",
"property": {
"type": "bool"
},
"id": 3
},
{
"type": "obj",
"mode": "rw",
"property": {
"type": "bool"
},
"id": 4
},
{
"type": "obj",
"mode": "rw",
"property": {
"min": 0,
"max": 86400,
"scale": 0,
"step": 1,
"type": "value"
},
"id": 9
},
{
"type": "obj",
"mode": "rw",
"property": {
"min": 0,
"max": 86400,
"scale": 0,
"step": 1,
"type": "value"
},
"id": 10
},
{
"type": "obj",
"mode": "rw",
"property": {
"min": 0,
"max": 86400,
"scale": 0,
"step": 1,
"type": "value"
},
"id": 11
},
{
"type": "obj",
"mode": "rw",
"property": {
"min": 0,
"max": 86400,
"scale": 0,
"step": 1,
"type": "value"
},
"id": 12
},
{
"type": "obj",
"mode": "rw",
"property": {
"range": [
"off",
"on",
"memory"
],
"type": "enum"
},
"id": 38
},
{
"type": "obj",
"mode": "rw",
"property": {
"type": "string",
"maxlen": 255
},
"id": 42
},
{
"type": "obj",
"mode": "rw",
"property": {
"type": "string",
"maxlen": 255
},
"id": 43
},
{
"mode": "rw",
"property": {
"type": "string",
"maxlen": 255
},
"id": 44,
"type": "obj"
},
{
"type": "obj",
"mode": "rw",
"property": {
"range": [
"flip",
"sync",
"button"
],
"type": "enum"
},
"id": 47
},
{
"mode": "rw",
"id": 48,
"type": "raw"
},
{
"mode": "rw",
"id": 49,
"type": "raw"
},
{
"mode": "rw",
"id": 50,
"type": "raw"
}
],
"ble_beaconkey": "redacted",
"em_sys_env": "bk7231n",
"wd_cfg_mem": {
"power_cfg": 0,
"key_type_cfg": 2
},
"mf_test_close": true,
"wd_lock_mem": {
"ctrl_lock_cfg": "AA8AAAAAAAA="
}
}
Yes, that's it. I believe the remote_io
parameter might be the GPIO of the RF module - in this case it's P20. That matches your photo:
Yes, that's it. I believe the
remote_io
parameter might be the GPIO of the RF module - in this case it's P20. That matches your photo:
Please be patient with me. I have no idea what to do with that info. What should I do?
This is some part of my esp.yaml, if that info has something to do with it:
text_sensor:
- platform: libretiny
version:
name: LibreTiny Version
binary_sensor:
- platform: gpio
id: binary_switch_1
pin:
number: P8
inverted: true
mode: INPUT_PULLUP
on_press:
then:
- switch.toggle: switch_1
- platform: gpio
id: binary_switch_2
pin:
number: P9
inverted: true
mode: INPUT_PULLUP
on_press:
then:
- switch.toggle: switch_2
- platform: gpio
id: binary_switch_3
pin:
number: P10
inverted: true
mode: INPUT_PULLUP
on_press:
then:
- switch.toggle: switch_3
- platform: gpio
id: binary_switch_4
pin:
number: P11
inverted: true
mode: INPUT_PULLUP
on_press:
then:
- switch.toggle: switch_4
- platform: gpio
id: binary_switch_all
pin:
number: P7
inverted: true
mode: INPUT_PULLUP
on_press:
then:
- switch.toggle: switch_1
- switch.toggle: switch_2
- switch.toggle: switch_3
- switch.toggle: switch_4
switch:
- platform: gpio
id: switch_1
name: Relay 1
pin: P24
- platform: gpio
id: switch_2
name: Relay 2
pin: P6
- platform: gpio
id: switch_3
name: Relay 3
pin: P26
- platform: gpio
id: switch_4
name: Relay 4
pin: P14
status_led:
pin:
number: P22
inverted: true
Im sorry, Im so new to this. Please bear with me. I really need to restore the rf functionality and at the same time use esphome.
You need to add the Remote Receiver component on pin P20. Here are the docs: https://esphome.io/components/remote_receiver
I don't know what kind of remotes you want to use with this. You'll have to try your luck and test various protocols of that component. The docs have everything explained for you.
Ok, I'll update this topic tomorrow. It seems doable for me. Thank you very much!
You need to add the Remote Receiver component on pin P20. Here are the docs: https://esphome.io/components/remote_receiver
I don't know what kind of remotes you want to use with this. You'll have to try your luck and test various protocols of that component. The docs have everything explained for you.
Hi, update on this topic.
I've figured it out. Before posting this topic, I was about to give up already and buy another tuya relay. Thank you very much. I've learned a lot!
I've figured it out. Before posting this topic, I was about to give up already and buy another tuya relay. Thank you very much. I've learned a lot!
Would you mind posting configuration that worked for you? I have what looks like identical relay model. I will really appreciate it if you can share your setup.
@banter7702 @badrpc
I´m testing with same type of module and may I ask for your feedback what code worked for you?
In addition, could the RF chip be identified what is used on this boards? On my boards the RF SOT8 chip is blank/unprinted. Would be great to know what is used. Thx in advance!
On my board RF chip is labeled 590R-2153. I suppose this is SYN590R - the logo on the chip mathces the one you can find in internet.
I currently have the following configuration:
# Example device configuration for TUYA TYWB 4CH
# 4 channel relay with WIFI
esphome:
name: test-tywb-4ch
bk72xx:
board: cb3s
# From original firmware boot log:
#
# ******* ch[0] *******
# [RELAY] - pin:24, io_drive:2
# [KEY] - pin:8, io_drive:1, type:0, long_press:5000
# ******* ch[1] *******
# [RELAY] - pin:6, io_drive:2
# [KEY] - pin:9, io_drive:1, type:0, long_press:5000
# ******* ch[2] *******
# [RELAY] - pin:26, io_drive:2
# [KEY] - pin:10, io_drive:1, type:0, long_press:5000
# ******* ch[3] *******
# [RELAY] - pin:14, io_drive:2
# [KEY] - pin:11, io_drive:1, type:0, long_press:5000
#
# ******* system *******
# [WIFI LED] - pin:22, io_drive:1
# [TOTAL KEY] - pin:7, io_drive:0, long_press:5
# [433 REMOTER] - pin:20, freq_min:345
# [WIFI MTHD]-5, [WIFI LED]-1, [KEY TRIG]-0
switch:
- platform: gpio
name: Relay 1
pin: P24
- platform: gpio
name: Relay 2
pin: P6
- platform: gpio
name: Relay 3
pin: P26
- platform: gpio
name: Relay 4
pin: P14
binary_sensor:
- platform: gpio
pin:
number: P8
inverted: true
name: "Button 1"
- platform: gpio
pin:
number: P9
inverted: true
name: "Button 2"
- platform: gpio
pin:
number: P10
inverted: true
name: "Button 3"
filters:
- delayed_on: 50ms
- delayed_off: 50ms
- platform: gpio
pin:
number: P11
inverted: true
name: "Button 4"
filters:
- delayed_on: 50ms
- delayed_off: 50ms
- platform: gpio
pin:
number: P7
inverted: true
name: "Mode switch key"
light:
- platform: status_led
name: "Status LED"
pin:
number: P22
inverted: true
# Not entirely clear how to use this.
# Requires further investigation.
remote_receiver:
pin:
number: P20
#inverted: true
mode:
input: true
pullup: true
dump:
# - aeha
# - byronsx
# - canalsat
# - canalsatld
# - coolix
# - dish
# - drayton
# - jvc
# - haier
# - lg
# - magiquest
# - midea
# - nec
# - nexa
# - panasonic
# - pioneer
# # - pronto
# # - raw
# - rc5
# - rc6
- rc_switch
# - samsung
# - samsung36
# - sony
# - toshiba_ac
With this configuration when I press buttons on the remote I can see the following in the logs:
19:49:10 | [I] | [remote.rc_switch:261] | Received RCSwitch Raw: protocol=1 data='101011010011010111101000'
19:49:10 | [I] | [remote.rc_switch:261] | Received RCSwitch Raw: protocol=1 data='101011010011010111101000'
19:49:10 | [I] | [remote.rc_switch:261] | Received RCSwitch Raw: protocol=1 data='101011010011010111'
19:49:13 | [I] | [remote.rc_switch:261] | Received RCSwitch Raw: protocol=1 data='101011010011010111100100'
19:49:13 | [I] | [remote.rc_switch:261] | Received RCSwitch Raw: protocol=1 data='101011010011010111100100'
19:49:13 | [I] | [remote.rc_switch:261] | Received RCSwitch Raw: protocol=1 data='101011010011010111100100'
19:49:13 | [I] | [remote.rc_switch:261] | Received RCSwitch Raw: protocol=1 data='101011010'
19:49:17 | [I] | [remote.rc_switch:261] | Received RCSwitch Raw: protocol=1 data='10101101001'
19:49:17 | [I] | [remote.rc_switch:261] | Received RCSwitch Raw: protocol=1 data='101011010011010111100010'
19:49:17 | [I] | [remote.rc_switch:261] | Received RCSwitch Raw: protocol=1 data='101011010011010111100010'
19:49:17 | [I] | [remote.rc_switch:261] | Received RCSwitch Raw: protocol=1 data='1010110100'
19:49:18 | [I] | [remote.rc_switch:261] | Received RCSwitch Raw: protocol=1 data='101011010011010111100001'
19:49:18 | [I] | [remote.rc_switch:261] | Received RCSwitch Raw: protocol=1 data='101011010011010111'
I didn't go further then simple testing with this device yet, but I think the following worked for me at some point:
binary_sensor:
# https://esphome.io/components/remote_transmitter#remote-transmitter-rc-switch-protocol
- platform: remote_receiver
name: "Remote button A"
rc_switch_raw:
code: '101011010011010111101000'
protocol: 1
Hi, I have a generic 4 channel smart relay:
I have successfuly backed up the original firmare dump and flashed it with esphome. I had to break button 3 and 4 connections temporarily because they are connected to rx and tx.
However, I lost the ability to pair it with RF remote. Previously, in tuya app, in the device settings, there is an option to add rf remote per button.
I guess there is no pairing method thru holding button.
Is there anything I could do to pair remote for each relay?