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-AlexaOnOff] Simple Mirror Control from External Home Assistant (Alexa/Google Home/HASS.io)

    Scheduled Pinned Locked Moved System
    81 Posts 13 Posters 69.3k Views 16 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.
    • C Offline
      chassain 0
      last edited by

      Hello,

      I thinh it s necessary to have V2.5 magic mirror because echo don t recognize magic ?
      nice module. good job

      1 Reply Last reply Reply Quote 0
      • S Offline
        shbatm Module Developer @richland007
        last edited by

        @richland007 Yes, that’s correct about all the modules showing up as switches. I haven’t tested a maximum number of modules yet, so if you hit a limit let me know. You may have to re-run Discover a couple times if it takes longer than 20s to find all of your devices.

        I feel your pain about MirrorMirrorOnTheWall, that’s why I made this one for myself.

        @MoreLinux Glad you got it working!

        @chassain-0 I’ll update the minimum version. I run V2.6-dev with no issues and didn’t test lower versions.

        1 Reply Last reply Reply Quote 0
        • R Offline
          ReRoPa1904
          last edited by

          Is there any way to execute two commands?
          Example:
          “Alexa, turn calendar on”

          • “SHOW calendar & HIDE clock” in the same step OR “HIDE all & show calendar”

          Tried to figure that out but didn’t find a solution yet. Since there is “HIDE ALL” button on the webcontrol I thought that at least the second option should be possible. Or am I wrong?

          Thanks in advance :-)
          Robert

          S 1 Reply Last reply Reply Quote 0
          • S Offline
            shbatm Module Developer @ReRoPa1904
            last edited by shbatm

            @reropa1904 said in [MMM-AlexaOnOff] Simple Mirror Control from External Home Assistant (Alexa/Google Home/HASS.io):

            Is there any way to execute two commands?

            Out of curiosity, which module are you using for the show/hide?

            I should be able to add the ability to send multiple notifications pretty easily when I get a chance.

            EDIT: Done, you can now have multiple notifications fire when a “device” is turned on or off (Note: I was not able to fully test on the Mirror but it works in the browser, let me know if you have issues).

            Update your version and see the last example at the bottom of the updated README

            To update:

            cd ~/MagicMirror/modules/MMM-AlexaOnOff/
            git fetch && git pull
            
            R 1 Reply Last reply Reply Quote 0
            • R Offline
              ReRoPa1904 @shbatm
              last edited by

              @shbatm That’s great. Thanks for your reaction on this. Will test tomorrow and let you know.

              1 Reply Last reply Reply Quote 0
              • R Offline
                ReRoPa1904
                last edited by

                Can confirm that it works. Great Job. Thanks so much!!!

                1 Reply Last reply Reply Quote 0
                • richland007R Offline
                  richland007
                  last edited by

                  @shbatm Hey there thank you again for this module … i opened this thread here
                  https://forum.magicmirror.builders/topic/9326/an-additional-config-js-per-say
                  I am trying to install MMM-AlexaOnOff but i have a lot of modules that i will have to write lines about on and off and than some combination on and offs (that will turn the modules for my wife on and hide mine and vice versa) so one could imagine how long that module config in config.js is going to get.

                  @bhepler had some ideas on the last post of that thread similar to the default “compliments” module that may be implemented to reference the MMM-AlexaOnOff config.js entry as a separate file for some of us with lots of modules.

                  Can you help me please on how i can modify my settings so i can achieve this.
                  in the mean time i am about done referencing all my modules on the regular way of adding this to config.js and will give that long file a try where MMM-AlexaOnOff confi part alone is some 400 lines in my case LOL :)

                  Thank you and happy new year’s
                  Denis

                  1 Reply Last reply Reply Quote 0
                  • richland007R Offline
                    richland007
                    last edited by

                    @shbatm Hey there happy weekend :)
                    I installed the module and updated the config.js file but Alexa is unable to find any new devices in my case.
                    What am i doing wrong ??
                    I did git clone to my modules folder (as i have done with all other modules) than cd to MMM-AlexaOnOff than npm install after install i added the module into the config .js but when i ask Alexa form my Echo dot to discover new devices it says no new devices were found??
                    My Rpi is connected via wifi to my network.

                    As i have said before i do have a large number of modules but i will try it with just only one as well and see whats up.

                    Please let me know what my next step should be
                    any help is greatly appreciated
                    thank you again
                    D

                    MoreLinuxM 1 Reply Last reply Reply Quote 0
                    • MoreLinuxM Offline
                      MoreLinux @richland007
                      last edited by MoreLinux

                      @richland007 I had the same, but after deleting all the devices in the Alexa app, all my devices were found again.

                      1 Reply Last reply Reply Quote 0
                      • richland007R Offline
                        richland007
                        last edited by

                        @shbatm @MoreLinux I tried doing only one module and deleteing everything and re discovering again but it did not find any new devices … i am not getting what am i doing wrong but i am sure it is something on my end
                        Is there a way and where do i look for errors??
                        can i see someones config .js portion of the module??

                        thank you in advance
                        D

                        MoreLinuxM 1 Reply Last reply Reply Quote 0
                        • MoreLinuxM Offline
                          MoreLinux @richland007
                          last edited by

                          @richland007 The devices in the config.js, did they have the same name as before the trouble started??

                          When yes, than Alexa does a discovery, but only finds known devices. That is what happened to me after I tested the module on my test-mirror and than re-did every step on my prod-mirror.

                          After deleting the found wemo devices in the Alexa app, I did a “Alexa, find my devices” and all the devices were found.

                          richland007R 1 Reply Last reply Reply Quote 0
                          • richland007R Offline
                            richland007 @MoreLinux
                            last edited by

                            @morelinux See my Alexa is not finding any wemo devices at all from the beginning every time i asked to discover devices after installing the module no wemo’s were found.
                            i have plenty of other home automation devices but no wemo’s or virtual wemo’s in this case.

                            MoreLinuxM 1 Reply Last reply Reply Quote 0
                            • MoreLinuxM Offline
                              MoreLinux @richland007
                              last edited by

                              @richland007 Are the mirror and Alexa on the same network??

                              richland007R 1 Reply Last reply Reply Quote 1
                              • richland007R Offline
                                richland007 @MoreLinux
                                last edited by

                                @morelinux yes they sure are.
                                when the MM starts i do not get any errors on the MMM-AlexaOnOff or anything
                                I do not know if there is a debug mode for the module…i am stuck
                                please @shbatm help me
                                I also uninstall and re -installed it from the beginning and nothing changed.
                                I am dumb founded

                                D

                                1 Reply Last reply Reply Quote 0
                                • S Offline
                                  shbatm Module Developer
                                  last edited by

                                  @richland007

                                  First, as requested, here is an example config section:

                                  {
                                     module: 'MMM-AlexaOnOff',
                                     config: {
                                        devices: [{
                                           name: "Magic Mirror",
                                           on: {
                                              notification: "ONSCREENMENU_PROCESS_ACTION",
                                              payload: {
                                                 actionName: 'monitorOn'
                                              }
                                           },
                                           off: {
                                              notification: "ONSCREENMENU_PROCESS_ACTION",
                                              payload: {
                                                 actionName: 'monitorOff'
                                              }
                                           },
                                        }]
                                     }
                                  },
                                  

                                  When you start MagicMirror, you should see a line like this in your log file. If you don’t, then it’s a problem with the module installation. Make sure you’ve run npm install from inside the MMM-AlexaOnOff folder.

                                  FauxMo service started. Listening on 192.168.1.100:21900
                                  

                                  And netstat -tulpn | grep electron should show something like this:

                                  tcp        0      0 0.0.0.0:21900           0.0.0.0:*               LISTEN      3554/electron
                                  tcp        0      0 0.0.0.0:8080            0.0.0.0:*               LISTEN      3554/electron
                                  

                                  Make sure your mirror and Alexa are on the same Wi-Fi. Make sure you delete any duplicate devices in your Alexa app or at https://alexa.amazon.com/spa/index.html#appliances then restart Discovery.

                                  richland007R 1 Reply Last reply Reply Quote 0
                                  • richland007R Offline
                                    richland007 @shbatm
                                    last edited by

                                    @shbatm Hey thank you for your reply and happy new year.
                                    I am convinced that my config.js entry (i use MMM-RemoteControl) are ok following your example.
                                    however i do not see any

                                    FauxMo service started. Listening on 192.168.1.xxx:21900
                                    

                                    And when i run the

                                    netstat -tulpn | grep electron
                                    

                                    command i do not see a net service listening under the port 21900 either

                                    I have unistalled and installed the MMM-AlexaOnOff module a couple of times and made sure that i have run npm install inside the cloned module folder but for some reason it is not doing what it is supposed to be doing not installing right

                                    what do you think may be causing it??
                                    D

                                    S 1 Reply Last reply Reply Quote 0
                                    • S Offline
                                      shbatm Module Developer @richland007
                                      last edited by shbatm

                                      @richland007 it sounds like something simple has to be missing and the module isn’t loading, otherwise you would be seeing an error.

                                      1. Please post your config anyways (or send to me in a chat if you prefer). It may be something simple missing.
                                      2. Confirm you are using a Raspberry Pi, on WiFi, using IPv4 (not IPv6 or ethernet–those are supported but require additional config options).
                                      3. Confirm there are no errors from the module in the logs. You can run pm2 restart mm && pm2 logs to follow the logs through the whole restart process.
                                      4. You can also add some console.log(...) statements in the initialize function in node_helper.js to see if you can diagnose any issues with it loading. Again, if it was making it that far and not loading you should have seen an error.
                                      richland007R 1 Reply Last reply Reply Quote 0
                                      • richland007R Offline
                                        richland007 @shbatm
                                        last edited by

                                        @shbatm Here is my config.js entry

                                        {
                                            module: 'MMM-AlexaOnOff',
                                            config: {
                                                devices: [{ 
                                                      name: "Horoscope Module",
                                                      on: { 
                                                        notification: "REMOTE_ACTION",
                                                        payload: { action: "SHOW", module: "MMM-horoscope" }
                                                      },
                                                      off: { 
                                                        notification: "REMOTE_ACTION",
                                                        payload: { action: "HIDE", module: "MMM-horoscope" }
                                                      },
                                                }]
                                            }
                                        },
                                        

                                        and there is the pm2 logs

                                        (the forum wont allow me to add a picture for some reason) but its all green when it comes to MMM-AlexaOnOff

                                        I am on wifi on the same network as the echo, i am using IPv4 and of course on Rpi

                                        I wish i could send you the picture of the pm2 logs… it says:
                                        Connecting socket for: AlexaOnOff
                                        Module helper started for module AlexaOnOff
                                        Sockets connected & Module started

                                        What do you think?? i do not see any errors

                                        D

                                        S 1 Reply Last reply Reply Quote 0
                                        • S Offline
                                          shbatm Module Developer @richland007
                                          last edited by shbatm

                                          @richland007 said in [MMM-AlexaOnOff] Simple Mirror Control from External Home Assistant (Alexa/Google Home/HASS.io):

                                          What do you think?? i do not see any errors

                                          I’m at a loss. I ran the install on a fresh install of MagicMirror (v2.7.0-dev) on the latest version of Raspbian with Desktop (Nov’18) and I got the output shown in this Gist: https://gist.github.com/shbatm/886fc811d314d136ccedeaf5663e5881. Notice the FauxMo service started. Listening on 192.168.10.92:21900 on the third to last line.

                                          When I copy and paste your config section into my config it works fine. I run Discover Devices on Alexa and she finds “Horoscope Module” as a Wemo Switch.

                                          What version of MagicMirror, node, and Raspbian are you using? Is it the most recent?

                                          Try running FauxMo by itself and see if you can find the “fake” devices it creates:

                                          cd ~/MagicMirror/modules/MMM-AlexaOnOff/node_modules/fauxmojs/example
                                          node example.js
                                          

                                          You should see: started.. and then be able to discover ‘office light’ and ‘office fan’

                                          Edit: I did notice one thing: unless you’re using my fork of MMM-Remote-Control, the SHOW/HIDE functions require the module identifier, not the module name. The identifier will be something of the form module_4_MMM-horoscope and is the HTML ID of the module’s container (you can find this by using DevTools or digging into MMM-Remote-Control further.

                                          richland007R S 2 Replies Last reply Reply Quote 1
                                          • richland007R Offline
                                            richland007 @shbatm
                                            last edited by

                                            @shbatm When i try to run the FauxMo example i see that it says: started …
                                            but there is no service running on port 21900 when i do “netstat -tulpn”
                                            I get a bunch of services running but none on that port.
                                            And when i try to discover devices, Alexa comes up saying that no new ones were found agian… so no Office Lamp and no Office Fan

                                            I am running Magic Mirror M 2.4.1
                                            Node version is: v6.13.0
                                            Rasbian Stretch 9.6 release (it is updated and upgraded as of today but i do not know if it is the lates release since i have been playing with it for a while)

                                            one more time with some more explanation on the MMM-Remote-Control names please… i did not quite get it where would i find the names again and are they numbered by MMM-Remote-Control according to their place that they have on my congfig.js list ??

                                            thank you for your help
                                            Denis

                                            1 Reply Last reply Reply Quote 0

                                            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                                            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                                            With your input, this post could be even better 💗

                                            Register Login
                                            • 1
                                            • 2
                                            • 3
                                            • 4
                                            • 5
                                            • 1 / 5
                                            • 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