Turning dumb skylights smart (with Zigbee)

Hi all,

I thought I would share this in case of any help to anyone else (I couldn’t find many/any examples when I was looking).

Please note, for the UK, this example involves wiring into 240V mains so please make sure you have turned the power off and know what you’re doing. I’m accepting no liability as your setup may vary!

We have electric/motorised opening skylights in our kitchen which are triggered by a little RF fob remote (like this)

image

But I wanted to be able to integrate the skylights with HA so they could open automatically when the kitchen gets warm, and to be able to open/close them via a Google Home voice commands etc.

In addition to the remote fobs the skylight motor control unit has wiring options for a wall mounted switch/control which we didn’t bother putting in when we installed the windows. This does however mean that it already has the necessary terminals and controls to add a zigbee relay control instead of a manual switch. There is no feedback on the open/closed state from the skylight control itself, so I’ve added zigbee window sensors to at least let me know if they are open/closed. As the skylights are next to each other I wired both to work simultaneously from one relay, which means they can’t be controlled independently from each other in HA (I could have done that with two separate relays if wanted though).

Below is a guide to how I wired this up and how I’ve configured HA and Google.

Parts Required

In addition to the existing skylight install I only needed to purchase:

  • 1x Aqara Dual Relay Module T2

  • 1x Aqara Door and Window Sensor T1 per window (2x in my case)

The Aqara Dual Relay seems to be the best option for my needs as it:

  • Is Zigbee connected
  • Powered by 240V (12V would have also been suitable as there is 12V available on the motor control unit)
  • Offers 2 independent switches/relays on a single unit
  • Supports dry contact/potential free switching, which was key for my skylight control

Installation

The manufacturer supplied wiring diagram below shows how dry contact switching is connected using a wall switch setup.

I simply emulated this using the two relays from the Aqara. One activates the “open” channel on the control unit, the other the “close” channel. The skylight control units are powered from a plug socket installed on a back-box with 240V mains supply. Power for the Aqara was simply taken by spurring directly into the plug socket terminals. (The whole power is on a fused/switched spur, so can be isolated at any time easily).

HA Setup

Once installed and power turned back on the relay is discoverable in HA (I’m using the Skyconnect Zigbee stick and have various zigbee repeaters on the house [the new IKEA TREKAKT plugs]) and was paired in the usual way.

This exposed, amongst other entities, two switches. I renamed these “open” and “close” corresponding to the skylight control channel they were connected to.

image

Switching “Open” to “on” causes the skylights to open until switched off, and the “Close” provides the reverse. One limitation of this is that the switches themselves don’t know when the skylight is fully open or fully closed and so doesn’t switch to “off” at full open/close and has to be manually switched off. Separately an Aqara Door/Window sensor is fixed to each of the windows and reports the open/close state of the skylights. This is helpful in some of the automations below and at least can be used to turn off the “Close” switch once the window has closed.

I (believe I) have activated interlock mode on the Aqara to prevent both switches being on at the same time, and therefore trying to open and close the window at the same time. (I haven’t tested interlock is working though as I’m too scared of breaking the window motors!)

HA Scripts

I’ve set up some basic scripts to enable control:

  1. Open the window a small amount

This checks the window isn’t already open (from the window sensor), switches “Open” on for 8 seconds then switches “Open” to off.

  1. Open the window a large amount

This checks the window isn’t already open (from the window sensor), switches “Open” on for 12 seconds then switches “Open” to off.

  1. Close the window

This checks that the window is open (from the window sensor), switches “Close” on, waits until the window sensor reports “closed” and then switches “Close” to off (to stop the call to the motor to shut the window).

These scripts are exposed through the Google Assistant integration. I have automations set up in Google Home which means I can say “Hey Google, open the skylights” to trigger the corresponding scripts (as a scene).

alias: Kitchen Skylights Open Little
sequence:
  - if:
      - condition: state
        entity_id: binary_sensor.skylights_sensor
        state: "off"
    then:
      - service: switch.turn_on
        metadata: {}
        data: {}
        target:
          entity_id: switch.skylight_opener_open
      - delay:
          hours: 0
          minutes: 0
          seconds: 8
          milliseconds: 0
      - service: switch.turn_off
        metadata: {}
        data: {}
        target:
          entity_id: switch.skylight_opener_open
mode: single
alias: Kitchen Skylights Close
sequence:
  - if:
      - condition: state
        entity_id: binary_sensor.skylights_sensor
        state: "on"
    then:
      - service: switch.turn_on
        metadata: {}
        data: {}
        target:
          entity_id: switch.skylight_opener_close
      - wait_for_trigger:
          - platform: state
            entity_id:
              - binary_sensor.skylights_sensor
            to: "off"
      - delay:
          hours: 0
          minutes: 0
          seconds: 2
          milliseconds: 0
      - service: switch.turn_off
        metadata: {}
        data: {}
        target:
          entity_id: switch.skylight_opener_close
mode: single

I also have automations set up that monitor the room temperature (from the heating thermostat) and if above 22°C opens the skylights a little (if we’re also home). Once the temperature goes below 19°C they close (if open). These might need some tweaking to get the temperatures and behaviours right as summer approaches.

These skylights also came with a rain sensor attached to enable them to close when it starts raining. Part 2 of this setup is to connect into the rain sensor and report back to HA when they detect rain so I can use it for other alerting etc. I’ll update on how successful that is when it’s done…

1 Like