Making an old Tefal Raclette 'smart'

So we have this trusty old Tefal Raclette. We’re very fond of it, nice to enjoy slow-food with friends.
Problem is that the on/off switch went haywire, gave up completely.
So we checked, the spare part was very expensive, and the newer models weren’t as nice as ours with a nice wooden base.
Therefore I decided to fix it by adding my own relay to it.
Parts I needed:
A relay with an esp01s (or double relay) (I chose this)
A PSU for it, 5V or 12V depending on the board above (I got this).
A button to turn it on and of locally.
A LED to indicate whether it was on or off ( I decided to use a button with an LED in it)

Placing these small components in the unit was tricky, there is not much room in it, and I fear it gets rather hot down there. But I got them placed, and fixed them to the ‘chassic’ with hot-glue.




After that, I placed some cork on top of the electronics to at least attempt to shield it from the heat (I cut up an old table protector).

So one relay for the 230V, and one relay for the 5V LED in the button.
I still need a 3D printed plate for the button, but for now it’s just hot-glued to the chassis.
I built in a 120 min delay in the relay, so if you forget to turn it off, it will automatically turn off after 2 hours.
The code exposes the LED and the relay to HA, the relay will change the LED, but the LED will not swtich the relay, so in the future I could add some signalling functions in the LED.

The code looks like this (thanks to @tom_l for helping out with the pushbutton)

substitutions:
  device_name: raclette

esphome:
  name: ${device_name}
  platform: ESP8266
  board: esp01_1m
#  on_boot:
#    then:
#      - switch.turn_on: relay
#      - light.turn_on: buttonlight

wifi:
  ssid: !secret wifissid
  password: !secret wifipw
  reboot_timeout: 60min
  manual_ip:
    static_ip: 10.11.13.99
    gateway: 10.11.13.1
    subnet: 255.255.255.0
  fast_connect: true
  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "${device_name} Hotspot"
    password: !secret appw

# Enable Home Assistant API
api:

ota:
  password: !secret otapw

time:
  - platform: homeassistant
    id: homeassistant_time

# Enable logging
logger:
  baud_rate: 0 #need this to free up UART pins

uart:
  baud_rate: 115200 # speed to STC15L101EW
  tx_pin: GPIO1
  rx_pin: GPIO3
  
web_server:
  port: 80
  auth:
    username: !secret webuser
    password: !secret webpw

# Timer for auto turnoff
script:
  id: countdown
  then:
  - delay: 120min  # timer length
  - switch.turn_off: relay

# Text Sensor with general information
text_sensor:
  - platform: version
    name: '${device_name} ESPHome Version'
  - platform: wifi_info
    ip_address:
      name: '${device_name} ip'
    ssid:
      name: '${device_name} ssid'

binary_sensor:
  - platform: gpio
    id: button
    internal: true
    pin:
      number: GPIO2
      mode: INPUT_PULLUP
#      inverted: true
    on_press:
      - switch.toggle: relay
    filters:
      - delayed_off: 10ms
sensor:
  - platform: wifi_signal
    name: '${device_name} wifi signal'
    update_interval: 60s
    accuracy_decimals: 0
  - platform: uptime
    name: '${device_name} uptime'
    unit_of_measurement: days
    update_interval: 300s
    accuracy_decimals: 1
    filters:
      - multiply: 0.000011574


switch:
  - platform: template
    name: 'Raclette'
    id: relay
    turn_on_action:
      - light.turn_on: buttonlight
      - script.execute: countdown
      - delay: 1s
      - uart.write: [0xA0, 0x01, 0x01, 0xA2]
    turn_off_action:
      - script.stop: countdown
      - uart.write: [0xA0, 0x01, 0x00, 0xA1]
      - delay: 1s
      - light.turn_off: buttonlight
    optimistic: true

output:
  - platform: template
    type: binary
    id: light_relay
    write_action:
      - if:
          condition:
            light.is_on: buttonlight
          then:
            uart.write: [0xA0, 0x02, 0x01, 0xA3]
          else:
            uart.write: [0xA0, 0x02, 0x00, 0xA2]

light:
  - platform: binary
    id: buttonlight
    name: Powerindicator
    output: light_relay

I’m going to experiment with shorter delays, something like 300ms if ‘delay’ understands that, just to make it more ‘reactive’.
But it works, and the electonics doesn’t get that hot:

5 Likes

I’ve lowered the switch delay between the two relays to 20ms, and the button fiter is raised to 30ms, so it shouldn’t be a problem relays not being done with the switching if the button is pressed very quickly.