Shelly 1 & ESPHome - Bathroom Fan Control

Hi All,

I’ve hooked up a Shelly 1 to my bathroom extractor fan - previously it ran whenever the bathroom lights were on, which seemed unnecessary, so now I have a humidity sensor in there and use HA to turn it on when needed.
I had hoped to make use of the switched live signal that came from the light switch (previously going to the fan to turn it on with the lights) as a signal to the Shelly, so that I could also identify if the bathroom lights were on or off - this part however does not seem to be functioning… and I can’t work out why!

The circuit in use:

I should note the ‘3 pole switch’ before the fan/shelly is just an isolator switch - so assume that isn’t even there for this purpose :slight_smile:

I was hoping that the SW port of the Shelly could be used to detect 240v live when the light gets turned on, but this doesn’t appear to be the case - I get no output at all from the Shelly when the light it toggled. (Manual relay control of the fan works fine though)

My code (simplified to just toggle the fan on/off with the light switch signal):

# Device Specific Config
switch:
  - platform: gpio
    pin: GPIO4
    name: "Ensuite Extractor Fan"
    restore_mode: ALWAYS_OFF
    id: shelly_relay
    
binary_sensor:
  - platform: gpio
    internal: true
    pin:
      number: GPIO5
    # small delay to prevent debouncing
    filters:
      - delayed_on_off: 50ms
    # config for state change of input button
    on_state:
        then:
          - switch.toggle: shelly_relay
    id: button

Can anyone see any reason why this setup wouldn’t work ?

Thinking of doing something similar - did you find out why this didn’t work?

Hey, unfortunately not - I ended up disconnecting the SW wire since I noticed that the lights gave a dim glow even when the switch was off at the wall… so clearly something wasn’t right and I didn’t want to burn the place down :stuck_out_tongue:

1 Like

I am also planning something like this…

I think you have to use a shelly 2.5 or two Shelly 1’s. You need two separate toggled outputs. Because the Shelly has to be installed after the switch. It seems that you put the shelly in between the light and the fan in your wiring.

Sorry for digging up an old thread, but I was trying to do the exact same thing today and had the exact same problem. Dim glow on the bathroom LED lights and the input always registered as “on”.

The problem is that when the switched live is off the SW input of the Shelly is connected to neutral through the lights. The Shelly seems to output a small voltage on SW which sinks through the lights to neutral (hence the glow) and causes it to register it as being in an on state.

Wondering what your solution was to this, if any? I see one option is to use two Shellys, one for the fan and one for the lights. I’d rather avoid that if possible, I’m thinking of using a double-pole lightswitch, with one side connected to the lights and one side to the Shelly.