bugsounet / MMM-Pir

Manage your screen with a pir sensor
MIT License
35 stars 10 forks source link

Mode 6 and 7 Bug #53

Closed creatvty closed 7 months ago

creatvty commented 7 months ago

Hey, so I wanted to make mode 6 and 7 work but I had issues to get it working. If I'm not wrong there is a Bug in the code here:

https://github.com/bugsounet/MMM-Pir/blob/94a72d87c9a0c70750ef7db316c3ca34962b96ee/components/screenLib.js#L307

The if check does a strict comparison with 1 but the type is actually a string. So the fix would be this:

if (responsePy === "1") actual = true

The same has to be done with mode 7

if (responsePy === "0") actual = true;

I tried it locally and it seems to do the trick. Hope it helps

bugsounet commented 7 months ago

Hi,

Ah yes, you have right ;) It's again the result of eslint rules ... --> can't use ==, Happy use of ===

I correct it or you make a PR ?

creatvty commented 7 months ago

Haha oh eslint... I'd suggest using strict string comparison like I wrote above. Seems the more correct way to me

creatvty commented 7 months ago

Closing as completed, thanks