Coder Social home page Coder Social logo

Comments (8)

AlCalzone avatar AlCalzone commented on August 26, 2024

Hmm I guess I could write this in the readme. The hostname is gw- followed by the MAC address in lowercase without any separators. The MAC address is printed on the label under the gateway.

from node-tradfri-client.

oscarnyl avatar oscarnyl commented on August 26, 2024

That is how I assumed it was: However, I was unable to connect when only entering the hostname (ERR_NAME_NOT_RESOLVED).

My case might be slightly special though as I'm running the development inside a Docker container which in turn is ran on a virtual machine πŸ˜…

from node-tradfri-client.

AlCalzone avatar AlCalzone commented on August 26, 2024

Hmm, can you open the console on your machine and run node, then enter the following code (edit the hostname)

var dns = require("dns");
dns.resolve("gw-xyzabc", function(err, addr) {
	if (err) {
		console.log("ERROR: " + err);
	} else {
		console.log(JSON.stringify(addr));
	}
});

and post the output here? I'd need some more info as I haven't heard about that error in a nodejs context.

from node-tradfri-client.

oscarnyl avatar oscarnyl commented on August 26, 2024

I think I've figured out why it would not resolve: I'm running a pihole in my network as my DNS server, which apparently messes with how this is supposed to work. When the pihole is inactive the adress resolves correctly, output of command is:

dns.resolve('gw-dcefcabcf84d', (err, addr) => err ? console.log(err) : console.log(JSON.stringify(addr)))
// => ["192.168.1.55"]

from node-tradfri-client.

oscarnyl avatar oscarnyl commented on August 26, 2024

I wonder if I can get it to work automatically while still having the pihole present on the network.

from node-tradfri-client.

oscarnyl avatar oscarnyl commented on August 26, 2024

For reference this is the result when running the same code when the pihole is active:

dns.resolve('gw-dcefcabcf84d', (err, addr) => err ? console.log(err) : console.log(JSON.stringify(addr)))
// => { Error: queryA ENOTFOUND gw-dcefcabcf84d
    at errnoException (dns.js:55:10)
    at QueryReqWrap.onresolve [as oncomplete] (dns.js:243:19)
  code: 'ENOTFOUND',
  errno: 'ENOTFOUND',
  syscall: 'queryA',
  hostname: 'gw-dcefcabcf84d' }

from node-tradfri-client.

AlCalzone avatar AlCalzone commented on August 26, 2024

Maybe enabling the pi-hole's DHCP helps with that:
https://www.reddit.com/r/pihole/comments/5xepzl/local_hostname_resolution/
Or you can add the gateway to /etc/hosts on the pihole:
https://discourse.pi-hole.net/t/trouble-using-pihole-to-resolve-local-hostnames/2163/2

Closing this as it doesn't seem to be a library issue.

from node-tradfri-client.

oscarnyl avatar oscarnyl commented on August 26, 2024

Thank you for the suggestion, I will try that out. πŸ‘

from node-tradfri-client.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.