Turn on lights based on Lux sensor Shelly DW2

  • Hi,

    I'm a happy user of the Shelly products, which I mainly use to control the lights in my house.

    I've set time schedules in the relays to turn on the lights based on sunset times.

    But there are days that I would like to turn on the lights earlier because it is darker due to cloudy weather conditions.

    So, I bought the Shelly door window sensor v2, since it has a lux sensor. I noticed that the DW2 goes into deep sleep after a while. Will the sensor still measure the lux values? And will it be able to trigger a scene based on the lux values?

    Thanks for your help!

  • Welcome to the forum. ?


    Yes you can define values under Sensor Settings-> Illumination Definition. The best way to set it is via WebUi.


    Screenshot_20200902-134207_Shelly_autoscaled.jpg


    There you can set the brightness from which it is dusk or dark.


    With these values you can either use scenes in the app, or directly via actions to give commands for your light control.

    LG Michael


    Einsteigertipps / Tips for beginners

    Meine Shellys:

    In Betrieb: 3x Shelly Dimmer, 3x Shelly 1, 2x Shelly 1PM, 2x Shelly 2.5, 1x Shelly RGBW2, 1x Shelly 4Pro, 4x Shelly H&T, 1x Shelly Sense, 10x Shelly Plug S, 2x Shelly Plug, 3x Shelly Smoke V1, 1x Shelly EM, 1x Shelly Flood, 3x Shelly Duo GU10, 2x Shelly Vintage, Shelly Duo, 1x Shelly Eye, 3x Shelly Door/Window, Shelly Button, Shelly Button 1, Shelly 3EM, Shelly Gas

    Testboard mit Shelly Dimmer, Shelly Dimmer 2, Shelly 2.5, Shelly RGBW2, Shelly 1, Shelly 1Pm, Shelly i3, Shelly 2x Temp Add-On mit DHT22 und DS18B20, Shelly H&T, Shelly Door/Window 2


    Kein übergeordnete System. Nur App und WebUI mit Cloudverbindung.:)

  • Thank you for your warm welcome and reply to my question.


    I found the settings for Illumination Definition. And also managed to setup a scene. I did it through the app since the webui seems unreachable when the DW2 is in deepsleep modus.

    I will experiment with the illumination levels to get it the way I would like to.


    Can you tell me how often the DW2 is measuring the illumination levels? In the log I see hourly levels. Does this also mean it measures every hour? Or more frequently?

  • To make the settings via the webUi, wake up the DW2 via the button It is located in the small hole on the front of the housing.


    The DW2 wakes up automatically:


    • Changes Reed contact, open and closed
    • For temperature changes as set in Thresshold.
    • If the light values exceed or fall below the set light values in Illumination Definition. (But here you have to test what is best for you)
    • Vibrationen detection


    If nothing changes at these values, the Shelly remains in deep sleep to save battery power.


    Translated with http://www.DeepL.com/Translator (free version)

    LG Michael


    Einsteigertipps / Tips for beginners

    Meine Shellys:

    In Betrieb: 3x Shelly Dimmer, 3x Shelly 1, 2x Shelly 1PM, 2x Shelly 2.5, 1x Shelly RGBW2, 1x Shelly 4Pro, 4x Shelly H&T, 1x Shelly Sense, 10x Shelly Plug S, 2x Shelly Plug, 3x Shelly Smoke V1, 1x Shelly EM, 1x Shelly Flood, 3x Shelly Duo GU10, 2x Shelly Vintage, Shelly Duo, 1x Shelly Eye, 3x Shelly Door/Window, Shelly Button, Shelly Button 1, Shelly 3EM, Shelly Gas

    Testboard mit Shelly Dimmer, Shelly Dimmer 2, Shelly 2.5, Shelly RGBW2, Shelly 1, Shelly 1Pm, Shelly i3, Shelly 2x Temp Add-On mit DHT22 und DS18B20, Shelly H&T, Shelly Door/Window 2


    Kein übergeordnete System. Nur App und WebUI mit Cloudverbindung.:)

  • A follow up on this topic. I have managed to set the illumination levels for dusk and dark.

    I also set up a scene that should trigger a Shelly 1PM. But it doesn't. When I trigger the scene manually it works like expected. But not when the DW2 is in deep sleep and is supposed to trigger the scene automatically. Any other advice?

  • Have you tried with actions directly?

  • Peekie There is something like URL Actiont on senson. You can set it to open some URL when condition is meet (for this case you can open url thats open your light switch url and set it to "on").


    66er The problem is that on DW2 you can open url when:

    - temp is over/under some value

    - it is dark/twilight/daylight and doors has opened

    - doors has closed

    - vibration detected


    so still it not solve problem with scene not triggered when dw2 detected light change. Just spent 2 hours trying to make it work, and i have no more ideas it just dont wanna work as it should (or i'm missing something obvious)

  • Please open a ticket to Allterco,

  • I tried the actions, but didn't succeed in to get it to work reliably. I have also tried several options, but in the end had lights being turned on at inconvenient times (like in the middle of the night).

    I returned the DW2 sensor to the reseller and changed all the Shelly equipment to MQTT. And installed a Raspberry Pi with MQTT broker and Node-Red. Finally I have added a light sensor to the Pi, which provides light levels all the time. Now I am able to let the lights be controlled with a time schedule or by the light levels.

  • I ended up buying a Raspberry Pi Zero W and added Grove Base Hat and Grove - Light Sensor v1.2.

    The documentation of the light sensor provides a python script that you can run from the RPi Zero. I adjusted the code so that the light value is published to the MQTT broker (other RPi, or one at internet). Node red uses this light value to switch the lights based upon the light value.

    When this all worked, I made the python script run as a service at the RPi zero, so that it keeps running and also starts again after a reboot of the RPi.