ENER-J Smart WiFi Touch Switch 2 Gang

Does anybody here have one of these?

https://www.ener-j.co.uk/products/view/independent-wifi-iot-solutions/smart-wifi-touch-switch--2-gang-no-neutral-needed/99338

Interested in thoughts for integrating into either HA or Node-RED (without using IFTTT).

Have successfully flashed their double sockets with ESPhome, and looking for confirmation these have compatibility?

And this is the working esphome config.

esphome:
  name: lounge_light_switch
  platform: ESP8266
  board: esp01_1m

wifi:
  ssid: "xxxxxxxxx"
  password: "xxxxxxxxx"

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Lounge Light Switch"
    password: "xxxxxxxx"

captive_portal:

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:

binary_sensor:
  - platform: gpio
    pin:
      number: GPIO14
      mode: INPUT_PULLUP
      inverted: True
    name: "Right Button"
    on_click:
      - switch.toggle: right_relay

  - platform: gpio
    pin:
      number: GPIO12
      mode: INPUT_PULLUP
      inverted: True
    name: "Left Button"
    on_click:
      - switch.toggle: left_relay

switch:
  - platform: gpio
    id: right_relay   
    pin:
      number: GPIO04
    name: "Right Relay"
    icon: mdi:lightbulb
    
  - platform: gpio
    id: left_relay   
    pin:
      number: GPIO13
    name: "Left Relay"
    icon: mdi:lightbulb

I’ve just bought one of their double sockets. What did you need to do to flash them with ESPhome?

I compiled the *.bin file within esphome and then flashed the socket using tuya-convert which I had setup on an old pi.

Check out this thread;

Got it. Awesome. Thanks.
I’ll have to go beg to borrow a friend’s Pi.
What did your final esp node yaml look like? How did you figure the GPIO numbers out?

@ Holdestmade esphome config worked first time. I had to do some poking around with the 2 gang light switch though to discover what gpio’s were where. But shall change the domain from “switch” to “light” before I install it.

1 Like

So did you ever manage to sort this?

Yes, it works.

Thanks for your reply Lev!
I’m a complete newbie on Home assistant (Raspberry Pi came today!) and I want to make touch screen tablets in my house at certain entrances etc. I’m assuming Ener-J switched are not compatible with HA so would I need to flash them?

I’m having trouble trying to compile the yaml to get a bin file. It validates fine.

Blockquote
INFO Reading configuration /config/esphome/7IG.yaml…
INFO Generating C++ source…
INFO Compiling app…
INFO Running: platformio run -d /config/esphome/tasmota_91ad26-3366
Processing tasmota_91ad26-3366 (board: esp01_1m; framework: arduino; platform: [email protected])


HARDWARE: ESP8266 80MHz, 80KB RAM, 1MB Flash
PACKAGES:

  • framework-arduinoespressif8266 3.20704.0 (2.7.4)
  • tool-esptool 1.413.0 (4.13)
  • tool-esptoolpy 1.20800.0 (2.8.0)
  • toolchain-xtensa 2.40802.200502 (4.8.2)
    Library Manager: Installing Update
    Library Manager: Already installed, built-in library
    Dependency Graph
    |-- 1.2.3
    | |-- 1.0
    |-- 1.0
    |-- 1.2
    | |-- 1.0
    |-- 1.2.7
    | |-- 1.2.3
    | | |-- 1.0
    | |-- 1.0
    | |-- 1.0
    |-- 1.1.1
    | |-- 1.0
    Retrieving maximum program size /data/tasmota_91ad26-3366/.pioenvs/tasmota_91ad26-3366/firmware.elf
    Checking size /data/tasmota_91ad26-3366/.pioenvs/tasmota_91ad26-3366/firmware.elf
    RAM: [==== ] 45.0% (used 36836 bytes from 81920 bytes)
    Flash: [==== ] 39.1% (used 400132 bytes from 1023984 bytes)
    ========================= [SUCCESS] Took 5.88 seconds =========================
    INFO Successfully compiled program.
    INFO Resolving IP address of tasmota_91ad26-3366.local
    ERROR Error resolving IP address of tasmota_91ad26-3366.local. Is it connected to WiFi?
    ERROR (If this error persists, please set a static IP address: WiFi Component — ESPHome)
    ERROR Error resolving IP address: Error resolving address with mDNS: Did not respond. Maybe the device is offline., [Errno -5] No address associated with hostname

