Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting anyoneSensor to false doesn't work #50

Open
lnlyssg opened this issue Jan 15, 2017 · 2 comments
Open

Setting anyoneSensor to false doesn't work #50

lnlyssg opened this issue Jan 15, 2017 · 2 comments

Comments

@lnlyssg
Copy link

lnlyssg commented Jan 15, 2017

As per subject, anyoneSensor is set to "false" but is still showing up in HomeKit:

Extract from config.json:

"platform": "People",
        "threshold" : 15,
        "anyoneSensor" : false,
        "nooneSensor" : false,
        "webhookPort": 51828,
        "cacheDirectory": "./.node-persist/storage",
        "pingInterval": 10000,
        "ignoreReEnterExitSeconds": 0, 
        "people" : [
            {
                "name" : "Jim", 
                "target" : "iPhone",
                "threshold" : 15,
                "pingInterval": 10000,
                "ignoreReEnterExitSeconds": 0 
            }
        ]
    }

And from the log:

[1/15/2017, 10:11:26 AM] Initializing People platform...
[1/15/2017, 10:11:26 AM] Initializing platform accessory 'Jim'...
[1/15/2017, 10:11:26 AM] Initializing platform accessory 'Anyone'...
[1/15/2017, 10:11:26 AM] WebHook: Started server on port '51828'.
@robintemme
Copy link

robintemme commented Jan 17, 2017

Hello, first of all thanks a lot for your great plugin @PeteLawrence ! I really appreciate your work 👍

Nonetheless, I got the same issue.

And I also found the problem regarding this in your code. When reading the config, you are double-piping a boolean to true. Double-piping in JavaScript is a logical OR, which will always result in true if one of the booleans piped is true (see this very good and detailed answer here).

To solve this, you could either || it to false, so change the default setting, so a true config setting will definitely set it to true or use this code snippet from the answer I linked above as inspiration:

function goodFunction(/* boolean */flagA) {
  flagA = typeof flagA !== "undefined" ? flagA : true;
  console.log("flagA is set to " + (flagA ? "true" : "false"));
}

@jetmcquack
Copy link

same problem here, i can't disable the anyone sensor

aydenp added a commit to aydenp/homebridge-people that referenced this issue Jan 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants