Relay triggering on boot

Hey ladies and gents,

I have a Powertech MS6106 wall plug here, Tuya chip on the inside, flashed to ESPhome Here
When the device is powered up it cycles power to the relay.

I have been through the previous topic ESP8266 Relay (active low): how to prevent triggering on boot or reset (SOLVED) here.

None of the restore modes worked, relay still cycles.

restore from flash also has not worked

Not defining the switch (the relay) causes it to turn on and stay on, turns of when power is removed obviously.

Removing the on_press has no change not he fault.

Removing the inverted: true has no change on the fault.

I have yet to try manually adding the digital writes to code yet, Replys seem to say this was implemented with restore modes.

The real kicker here is when I don’t define the binary sensor for the built in switch, the relay is fine and remains off doing power up. So I tried a debounce filter on the switch as will which doesn’t change anything.

So a little lost here on what to do next.

I also have a aliexpress inching relay on the garage door that’s worked seamless and safe for the last year or more, that in the last month has triggered the door to open with out command. Once during a small brown out (was 4 hours from home for Christmas. that stressed me out, ontop of the router breaking an hour later knocking out the wifi for all my smart devices lol) the 2nd time was a few days ago when I killed the HA instance for a hardware upgrade. seems like after a period of time with no server connection esphome devices were rebooting themselves.

(Important info removed from code)

esphome:
  name: 
  platform: ESP8266
  board: esp8285
#  esp8266_restore_from_flash: true

captive_portal:

# Enable logging
logger:

# Enable Home Assistant API


status_led:
  pin:
    number: GPIO00
    inverted: yes 
    
# INPUT AREA 

binary_sensor:
  - platform: gpio
    name: "Jaycar1 S1"
    pin:
      number: GPIO013
      mode: INPUT_PULLUP
      inverted: True
    filters:
     - delayed_on: 50ms
    on_press:
      - switch.toggle: relay
      
switch:
  - platform: gpio
    restore_mode: ALWAYS_OFF
    name: "Jaycar1 relay"
    pin: GPIO15
    id: relay

Can you try to remove:
mode: INPUT_PULLUP
inverted: True
from binary_sensor.
It is hard to know without inspecting the real hardware, but maybe is switch constructed in different way than tipical active short to ground.

Yup, had already tried that. Still didn’t change anything.

Managed to open one up, they are glued together, and still need to solder the mains pins out to remove the PCB to do a little reverse engineering. Its a dual relay device where both mains and neutral are switched. There is only a single secondary chip on the main board and google says its a SMPS controller, not a serial based mcu

Did you ever resolve this, and get these going?

Nope, both switches died in quick succession.

Crap product, Do not buy. LOL

I Added a zigbee hub and use Ikea Tradfri gear a heap now.

You may have some success by having ESPHome set the device’s state during boot.
Try adding something like this (change the ID of the switch to match your code).

esphome:
    on_boot:
      priority: 700.0
      # ...
      then:
        - switch.turn_on: your_relays_id

You can adjust ‘priority’ according to the docs on this feature.
link to docs for ‘on_boot’

1 Like