R3 WIFI3 from tuya, distributed as a magnetothermal differential switch


This device is currently distributed in Italy by EttroIT, it’s identified by Tuya as R3_WIFI3, it’s an electromechanical switch remotely controllable attached to a differential magnetothermal switch, in this case a C32 (32Amps, 6.6Kw).

I managed to disassembly it by removing the rivets, you can replace the rivets with a m2 bolt and nut, just ensure to enlarge holes by drilling them only on the surface with an 5.5 drill, then enlarge the central holes with a 2.5 drill.

The procedure is somewhat similar to any CBU - (generic-bk7231n-qfn32-tuya), you can take 3.3v and ground from there (red circles, check for ground by touching metal shell of cbu, the other pin is 3v3):

Config is really simple, down below, what you won’t find is the remote lock, commented out, since I haven’t found any way to communicate the lock with the apparatus, but AFAIC it’s not a functionality I would use anyway.

substitutions:
  name: R3_WIFI3
  friendly_name: Your Preferred Name
  
bk72xx:
  board: generic-bk7231n-qfn32-tuya

esphome:
  name: $name
  friendly_name: $friendly_name
  min_version: 2024.11.0
  name_add_mac_suffix: false

preferences:
  flash_write_interval: 
    seconds: 30

# Enable logging
logger:
  level: DEBUG

# Enable Home Assistant API
api:
  encryption:
    key: !secret api
  reboot_timeout: 120min

ota:
  - platform: esphome
    password: !secret ota

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: $name
    password: !secret ap
  reboot_timeout: 0s #120min  

captive_portal:

button:
  - platform: restart
    name: "Restart"
    id: button_restart

mdns:

debug:
  update_interval: 30s

text_sensor:
  - platform: libretiny
    version:
      name: LibreTiny Version

sensor:
  - platform: wifi_signal
    name: "RSSI"
    id: sensor_rssi
    update_interval: 30s
    entity_category: "diagnostic"
  - platform: uptime
    name: "Uptime"
    id: sensor_uptime
    update_interval: 60s
    entity_category: "diagnostic"
  - platform: tuya
    sensor_datapoint: 102
    name: Mechanic Lock
  #- platform: tuya
  #  sensor_datapoint: 103
  #  name: Remote Lock
  - platform: tuya
    sensor_datapoint: 104
    name: Local Lock

uart:
  rx_pin: RX1
  tx_pin: TX1
  baud_rate: 115200

tuya:

switch:
  - platform: tuya
    switch_datapoint: 1
    name: Switch
    restore_mode: RESTORE_DEFAULT_OFF

Nice job.
Where is the reclosing motor configured?

DP1 of the mcu is the reclosing motor switch. It’s already wrote in the configuration. mcu is controlling the reclosing, if any lock is active, it won’t start the reclosing motor.

What is DP1? I don’t see…

In what configuration?

So do you have control of reclosing??

I’ve pasted an ESPhome configuration example in the first post (I don’t know if you can’t see it), you have control on the reclosing by using the datapoint 1 of tuya mcu, while the datapoint 102 is for mechanical lock and 104 is for local lock. 103 is a remote lock switch, in original device it wouldn’t allow you to remotely control the device, but considering the nature of esphome you can provide such a lock in any other way (you could use a placeholder for that and prevent any control by using a virtual switch or sensor)

Yes, I can see your yaml.
Like you can see from my questions, I have (luckily) never configured Tuya devices, so the device slang is unfamiliar to me.
But I might try, since I actually need a RCD that I can freely configure for reclosing.
The “normal” ones try to reclose two times in few seconds and then give up. We have lot of interferences on mains lines and I need completely different timing pattern.
Thank’s.

The input is prior to output of the C32, so the device is still controllable in the case the thing has be put to off for whatever reason (reopened) but mains should be present of course, the switch can be controlled also within a yaml script inside the esphome configuration, and it’s possible to use a timing for those, but as you can imagine, you have to be extra cautious with what you automatically decide to do in those cases.
The device itself doesn’t do any ground or short-circuit check, so the magnetothermal differential will just reopen if the reclosing has any of those things (and the wifi module will get the DP1 switch immediately open after the reclosing, in this case); you can use any timings, but as an electrician, I would suggest extreme caution with anything you do when controlling such devices automatically or remotely.
If you turn on the local lock, anyway, the device wouldn’t rearm automatically (it’s a switch into the tuya module, visible and usable outside)
But, anyway, it’s possible, yes.

