T4EU1C and Home Assistant

a 3-gang wall switch for your home automation – using eWelink, T4EU1C and Home Assistant

On the left is the 3-gang light switch – one switch is hard wired to a light. But two switches are available for any use. For the detail on how I set up the Sonoff T4EU1C on the right see this project. (Annoyingly, the switch on the left is fatter so I must remake that white bezel to get them level).

I got to a point where I had plenty of ‘smart’ lights and gadgets but few switches. But then I found a 3-gang version of the T4EU1C wall plate switch. It works over wifi and is inexpensive. This project adds real switches where I need them.

Why do this? I think people like switches and not everyone is happy to:

  • use a voice command ‘Alexa / OK Google turn on the …’
  • use a phone app such as ‘Hue’ or ‘Tuya Smart’
  • use the web frontend of ‘Home Assistant’ and click a light switch there.
  • use a sensor or a time of day to make the thing turn on

The AOYAN 3-gang wall switch isn’t a Sonoff product but it does work with the Sonoff app eWelink. The switch replaced the single-gang light switch shown. As well as working with the Sonoff eWelink app and thus also with Home Assistant, the unit works with UK light wiring that has no neutral wire in the back box.

You’re dealing with mains electricity so you must disconnect the supply or consider your possible death. After removing the original switch my back box has only two wires – my lamp wire connects to L1, my live wire connects to L. If my lamps were LED lamps I might need to add a capacitor across the LED lamp connections. They were tungsten lamps so there’s no more to do except to pair the 3-gang switch with eWelink. (Push one of the light switch buttons until it starts to flash. Then get the eWelink app to go searching for it).

Note also that this unit responds to 433MHz signals! That means you could pair the buttons on an RF remote to each of the buttons on the wall switch.

Install the Sonoff component into ‘Home Assistant’ and restart Home Assistant

You need to have added the Sonoff component to Home Assistant. How to do that is here. When Home Assistant restarts you should have gained three entities for the wall light switch. Look in Entities to find them listed. The switch will have a name such as the following. You might want to customise its name as I have here:

You now have a switch for the light and two unused buttons

Now’s the time to make the buttons useful. The first button is actually wired to a light and the other two are not. By using automations in Home Assistant you can now make any button turn on anything. You could even make the first button turn on several lights even though it’s only wired to one! Here’s what I did in the Home Assistant automation section.

Button 2: the automation below is triggered when button 2 changes state from ‘on’ to ‘off’ and its action is to call a script which turns four lights off at once. In addition this automation will also be triggered at 1:30 am just in case the lights get left on.

Button 2 has a second automation that is triggered when button 2 changes state from ‘off’ to ‘on’. The automation’s action is to call a script which turns four lights on at once.

Button 3 had a very similar automation which turned the TV on and set the channel using the Logitech Harmony integration. I’ll cover that in another post because currently the remote gets confused.

# A SCRIPT FOR BUTTON 3 TO SWITCH THE TV ON and START NETFLIX.
data:
activity: Watch Netflix
entity_id: remote.harmony_hub_elite
service: remote.turn_off

Automations and Scripts to turn on / off multiple lights from one wall switch.

# THIS IS THE CODE FOR BUTTON 2 FROM AUTOMATIONS.YAML CREATED BY THE EDITOR

id: '1592540425930'
alias: living room triple 2 - ALL lights OFF
description: ''
trigger:
entity_id: switch.sonoff_1000ceace5_2
for: 00:00:01
from: 'on'
platform: state
to: 'off'
at: 00:01:30
platform: time
condition: []
action:
data: {}
service: script.1592539330000

id: '1592540523842'
alias: living room triple 2 - ALL lights ON
description: ''
trigger:
entity_id: switch.sonoff_1000ceace5_2
for: 00:00:01
from: 'off'
platform: state
to: 'on'
condition: []
action:
data: {}
service: script.1592539331111

THIS IS A SECTION FROM SCRIPTS.YAML CREATED BY THE EDITOR
'1592539330000':
alias: turn OFF living room light
sequence:
data: {}
entity_id: switch.sonoff_1000af10aa
service: switch.turn_off
data: {}
entity_id: light.table_lamp
service: light.turn_off
data: {}
entity_id: light.warm_cool_light
service: light.turn_off
data: {}
entity_id: switch.sonoff_1000ceace5_1
service: switch.turn_off

'1592539331111':
alias: turn ON living room light NOT TV
sequence:
data: {}
entity_id: switch.sonoff_1000ceace5_1
service: switch.turn_on
data: {}
entity_id: light.warm_cool_light
service: light.turn_on
data: {}
entity_id: light.table_lamp
service: light.turn_on
data: {}
entity_id: light.wall_light
service: light.turn_on

A quick word about wall light switches

Many smart wall switch reviews on Amazon have one star reviews: almost all wall switches lack a neutral wire back to the supply. The neutral wire is needed to power the smart electronics. Those reviewers have discovered that wiring some switches requires more work or a workaround. What they should be looking for is a ‘no neutral wire required’ light switch like the Sonoff T4EU1C. The switch turns on and off. It’s not a dimmer. A dimmer is no good with many modern bulbs. I’m controlling regular not-smart bulbs here and I recommend you do that too.

Leave a Reply

Your email address will not be published. Required fields are marked *