• 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.

Hi, there is a new Alexa Module

Scheduled Pinned Locked Moved General Discussion
98 Posts 13 Posters 55.8k Views 15 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.
  • J Offline
    JoChef2 Module Developer @rubenix
    last edited by Apr 10, 2020, 1:03 PM

    @rubenix Hi, I don’t really know why it doesn’t work. The syntax seems to be right. That’s the hole edit part around line 199. Maybe it helps. I tested this and it works great.

     device.handler = function(action) {     
        if(action === 1){
            exec("vcgencmd display_power 1 && echo '1-1' |sudo tee /sys/bus/usb/drivers/usb/bind", opts, (error, stdout, stderr) => {
                _this.checkForExecError(error, stdout, stderr); 
            });
        }if(action === 0){
            exec("vcgencmd display_power 0 && echo '1-1' |sudo tee /sys/bus/usb/drivers/usb/unbind", opts, (error, stdout, stderr) => {
                _this.checkForExecError(error, stdout, stderr); 
            });
        }
    }
    
    S 1 Reply Last reply Apr 10, 2020, 1:11 PM Reply Quote 0
    • S Offline
      sdetweil @JoChef2
      last edited by Apr 10, 2020, 1:11 PM

      @JoChef2 its because the exec() is launching A program… but the program is NOT a shell (sh., bash etc), and only THEY understand the | and && syntax… vcgencmd does not… it executes what it knows ‘display_power 1’ ,and ignores the rest

      now, you CAN execute a script directly as long as it contains the processor name at the front
      #!/bin/sh or #!/bin/bash

      exec(“/home/pi/MagicMirror/modules/MMM-AlexaControl/scriptname”)

      or the script has to be in the path environment varible.
      (unlike windows, the ‘current directory’ is NOT included in the path (for security reasons))

      if the script does NOT contain the processor path&name
      then you have to launch the shell

      exec(“/bin/bash -c "command string with pipe and logic chars"”)

      Sam

      How to add modules

      learning how to use browser developers window for css changes

      1 Reply Last reply Reply Quote 0
      • R Offline
        rubenix
        last edited by Apr 10, 2020, 1:53 PM

        got it working thanks!

        if(action === 1){
                    exec('/home/pi/monitor_on.sh');
                    }if(action === 0){
                    exec('/home/pi/monitor_off.sh');                         
        

        forgot to put the path :confounded_face:

        Thanks buds!

        1 Reply Last reply Reply Quote 0
        • M Offline
          minomit
          last edited by Apr 13, 2020, 11:27 AM

          Hi, mmm-alexacontrol is ok, i’m change pages,etc.
          Can I ask alexa for something and alexa replies in the compliments module?
          thanks

          J 1 Reply Last reply Apr 14, 2020, 10:36 AM Reply Quote 0
          • J Offline
            JoChef2 Module Developer @minomit
            last edited by Apr 14, 2020, 10:36 AM

            @minomit Hi, no that’s not directly possible with my module because it emulates only smart home devices and haven’t anything to do with the speech of Alexa. It’s possible that you add to the compliments module notification support and then you can create devices with my module that sends notifications to the compliments module. You can complete this with routines in the Alexa app. So then you have a few sentences. But I think that’s not the thing you asked for. If you want to see all the answers of Alexa you should use MMM-awesome-alexa. I’m not sure if my module works with it but that’s the only way I see to realize that. Maybe someone else have a better idea.

            S 1 Reply Last reply Apr 21, 2020, 10:49 PM Reply Quote 0
            • S Offline
              sgarg15 @JoChef2
              last edited by Apr 21, 2020, 10:49 PM

              @JoChef2 Will this module work with a google home mini?

              J 1 Reply Last reply Apr 22, 2020, 7:46 AM Reply Quote 0
              • J Offline
                JoChef2 Module Developer @sgarg15
                last edited by Apr 22, 2020, 7:46 AM

                @sgarg15 Hi, I don’t know if it works with a google home mini because I don’t have one. But I think the wemos devices I emulate should work with a google home. So test it. You could use the default config and test the preconfigured devices. Let me know if it works.

                S 1 Reply Last reply Apr 22, 2020, 7:32 PM Reply Quote 0
                • S Offline
                  sgarg15 @JoChef2
                  last edited by Apr 22, 2020, 7:32 PM

                  @JoChef2 I dont think it works, i downloaded it and did npm install, and my config is like this

                      {
                        module: 'MMM-AlexaControl',
                        position: 'middle_center',
                        config:{
                          image: false,
                          pm2ProcessName: "MagicMirror",
                          vcgencmd: "vcgencmd",
                        }
                      },
                  

                  and my google home mini is unable to detect the magic mirror

                  S 1 Reply Last reply Apr 22, 2020, 9:27 PM Reply Quote 0
                  • S Offline
                    sdetweil @sgarg15
                    last edited by Apr 22, 2020, 9:27 PM

                    @sgarg15 how do u discover devices w a mini?

                    Sam

                    How to add modules

                    learning how to use browser developers window for css changes

                    1 Reply Last reply Reply Quote 0
                    • S Offline
                      sgarg15
                      last edited by Apr 22, 2020, 9:28 PM

                      @sdetweil you usually go into the app and then click set up new device and it searches for a device and for me when it searches it cant find any device

                      S 1 Reply Last reply Apr 22, 2020, 9:47 PM Reply Quote 0
                      • 1
                      • 2
                      • 6
                      • 7
                      • 8
                      • 9
                      • 10
                      • 9 / 10
                      • 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