Custom remote, Sonoff RE5V1C and EspHome

I want to share my journey to getting some blinds controllable via OpenHab.
My use case is a very specific one but the solution actually can apply to many many other use cases.

I have blinds from the brand Jarolift. Those work with a remote control over 433 MHz.
There is a way to buy a USB magic controller that costs about an eye… or an extra remote for a few bucks…

I went for the extra remote. The PCB is full of emptyness and contains 4 push buttons:

  • Reset
  • Up
  • Stop
  • Down

I am not really interested in the Reset button and I decided to actually NOT interface it to avoid issues like unpairing, etc…

So I was left with 3 push buttons to automate.

Sonoff RE5V1C

I first tested the Sonoff RE5V1C modules. Those have a little relay.
They work pretty good but I quickly realized they were not the right option for my problem since I would need 3 of them, they would use 3 IP Addresses, etc… that did not sound right for this use case but they make good options if you only need to pilot ONE switch.

ESP Home

I then decided to check out ESPHome and I have tons of ESP8266 around.
It was time to put one of those Wemos D1 Mini to use.

The benefit of using an ESPXXX is that you get quite some GP-I/O. So you can easily control from a few to many outputs, you can also get some data in should you need it.

I decided to leave the micro switches on the original PCB and simply add “digital” switches in parallel.

For that, I used 3x 2N3906 (PNP) transistors, with a 330Ω resistor at the base.
Once I connected the ground of my ESP to the ground of the “alien” PCB, things started working really well.

ESP Home allows a few helpful things:

  • interlocking: GPIO Switch — ESPHome which helps avoiding telling the blinds to go up and down at the same time !!!
  • momentary switch: GPIO Switch — ESPHome since I am simulating a human press of a buttion, I only want to depress the button 1s and “release”
  • active low: GPIO Switch — ESPHome since PNP reverses what you expest by default

Having that in place, I also added a safeguard (probably overkill) in OH using expire:

Switch                esph_office__Up                                  "ESPH Office Up"                                                                           (MarquiseOffice)     {channel="esphome:device:esph-office:up", expire="2s,command=OFF"}

so that, no matter what, the OFF command is sent after 2s, in case ESP Home would have missed that. I want to make sure I am not “pressing” those buttons forever since it would deplete the small button battery of the PCB pretty quick.

All in all, that works very well and uses a single ESPHome node (=IP) for potentially many I/O (mutliplexers, relays, etc could be used).

I 3D Printed an encloure that:

  • still provide access to the original buttons
  • uses glass fiber as light guides to see the Wemos LED and the Jarlift LED from the outside

Once the original Lithium battery is depleted, I will likely remove it and replace it using the 3V3 from the Wemos, allowing to no longer care about batteries.

From my initial tests, both latency and stability are excellent. it was tempted to ask more to the ESP Home node and monitor the battery voltage etc… but this time :slight_smile: I decided to KISS and the benefit to that is that it was wrapped up in a day.

For those new to ESP Home, the programming can be a bit clunky but once you found something that works, it is prety nice.

They suggest Docker as magic option (and it is nice) but you MUST use a limited set of Browsers (no Brave for instance) as it requires WebSerial, you MUST use httpS to flash using Docker.

A node is “programmed” using YAML such as:

esphome:
  name: esph-office
  comment: Marquise Office Controller
  area: Office
  on_boot:
      priority: 600
      then:
        - switch.turn_off: up
        - switch.turn_off: stop
        - switch.turn_off: down

esp8266:
  board: d1_mini

# Enable logging
logger:


# Enable Home Assistant API
# Not sure if that one is required for OH
api:
  password: "<REDACTED>"

ota:
  - platform: esphome
    password: "<REDACTED>"

wifi:
  ssid: "<REDACTED>"
  password: "<REDACTED>"

captive_portal:

switch:
  - platform: gpio
    pin: GPIO02
    name: "LED"
    id: led
    inverted: yes

  - platform: gpio
    id: up
    name: "Up"
    icon: "mdi:gate"
    pin: GPIO12
    inverted: yes
    on_turn_on:
      - delay: 1000ms
      - switch.turn_off: up
    interlock: [stop, down]

  - platform: gpio
    id: stop
    name: "Stop"
    icon: "mdi:gate"
    pin: GPIO13
    inverted: yes
    on_turn_on:
      - delay: 1000ms
      - switch.turn_off: stop
    interlock: [up, down]

  - platform: gpio
    id: down
    name: "Down"
    icon: "mdi:gate"
    pin: GPIO14
    inverted: yes
    on_turn_on:
      - delay: 1000ms
      - switch.turn_off: down
    interlock: [stop, up]

This YAML, using scons and platformio will generated a firmware you can flash to your device.
From there you need to install the ESP Home Addon manually (see other post in this forum) and you are good to go.

1 Like

A little update, some photos and some tips.

Remote 1




Remote 2

While the cases don’t exactly look very “design”, they do the job.
On the remote #2 (my first one actually), I went a bit overboard with ways through the 3d printed buttons Up / Stop / Down to reach the actual buttons of the remote. We also see the 2 glass fibers I am using as light guide to pick up the LED of the ESP8266 as well as the LED of the remote itself. it is useful to debug, but totally useless afterwards.

As far as:

# Enable Home Assistant API
# Not sure if that one is required for OH
api:
  password: "<REDACTED>"

is concerned, you do need it but not in this form.
The best option is to define encryption_key as secret and then:

api:
  encryption:
      key: !secret encryption_key

In the Binding, you then DO NOT provide the DEPRECATED Passsword but the base64 key instead:

Finally, before you unplug the device to bring it to location, you should define:

ota:
  - platform: esphome
    password: !secret ota_pass

(again ota_pass is defined as secret) and test that you can do a wireless update.
That makes things MUCH easier for later updates and adjustements.

I started opening such remotes around and they ALL are very similar with their 2-4 buttons.
The radio is a simple chip. Those remotes are often sold for close to $100 which is TOTALLY overpriced for that kinda of hardware… so hack the planet :slight_smile: