Read the statement by Michael Teeuw here.
PIR sensor to turn on LED strip
-
@sdetweil said in PIR sensor to turn on LED strip:
use my updated fork…
https://github.com/sdetweil/MMM-PiLights
it responds to the PIR modules USER_PRESENCE notification (true = turn on, false = turn off)
if lights are off and on is sent, it will restore the previous sequence set with the normal
SEQUENCE notificationThanks @sdetweil
Let’s see if I understand:
- By default the LEDs will be off, until the “MMM-GPIO-Notifications” module detects something.
- If the PIR detects the movement the “MMM-GPIO-Notifications” module will send the notification USER_PRESENCE = true and the LEDs will turn on
- After some time without movement the “MMM-GPIO-Notifications” module will send the notification USER_PRESENCE = false and the LEDs will turn off
Correct?
I’m not a developer, but I’m still trying to understand your change in the code:
else if (notification === ' USER_PRESENCE'){ if(payload == false){ this.leds.allOFF(); } else { // user present, restore the last active sequence Promise.resolve(this.runSequence(this.lastSequence.sequence, thi,lastSequence.iterations,this.lastSequence.delay) .catch((err) => { this.log('user present Sequence error: ' + err.message); }));
why can’t I see this notification in the code?
(notification === ' USER_PRESENCE'){ if(payload == true){ this.leds.allON(); }
Thanks again!
-
@Egnos
' USER_PRESENCE'
!=='USER_PRESENCE'
-
@Egnos fixed the typo, git pull for the update
-
@MMRIZE good catch
-
@Egnos u don’t need the GPIO_Notifications module. as the PIR modules send the USER_PRESENCE notification
-
@sdetweil said in PIR sensor to turn on LED strip:
u don’t need the GPIO_Notifications module. as the PIR modules send the USER_PRESENCE notification:
The module I use for sending notifications when the PIR detects motion is MMM-GPIO-Notifications
I believe he is sending the “USER_PRESENCE” notification:notifications: [ { notification: 'USER_PRESENCE', payload: true },
Thanks for your patience @sdetweil ! ;-)
-
@Egnos ok got it.
what I was saying is that the
MMM-PIR-???
modules, if you use them, THEY send the USER_PRESENCE notification
the GPIO_Notifcations module is more generic and can send notifications for ANY gpio device
-
@sdetweil said in PIR sensor to turn on LED strip:
@Egnos ok got it.
what I was saying is that the
MMM-PIR-???
modules, if you use them, THEY send the USER_PRESENCE notification
the GPIO_Notifcations module is more generic and can send notifications for ANY gpio deviceOk ok, I just wanted to be sure that, in my case, the MMM-GPIO-Notifications module sends the “USER_PRESENCE” notification.
I knew that the module I am using is a collector of GPIO devices…Thanks @sdetweil
-
@Egnos Just in case…
Im using ioBroker @home (thats a free Smart Home Software). WIth that i also have installed MQTT. Any other Smart Home software like Home Assist can do the same.
I also installed Hyperion on the same Raspyberry i have installed MagicMirror. Inside ioBroker iam using the Hyperion adapter.
So with any “user_presence” i get the MQTT informartion… and that triggers a scipt inside ioBroker to activate Hyperion.If your using any smart home software as well… this should be an easy thing. Feel free to ask…
-
@OberfragGER thanks for the valuable advice and for your availability, now I’ll read something.
In the meantime, can you tell me an LED strip (not necessarily RGB …) that is compatible with this project?
Thank you all.