Looks like it has compiled the bin file, the error was in resolving the IP of the device.

Hi Lev,

Using your config, the flashed devices work on home assistant but the hardware buttons don’t work for one of the switches. I’ve flashed three sockets and they all have the same issue. It’s always the the right hand side switch that won’t work physically but I can turn it on and off using home assistant. Any help would be appreciated. Thanks.

If you pushed the config for the light switch into the socket then it will not work, I remember having to poke around to find the correct GPIO pinout for the lightswitch, push the config from this thread to the sockets Ener-j Smart WiFi Weatherproof Double Socket

Also, you want to change the domain from “switch” to “light” when flashing the light switches, that was a hangover from the socket config copied and pasted!

How do I change the domain?

I’m flashing Ener-J light switches btw…

Change the config here,

The buttons are working on mine, only thing I can think is that there may be some update or change on the pinout, cant recall but do they have any sticker with revision number, will have a look to see if there is anything on mine.

I’ve changed what you mentioned above - from “switch” to “light”…this is the error code when I validate…

Failed config

binary_sensor.gpio: [source /config/esphome/switch1.yaml:32]
  platform: gpio
  pin: 
    number: GPIO13
    mode: INPUT_PULLUP
    inverted: True
  name: Chandeliers
  on_click:  [source /config/esphome/switch1.yaml:39]
    - [source /config/esphome/switch1.yaml:39]
      
      Unable to find action with the name 'switch.toggle'.
      switch.toggle: right_relay [source /config/esphome/switch1.yaml:39]
binary_sensor.gpio: [source /config/esphome/switch1.yaml:41]
  platform: gpio
  pin: 
    number: GPIO12
    mode: INPUT_PULLUP
    inverted: True
  name: Spotlights
  on_click:  [source /config/esphome/switch1.yaml:48]
    - [source /config/esphome/switch1.yaml:48]
      
      Unable to find action with the name 'switch.toggle'.
      switch.toggle: left_relay [source /config/esphome/switch1.yaml:48]
light.gpio: [source /config/esphome/switch1.yaml:51]
  
  Platform not found: 'light.gpio'.
  platform: gpio
  id: right_relay
  pin: 
    number: GPIO04
  name: Chandeliers
  icon: mdi:lightbulb
light.gpio: [source /config/esphome/switch1.yaml:58]
  
  Platform not found: 'light.gpio'.
  platform: gpio
  id: left_relay
  pin: 
    number: GPIO13
  name: Spotlights
  icon: mdi:lightbulb
'`````

This is my config yaml

esphome:
  name: livingroomswitch1
  platform: ESP8266
  board: esp01_1m

wifi:
  ssid: "Main Hub"
  password: 
  manual_ip:
    static_ip: 192.168.86.150
    gateway: 192.168.86.1
    subnet: 255.255.255.0
    dns1: 192.168.86.1
    dns2: 192.168.86.1

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Switch1 Fallback Hotspot"
    password: "sunLVrwTadoV"

captive_portal:

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:

binary_sensor:
  - platform: gpio
    pin:
      number: GPIO13
      mode: INPUT_PULLUP
      inverted: True
    name: "Chandeliers"
    on_click:
      - switch.toggle: right_relay

  - platform: gpio
    pin:
      number: GPIO12
      mode: INPUT_PULLUP
      inverted: True
    name: "Spotlights"
    on_click:
      - switch.toggle: left_relay

light:
  - platform: gpio
    id: right_relay   
    pin:
      number: GPIO04
    name: "Chandeliers"
    icon: mdi:lightbulb
    
  - platform: gpio
    id: left_relay   
    pin:
      number: GPIO13
    name: "Spotlights"
    icon: mdi:lightbulb