• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
MagicMirror Forum
  • Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
A New Chapter for MagicMirror: The Community Takes the Lead
Read the statement by Michael Teeuw here.

PIR sensor to turn on LED strip

Scheduled Pinned Locked Moved General Discussion
35 Posts 6 Posters 8.1k Views 6 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Away
    sdetweil @Egnos
    last edited by Sep 7, 2022, 1:11 AM

    @Egnos notifications are easy… but this module rpi-leds, only toggles the leds ON the pi board… not led strip…

    if u can find one that works the ed strip with a python command, then we can make that work

    Sam

    How to add modules

    learning how to use browser developers window for css changes

    1 Reply Last reply Reply Quote 0
    • E Offline
      Egnos
      last edited by Sep 7, 2022, 8:59 AM

      @sdetweil said in PIR sensor to turn on LED strip:

      but this module rpi-leds, only toggles the leds ON the pi board… not led strip…

      Maybe this module could fit https://github.com/jc21/MMM-PiLights, using SPI and a LPD8806 or WS2801 LED strip.

      @sdetweil said in PIR sensor to turn on LED strip:

      if u can find one that works the ed strip with a python command, then we can make that work

      It appears to respond to notifications:

      this.sendNotification('PILIGHTS_SEQUENCE', 'blue_pulse');
      

      My Mirror https://forum.magicmirror.builders/topic/17262/the-raspimirror-was-born/7

      S 2 Replies Last reply Sep 7, 2022, 12:11 PM Reply Quote 0
      • S Away
        sdetweil @Egnos
        last edited by Sep 7, 2022, 12:11 PM

        @Egnos it has a way for all off. but not all on.

        Sam

        How to add modules

        learning how to use browser developers window for css changes

        1 Reply Last reply Reply Quote 0
        • S Away
          sdetweil @Egnos
          last edited by sdetweil Sep 7, 2022, 7:06 PM Sep 7, 2022, 3:39 PM

          @Egnos 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 notification

          Sam

          How to add modules

          learning how to use browser developers window for css changes

          E 1 Reply Last reply Sep 8, 2022, 8:33 AM Reply Quote 0
          • W Offline
            wishmaster270 Module Developer
            last edited by Sep 7, 2022, 6:59 PM

            Hi,

            I would suggest the solution of @sdetweil as well.

            An other, but much more complicate version would be to use my PythonLedControl and control it with the MMM-MQTTbridge module.

            1 Reply Last reply Reply Quote 0
            • E Offline
              Egnos @sdetweil
              last edited by Sep 8, 2022, 8:33 AM

              @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 notification

              Thanks @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!

              My Mirror https://forum.magicmirror.builders/topic/17262/the-raspimirror-was-born/7

              M S 3 Replies Last reply Sep 8, 2022, 9:32 AM Reply Quote 0
              • M Offline
                MMRIZE @Egnos
                last edited by Sep 8, 2022, 9:32 AM

                @Egnos
                ' USER_PRESENCE' !== 'USER_PRESENCE'

                S 1 Reply Last reply Sep 8, 2022, 11:52 AM Reply Quote 1
                • S Away
                  sdetweil @Egnos
                  last edited by Sep 8, 2022, 11:52 AM

                  @Egnos fixed the typo, git pull for the update

                  Sam

                  How to add modules

                  learning how to use browser developers window for css changes

                  1 Reply Last reply Reply Quote 0
                  • S Away
                    sdetweil @MMRIZE
                    last edited by Sep 8, 2022, 11:52 AM

                    @MMRIZE good catch

                    Sam

                    How to add modules

                    learning how to use browser developers window for css changes

                    1 Reply Last reply Reply Quote 0
                    • S Away
                      sdetweil @Egnos
                      last edited by sdetweil Sep 8, 2022, 1:10 PM Sep 8, 2022, 1:06 PM

                      @Egnos u don’t need the GPIO_Notifications module. as the PIR modules send the USER_PRESENCE notification

                      Sam

                      How to add modules

                      learning how to use browser developers window for css changes

                      E 1 Reply Last reply Sep 9, 2022, 8:59 AM Reply Quote 0
                      • 1
                      • 2
                      • 3
                      • 4
                      • 2 / 4
                      2 / 4
                      • First post
                        15/35
                        Last post
                      Enjoying MagicMirror? Please consider a donation!
                      MagicMirror created by Michael Teeuw.
                      Forum managed by Sam, technical setup by Karsten.
                      This forum is using NodeBB as its core | Contributors
                      Contact | Privacy Policy