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

Enabling MM-QR Code to read the output of MM-Remote Control

Scheduled Pinned Locked Moved Troubleshooting
9 Posts 3 Posters 1.3k Views 3 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 Offline
    sdetweil @CheapDad
    last edited by Jun 8, 2021, 4:28 PM

    @cheapdad iphone is irrelevant to this…

    Sam

    How to add modules

    learning how to use browser developers window for css changes

    S 1 Reply Last reply Jun 8, 2021, 4:59 PM Reply Quote 0
    • S Offline
      sdetweil @sdetweil
      last edited by sdetweil Jun 9, 2021, 5:11 PM Jun 8, 2021, 4:59 PM

      @sdetweil you could make the MM start script fix the config entry

      here is a little script you can use to modify the config when MM is started

      #!/bin/bash
      #
      # get the active adapter name
      #
      adapter=$(ip link show | grep mtu | grep -v lo | grep up | grep -v -i docker | grep "state UP" | awk -F: '{print $2}' | awk '{print $1}')
      #
      # use the adapter name to get the assigned IP address
      #
      address=$(ifconfig $adapter | grep "inet " | awk '{print $2}')
      #
      # use for debugging
      # echo address for  adapter $adapter  is $address
      #
      # use the address in sed replace of the line that starts with text:"http:/
      # -i means update file in place
      # file at the end needs the path   (~/MagicMirror/config/config.js
      #
      sed -i "/text:\"http:/ c \    \"text\"\:\"http://$address:8080/modules/remoteControl.html\","  config.js
      

      u could add this to the mm.sh used to start MM on boot,etc…
      I don’t know the end of the remotecontrol link… so that has to be fixed too…
      just have something in config.js when this runs , this should run before npm start

      this works for ipV4… haven’t tried with ipV6 network
      the grep "inet " filters out the v6 address “inet6” would select just that address

      docs says

      Because IPv6 addresses contain colons, they cannot be directly used in URLs because the colons would conflict with both the protocol declaration (http:// or https://) and port numbers. Therefore, when a literal IPv6 address is used, it is encased in a bracket, like http://[2001:db8::1]:80.
      

      so that would be a tiny change to the sed string

      Sam

      How to add modules

      learning how to use browser developers window for css changes

      1 Reply Last reply Reply Quote 0
      • I Offline
        Integria92
        last edited by Nov 30, 2021, 2:43 AM

        @sdetweil did the start up script work alone to make the qr code work with mmm-remotecontrol
        address? sorry little confused

        S 1 Reply Last reply Nov 30, 2021, 3:28 AM Reply Quote 0
        • S Offline
          sdetweil @Integria92
          last edited by Nov 30, 2021, 3:28 AM

          @integria92 the qrcode module creates the qr… it takes a hard coded url
          but if u don’t know the value, its hard

          so the text above added to the mm.sh can update the config.js for the QRCode module before MM starts and all will be well…

          Sam

          How to add modules

          learning how to use browser developers window for css changes

          I 1 Reply Last reply Nov 30, 2021, 3:07 PM Reply Quote 0
          • I Offline
            Integria92 @sdetweil
            last edited by Nov 30, 2021, 3:07 PM

            @sdetweil Interesting. Thanks for the quick response. so in the example above; for the qrcode config… What would the text =
            to find the output from the script?
            again, thanks a lot for your help

            S 1 Reply Last reply Nov 30, 2021, 3:27 PM Reply Quote 0
            • S Offline
              sdetweil @Integria92
              last edited by sdetweil Nov 30, 2021, 3:30 PM Nov 30, 2021, 3:27 PM

              @integria92 the qrcode takes some text and makes it available to the scanner

              it can be anything

              IF the text is a url, the client app offers to open it

              so, you config the module with a dummy url
              https://github.com/evghenix/MMM-QRCode

              and the the script additions change it to the machine IP address at the time mm starts.

              which the op’s daughter in college would not generally know.

              if the machine was powered off for a day/week, it’s ip address would likely change, and so a hard coded ip address would be bad.

              this code handles any dhcp address
              change and then the qrcode launches remote controls expected

              remember, until mm starts, the config.js is a useless text file

              Sam

              How to add modules

              learning how to use browser developers window for css changes

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