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

wlan0 IP address in config file

Scheduled Pinned Locked Moved Unsolved Troubleshooting
2 Posts 2 Posters 223 Views 2 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.
  • H Offline
    hikano765
    last edited by lavolp3 Oct 23, 2023, 7:28 AM Oct 23, 2023, 5:41 AM

    I want to open the server with the first IP address of the wlan0 network by putting ifaces.wlan0[0].address in the address part of the config.js file. I modified the code to do this, but I get an error on the screen.

    const os = require("os");
    
    const ifaces = os.networkInterfaces();
    const wlan0Address = ifaces.wlan0[0].address;
    
    let config = {
        address: wlan0Address, // The first IP address of the wlan0 network interface
        port: 8080, 
        // etc...
    };
    

    If I write the code as above, I don’t know why, but when I open the server, I don’t see any module screen on the web server. So I thought the modules were a problem, so I modified the code as follows, and the modules come out well from the web server at that address.

    /*const os = require("os");
    const ifaces = os.networkInterfaces();
    const wlan0Address = ifaces.wlan0[0].address;
    */
    let config = {
        address: "xxx.xxx.xxx.xxx", // static address
        port: 8080, 
        // etc...
    };
    

    The conclusion that I came up with through this process is

    const os = require("os");
    const ifaces = os.networkInterfaces();
    const wlan0Address = ifaces.wlan0[0].address;
    

    I think the code in the above part is problematic, I want to know exactly what the problem is with this code, and how to fix the code to solve it.

    In addition, since English is not the main language, I hope you understand that my writing may have some grammatical errors.

    S 1 Reply Last reply Oct 23, 2023, 11:16 AM Reply Quote 0
    • S Offline
      sdetweil @hikano765
      last edited by sdetweil Nov 17, 2023, 1:37 PM Oct 23, 2023, 11:16 AM

      @hikano765 a better thing would be to change the address: to address:“0.0.0.0”
      then it will listen on all the active network adapters .

      you will also have to fix the ipWhitelist to allow apps from outside systems to connect

      while you are developing your mm solution it’s easiest to do
      ipWhitelist:[],

      to allow apps from any system on your local betwork

      Sam

      How to add modules

      learning how to use browser developers window for css changes

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