Thank’s for your advices. My plan is not to abuse safety device, opposite.
When we have those interferences on mains, the whole neighborhood suffers from ridiculous RCD problem, it’s not a problem of residual current . I have tried every possible class of RCDs but they all fail. So instead of reclosing after 2s and 5s, I prefer 2s, 5min for example. Flashed directly to device of course, I never do important automations out of the device.

For curiosity, did you ever ask EttroIT to provide certifications for that device?
I have always serious doubts when there is Tuya used, generally they are chinese stuff with no certifications/fake certifications…

BT-ESR3532 is probably a certified device (will confirm when I get the answer from ettroit), but it’s not intended to be used as an automatic recloser, but instead as a wifi controlled recloser, tuya in fact lacks the ability to do such a reclosing automatically.
The tuya module is only attached to the original certified module (they are kept together with two clips in plastic), the certification number and specifications are as below (in Italian, lacks CEI certs, will report when I get answer from ettroit):

Modello    ESR3532
Tipologia    Interruttore Magnetotermico Smart
Moduli    3
Poli    1P+N
Corrente In    32A
Tensione    230V/400 VAC
Consumo in Stand-by    <3W
Tempo di intervento    ≤0.1 sec
Tempo di cortocircuito    ≤0.04 sec
Curva    C
Metodo di Controllo    Integrato manuale e automatico
Metodo di comunicazione    WiFi, Contatto Pulito
Gestione Remota    Si mediante App Tuya
WiFi    Si
Potere d'interruzione Inc    4.500A
Indice di protezione IP    IP20
Normativa    GB/T10963.1-2020
Certificazione    CE

I will ask anyway the ettroit people for the certificate for the EU (just out of curiosity), since this is what I did find on the specs module, will put an answer here when I get it

1 Like

Just to inform, I have received absolutely no aswer from them, the device itself has the stamp that informs that it is compliant with the cei en 61009-1, but still, the fact that they never answered, is not a good sign.

EDIT:
BTW, since the stamp is on the recloser itself and not on the differential, assuming everything is good, doing any phisical modification will invalidate the certification, always assuming it’s good.

But the certificate is about “magnetothermal differential”, not about recloser. So if you separate the two parts, what we have? :sweat_smile:

cei en 61009-1 speaks about the RCD with circuit breaker for overcurrent, the mentioned law is also for the two devices sold as one.

But generally speaking, if you separate them, you have nothing :smiley:

RCD is “differenziale”, circuit breaker for overcurrent is “magnetotermico”. Nothing about recloser.

Anyway, one should always be aware that the waters are gray when something happens. In this case at least there is local importer that might take some responsability.

But think, if you burn your house with a smart switch like this bought from amazon:


There is absolutely no way to trace the manufacturer.
The brand is Jikoiuty and the vendor is:

You are going to have lot of fun with your insurance company…

eh, you’re absolutely right, that recloser-RCDO is mounted, at least on my case, below an external fountain, but the recloser is already protected by another device in the main panel inside the house.

Considering the lack of answers and the way it is, I would not use it for protecting an electrical line inside an house, but only as a toy.

Thank’s for sharing this.

I wanted to add something to what I’ve said above, given that I haven’t yet received a definitive answer, supported by documentation certifying its validity as a surge and ground fault protection device.
I have a photovoltaic system with a storage battery (on-grid, I also sell the surplus to the grid), and I’m using this device, placed under an appropriate protection device, to disconnect from the grid when I don’t have any surplus to sell and if the battery is above 35%.
Below there is a configuration that takes into account the case study mentioned above by @Karosm, but without certification, we have no certainty of its validity. The instrument tests obviously confirm the device as valid (<30mA for the leakage protection part, and also good for the magnetic part), but we’re still waiting for some kind of valid certificate, given that the stamp on the device itself is invalid, as it’s placed on the reclosing system and not on the protection mechanism (but, even if not tested, this reclosing device could be attached to a compatible protection device, of course certified).

