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.

    Ideas Needed

    Scheduled Pinned Locked Moved General Discussion
    17 Posts 5 Posters 2.9k Views 5 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.
    • M Offline
      MilkShake
      last edited by

      Hi,
      So I build a magic mirror with MMM-AssistantMk2 and it works pretty good. I have the assistant/mirror integrated with the following:

      Roborock vacuumers (1 on each floor)
      Siemens EQ9 automatic coffeemachine
      Hue Lighting
      Video feed from the gate camera (doorbird 101D)

      So, I got the assistant to recognize the open gate “Open Gate” command and respond with “Ok, Opening the front gate”. However, in order to actually open the front gate, a HTTP GET needs to be sent to the gate camera. I can do that with a python script on the Raspberry PI, however in order to get the assistant to call that script I would need to do port forwards in my firewall, which I would rather not.

      I need some way to interact with the mirror, so it calls the python script. It could be a physical button but I am looking for alternatives.

      Does anyone have any ideas?

      Best
      MilkShake

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

        @MilkShake why do you need a python script to issue a get?

        in javascript in a browser, use the builtin fetch function

        fetch(url).then((info){})
        

        as u have the javascript to issue a message. its a one liner, maybe 5… i don’t know what the python needs to do

        https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch

        Sam

        How to add modules

        learning how to use browser developers window for css changes

        M 1 Reply Last reply Reply Quote 0
        • M Offline
          MilkShake
          last edited by

          It doesn’t really matter how I do it. The point is that it has to be done from LAN, so I need a way to interact with the mirror and get it to fire the script.

          R 1 Reply Last reply Reply Quote 0
          • M Offline
            MilkShake @sdetweil
            last edited by

            @sdetweil this is two lines:

            import requests
            
            x = requests.get('http://USERNAME:PASSWORD@192.168.1.XXX/bha-api/open-door.cgi')
            print(x.status_code)
            
            
            S 1 Reply Last reply Reply Quote 0
            • R Offline
              retroflex Project Sponsor Module Developer @MilkShake
              last edited by

              @MilkShake Isn’t the mirror on the same LAN? In that case you don’t have to do any port forwards.

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

                @MilkShake right, but now you gotta figure out how to execute it and u can’t do that from the browser, so now you need a node_helper and all that communication, and launching the ting in the background, etc,etc,etc)

                Sam

                How to add modules

                learning how to use browser developers window for css changes

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

                  @sdetweil I’m not following your point. I get it that I could do the GET from javascript instead of running a script, but the rest you might elaborate a bit more on :)

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

                    @MilkShake show me your script that is called when the action occurs

                    Sam

                    How to add modules

                    learning how to use browser developers window for css changes

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

                      @sdetweil my whole point is, since the action happens on the google assistant I would need to do port forwards in my firewall to be able to call a LAN URL with a GET method. I guess it would be possible to catch the event locally on the mirror and then call the python script or do the GET method in some other manner, but I don’t know how to do that.

                      One option would be to just add a physical button to the raspberry pi and when pressed it runs the GET method. It just annoys me that you can make the assistant understand a command, but not utilize it locally on LAN.

                      S 1 Reply Last reply Reply Quote 0
                      • M Offline
                        MilkShake @retroflex
                        last edited by

                        @retroflex The mirror and the gate are on the same LAN. The assistant understands the “Open Gate” command and replies with “Ok, Opening the gate”, but if I were to use a Google Action to do the GET, it would come from the internet.

                        I don’t know how to catch the event locally on the mirror. If I did, I would just call the python script and the gate would open.

                        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