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.

    MMM-GoogleAssistant and LED Lights

    Scheduled Pinned Locked Moved Troubleshooting
    14 Posts 6 Posters 2.4k 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.
    • P Offline
      Pyroson
      last edited by Pyroson

      I am using the module made by bugsounet, the MMM-GoogleAssistant and the MMM-Assistant2Display. I am trying to setup some LED lights behind the mirror’s frame to come on when the hotword is spoken/when the assistant is talking. Much like how the Amazon Echo does. I have the LED lights installed connected to a N-Channel MOSFET. My trouble is trying to figure out how to activate a GPIO pin at the time when the hotword is spoken and when the assistant is talking. I only have a PIR sensor plugged in on GPIO14 or pin 8 so almost all pins are available. I have been trying to run searches for help on this but I have been unsuccessful (probably using the wrong keywords :face_with_tears_of_joy: :face_with_tears_of_joy: ). Any help would be greatly appreciated. Thanks!

      S 1 Reply Last reply Reply Quote 0
      • S Offline
        sdetweil @Pyroson
        last edited by

        @Pyroson u will need a module, with a node_helper to talk to the gpio pins, as u can’t do that from the modulename.js as it runs in the browser.

        there might be a generic module to twiddle the LEDs.

        Sam

        How to add modules

        learning how to use browser developers window for css changes

        S 1 Reply Last reply Reply Quote 0
        • S Offline
          sdetweil @sdetweil
          last edited by

          @Pyroson here is a module that turns off/on LEDs on gpio

          https://github.com/idoodler/MMM-RPI-LED

          you could extend that to twiddle the lights like u need

          Sam

          How to add modules

          learning how to use browser developers window for css changes

          1 Reply Last reply Reply Quote 0
          • B Offline
            banbutcher
            last edited by banbutcher

            curious to this aswell as i have the ReSpeaker 4 mic array with 12 leds and i was trying to do the same… as far as i know theres 4 stage: wake up, listen, think and speak. i have sample python scripts for each stage with a corresponding light patternand im still looking to see if i can figure it out where to call them from but no joy yet! :/

            for me when looking through @Bugsounet code, it all appears on one line (no line breaks) and is pretty hard to try and read… is this on purpose and the same for all?

            thanks

            S 1 Reply Last reply Reply Quote 0
            • S Offline
              sdetweil @banbutcher
              last edited by

              @banbutcher python will have to be called from a node_helper as well, as u can’t exec code from a browser.

              there are all kinds of examples of this.

              his code is minified, makes it faster to execute, and harder to take.

              Sam

              How to add modules

              learning how to use browser developers window for css changes

              1 Reply Last reply Reply Quote 0
              • ? Offline
                A Former User
                last edited by

                my code is protected, you can’t modify it.
                If you modify it, MM will close (self protected of GA/A2D)

                I will explain to you tomorrow how you can do
                If you have some python code, you can do it with GA (GA have some trigger on every events and you can use it)

                1 Reply Last reply Reply Quote 0
                • B Offline
                  banbutcher
                  last edited by

                  @Bugsounet @sdetweil

                  Thanks guys

                  1 Reply Last reply Reply Quote 0
                  • ? Offline
                    A Former User
                    last edited by A Former User

                    @banbutcher @Pyroson

                    I have write a special recipe for you, with the latested version of MMM-GoogleAssistant :)

                    the recipe name is with-status.js (locating: with the latest version of GA in recipes directory)

                    • How it’s works ?
                      GA will send the status (stand-by, listen, …) to your wanted file
                    
                    /**  with-status.js **/
                    /**  send the status of assistant to a python script **/
                    /** For LED Strip for example **/
                    /**     @bugsounet       **/
                    
                    var recipe = {
                      commands: {
                        "Status": {
                          shellExec: {
                            exec: (param) => {
                                return "python /home/pi/myscript.py " + param.status.actual
                            }
                          }
                        }
                      },
                      plugins: {
                        onStatus: "Status"
                      },
                    }
                    
                    exports.recipe = recipe
                    

                    I have defined in the with-status.js sample
                    to run this command : python /home/pi/myscript.py Status_of_GA

                    • Status_of_GA can be :
                      • listen
                      • standby
                      • confirmation
                      • reply
                      • error
                      • hook
                    • You can change the name and the path of the script (I don’t force it) and can be and bash script or other
                    • How load this recipe ?

                    in GA configuration, you have an recipe field

                    just add it :)

                    samples :

                    • recipes: [ "with-status.js" ],

                    • recipes: [ "with-status.js", "with-MMM-TelegramBot.js" ], for some other recipe needed

                    @bugsounet

                    C 1 Reply Last reply Reply Quote 0
                    • B Offline
                      banbutcher
                      last edited by

                      cool, thanks a lot for this, im looking forward to trying some stuff out! :)

                      1 Reply Last reply Reply Quote 0
                      • C Offline
                        CallanPiper @Guest
                        last edited by

                        @Bugsounet
                        Hi guys, i’m new to python and i’m not sure how I would create a script that would turn on different GPIO pins depending on the GA staus. If someone could point me in the right direction that would be awesome!

                        S 1 Reply Last reply Reply Quote 0
                        • 1
                        • 2
                        • 1 / 2
                        • First post
                          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