substitutions:
  name: "your_name"
  friendly_name: Friendly Device Name

#Include the board used  
bk72xx:
  board: generic-bk7231n-qfn32-tuya

esphome:
  name: $name
  friendly_name: $friendly_name
  name_add_mac_suffix: false

mdns:

text_sensor:
  - platform: libretiny
    version:
      name: LibreTiny Version

#include common Wifi-OTA-API, etc
preferences:
  flash_write_interval: 
    seconds: 3

# Enable logging
logger:
  level: INFO

# Enable Home Assistant API
api:
  encryption:
    key: !secret api
  reboot_timeout: 30min

ota:
  - platform: esphome
    password: !secret ota

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  reboot_timeout: 20min

#restart button
button:
  - platform: restart
    name: "Restart"
    id: button_restart

binary_sensor:
  - platform: tuya
    id: mlock
    sensor_datapoint: 102
    name: Mechanic Lock
    on_release: 
      then:
        - lambda: |-
            (id(attempts) = 0);
  - platform: tuya
    id: llock
    sensor_datapoint: 104
    name: Local Lock
    on_release: 
      then:
        - lambda: |-
            (id(attempts) = 0);

sensor:
  - !include common/sensors/wifi_signal.yaml
  - !include common/sensors/uptime.yaml

uart:
  rx_pin: RX1
  tx_pin: TX1
  baud_rate: 115200

tuya:

switch:
  - platform: tuya
    switch_datapoint: 1
    name: Switch
    id: MTD
    restore_mode: RESTORE_DEFAULT_OFF
    on_turn_on: 
      then:
        - script.stop: cycle_script
        - script.stop: act_script
        - script.execute: act_script
    on_turn_off: 
      then:
        - script.stop: act_script
        - script.stop: cycle_script
        - script.execute: cycle_script
  - platform: tuya
    id: rlock
    switch_datapoint: 103
    name: Remote Lock
    restore_mode: RESTORE_DEFAULT_OFF
    on_turn_off: 
      then:
        - lambda: |-
            (id(attempts) = 0);

globals:
  - id: attempts
    type: int
    restore_value: False
    initial_value: '0'

script:
  - id: cycle_script
    mode: single
    then:
      - if:
          condition:
            and:
              - switch.is_off: MTD
              - switch.is_off: rlock
              - binary_sensor.is_off: mlock
              - binary_sensor.is_off: llock
              - lambda: |-
                  return (id(attempts) < 3);
          then:
            - lambda: |- 
                (id(attempts) += 1);
            - delay: !lambda |-
                return (id(attempts) * 180000);
            - if:
                condition:
                  and:
                    - switch.is_off: MTD
                    - switch.is_off: rlock
                    - binary_sensor.is_off: mlock
                    - binary_sensor.is_off: llock
                then:
                  - switch.turn_on: MTD
  - id: act_script
    mode: single
    then:
      - delay: 2 min
      - if:
          condition:
            - switch.is_on: MTD
          then:
            - lambda: |- 
                (id(attempts) = 0);

I finally have the corresponding certifications, valid for EU, can’t attach them here as they don’t allow PDF, and that’s pretty lame, will upload them to google drive.

https://drive.google.com/drive/folders/1K9b_5sElNoe7XWIAFKPq_X0Lrmlop7-o?usp=sharing

Edit: at least I can consider this safe for my fountain and for the main entrance below grid connection. As said above anyway, any mod to the main software, unless done software only (and this can’t be done software only, you have to drill the old rivets and place new ones, unless you are very firm and good this will be noticied), would probably invalid any guarantee, so be careful, even if certified, an insurance company will search anything to not pay you.

Be safe, cheers

device was added to devices->esphome, I suggest following the guide indicated which includes more details, EttroIT ESR3516/ESR3532 DIN Rail RCBO | devices.esphome.io