Technology Solutions for Everyday Folks
Home Assistant dashboard (dark mode) illustration for independent control of office fan and office lights, with office fan in "off" state and office lights in "on" state.

Smart Independent Control of a Ceiling Fan & Light with Shelly 1L

As I've noted before, my 1940's-era house has its own quirks with regard to smart home automation in large part due to 1940's wiring standards. Discovering the Shelly line of products (specifically the Shelly 1L relay), has afforded me a simple and cheap way to work around these quirks without pulling new wire. After all, the wiring itself is just fine and stable; things just aren't done the same way anymore.

A quick disclaimer: I am not a licensed electrician and, while I have a solid grasp of all the requisite concepts and safety requirements, this post is specific to my configuration for reference and illustration. If you are not comfortable understanding the risk of wiring changes and maintaining safe circuitry, leave something like this to a professional. Really Bad Things can happen should something go awry.

The Problem: Ceiling Fan & Light Independent Control

We have a number of ceiling fan (and light) fixtures through the house, something that was not ever really intended at its construction. The ceiling boxes are just fine regard to their ability to support fans as most are directly mounted to ceiling joists or otherwise bolstered in their support; however, none of the original wiring was pulled in a way to support "two" fixtures (fan and light) independently. Nowadays, a third wire is often pulled to a ceiling box for this reason: even if it's never used, at least it's present.

This means I can't switch the light and fan operations independently from the normal wall (single pole) switch. Independent control of the fan and light operations require use of the pull chains on the fixture.

The Normal Workaround: Just Deal With It!

...and this is what we've been doing. For the most part it's not a big deal since several locations with fan/light tend to be seasonally operated, so switching a few times a year (or maybe even once a month) to "turn off" the fan with the pull chain so it won't start when the switch is engaged has never really been a big enough pain to justify the suffering and expense of pulling new wire between switches and ceiling boxes.

My Workaround: Smart Relays "Fake" the Second Wire

After my adventure in converting the three-way switch with Shelly 1L, I decided to tackle this conversion in my office space (where the most frequent fan/light switching takes place). My theory was that by using two Shelly 1L devices (one at each end of the conversion), I could essentially "fake" the second (fan) wire without actually adding a wire.

The Conversion

I decided to go with Shelly 1L again for this project, even though in this case I have available neutrals in both the switch box and the ceiling box. According to the Internets, the Shelly purists will claim this is a "waste" because there are apparently "better" Shelly devices for this type of thing (neutral present). I didn't look in great detail, but since the 1L will work great with neutrals (and my ceiling fan/light load is still well within their max amperage specification), I had no real need to go with a different device...especially since my basic research indicated a few additional short wires would be necessary for other Shelly products...and my box real estate is already limited.

To that end, the conversion itself was pretty straightforward...

An Important Warning/Caution:

This conversion bypasses the switch completely and always provides a hot wire at the ceiling/fixture box. You should identify or label this for the sake of anyone who might work in these boxen in the future! This is a great time to remind folks to invest in a non-contact voltage detector and use it often when doing work in any location, as using such a device will provide a reminder of the hot wire where/when it may not be anticipated.

The Switch Box Side

At the switch box, I took this opportunity to change out the single pole switch to a dual pole (duplex) switch (two switches--one for fan and the other for light). This provides a physical switch to be used in the room to control the devices.

Wiring diagram for Shelly 1L device connected to a dual-pole (duplex) switch in a disconnected state to independently control a ceiling fan/light fixture.

The "major" conversion on the switch box side is essentially the "disconnect" of the switch from the circuit itself. Since the fixture box is now "hot-wired," the switch doesn't actually do anything anymore in the traditional sense. The switch outputs are connected to the Shelly 1L to signal switch state.

Shelly 1L Relay option for Button configuration with 'Detached' type selected.

The Shelly device should be configured for switch inputs as "disconnected" on both inputs. This changes the behavior of the switch positions to that of a traditional three-way switch in that "on" and "off" are not positionally-relevant. Switching to the opposite position will always provide the desired effect: if a device is on and the corresponding switch changes position, it will switch off.

The Ceiling Box Side

In my case for the light fixture component I added a pair of smart bulbs to the fixture. Since the fixture box itself is always hot, having the fan's light switch always "on" keeps power to those bulbs...which allows Home Assistant to do what it needs when a state changes (for the light).

On the fan control wire, however, we inject the second Shelly 1L. In this case no switch inputs are necessary as the relay itself will always take care of the switching via Home Assistant.

Wiring diagram of Shelly 1L at a ceiling fan fixture to control the fan operation

Having these two devices in place really does "fake" the presence of the third wire for fan control, which allows us mechanisms to automate (or connect) the two endpoints!

The Basic Automations

I don't have complicated automations set up for the fan/light: it's really just on/off automations based on the switching signals. For example, the automation for dealing with the light switch change is such:

alias: Office | Lights | Toggle
description: ""
trigger:
  - platform: state
    entity_id:
      - binary_sensor.office_fan_light_switch_channel_2_input
    from: "off"
    to: "on"
  - platform: state
    entity_id:
      - binary_sensor.office_fan_light_switch_channel_2_input
    from: "on"
    to: "off"
condition: []
action:
  - if:
      - condition: state
        entity_id: light.office_fan_lights
        state: "off"
    then:
      - service: light.turn_on
        data: {}
        target:
          entity_id: light.office_fan_lights
    else:
      - service: light.turn_off
        data: {}
        target:
          entity_id: light.office_fan_lights
mode: single

In order for this to work, though, I needed to enable the channel 1 and channel 2 binary sensors for the Shelly relay in question (they are disabled by the integration default).

Similarly, the fan switch automation:

alias: Office | Fan | Toggle
description: ""
trigger:
  - platform: state
    entity_id:
      - binary_sensor.office_fan_light_switch_channel_1_input
    from: "off"
    to: "on"
  - platform: state
    entity_id:
      - binary_sensor.office_fan_light_switch_channel_1_input
    from: "on"
    to: "off"
condition: []
action:
  - if:
      - condition: state
        entity_id: switch.office_fan
        state: "off"
    then:
      - type: turn_on
        device_id: 3ff8966db884fc5387cec299885f24fd
        entity_id: switch.office_fan
        domain: switch
    else:
      - type: turn_off
        device_id: 3ff8966db884fc5387cec299885f24fd
        entity_id: switch.office_fan
        domain: switch
mode: single

I have these controls available on my touchscreen dashboard for easy control near our front entrance:

Home Assistant dashboard (dark mode) illustration for independent control of office fan and office lights, with office fan in 'off' state and office lights in 'on' state.

Overcomplicating Things?

Well, you could certainly argue that...however, for less than $40 in parts (two Shelly 1L relays) the ability to independently control the fan/light in the office space has really been worth the effort. It also has a "neat" factor, at least to me, and was a fun thing to tinker with. Another interesting way that my home automation journey has solved a "sort of" problem of mine!