Read the statement by Michael Teeuw here.
Enabling MM-QR Code to read the output of MM-Remote Control
-
@sdetweil
Unfortunately, yes, when she returns to college. To make things worse, I don’t know how often the college’s dhcp will get her a new iPhone address. -
@cheapdad iphone is irrelevant to this…
-
@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 startthis works for ipV4… haven’t tried with ipV6 network
the grep "inet " filters out the v6 address “inet6” would select just that addressdocs 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
-
@sdetweil did the start up script work alone to make the qr code work with mmm-remotecontrol
address? sorry little confused -
@integria92 the qrcode module creates the qr… it takes a hard coded url
but if u don’t know the value, its hardso 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…
-
@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 -
@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-QRCodeand 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 expectedremember, until mm starts, the config.js is a useless text file