Shelly Blu Motion + Shelly Plus 1 script help - ignore motion when switch is already on

VPN/Proxy erkannt

Es scheint, dass Sie einen VPN- oder Proxy-Dienst verwenden. Bitte beachten Sie, dass die Nutzung eines solchen Dienstes die Funktionalität dieser Webseite einschränken kann.

  • Hi there,

    I have a Shelly Blu Motion that connects directly via bluetooth to a Shelly Plus 1.

    Whenever you walk into the room and the blu motion sees you, it triggers the Plus1 to turn on the light. Then it automatically turns off again after 90secs.

    However, if you manually switch the light on using the wall switch, THEN the sensor sees you, it will also turn the light off after 90 secs. I don't want it to do that.

    What I want is, if you use the physical light switch, i want the Plus1 to ignore the motion detector input, until it is turned off again (by physical switch or any programmatic method).

    This is all done via the Shelly Plus1 onboard script. I got the script from the Shelly examples github https://github.com/ALLTERCO/shell…helly-motion.js and modified it minimally to allow my blu motions mac address. My version is below.

    However my understanding of code is minimal, I can sort of work out what things are for, but I don't really know how to modify the code. I think some sort of if/else around the motionHandler would maybe work?

    - If: the switch status is on, ignore any motion sensor inputs/functions

    - Else: Run the motion sensor function

    Could anyone help me with modifying the code for this? Many thanks in advance.

    Steven

  • sunkentreasure 6. Januar 2024 um 20:53

    Hat den Titel des Themas von „Shelly Blu Motion + Shelly Plus 1 script help“ zu „Shelly Blu Motion + Shelly Plus 1 script help - ignore motion when switch is already on“ geändert.
  • Hi,

    Assuming you have the wall switch connected to the SW input of the Plus 1, you can get its state in your script with

    Code
    Shelly.getComponentStatus('input:0').state

    You could use this to prevent the motion handler being called when the input is on by changing the if statement at line 188 to

    Code
    if (
      typeof CONFIG.motionHandler === "function" &&
      typeof data.motion !== "undefined"
      && !Shelly.getComponentStatus('input:0').state
    ) {

    HTH,

    Hans.

  • From my experience, when the script triggers the light due to motion, the timer is set based on the blu motion blind time, so to change it, you need to change it on the blu motion itself. I don't use the app, so not familiar with how it works, sorry. But I'd guess that the script is controlling everything in this case.

  • Dieses Thema enthält einen weiteren Beitrag, der nur für registrierte Benutzer sichtbar ist.