Git Product home page Git Product logo

Comments (15)

quacktacular avatar quacktacular commented on May 13, 2024

So turns out this is probably related to Alpine Linux not supporting nss / resolving local domains. Not sure that there is much that can be done to work around that.

from docker-homebridge.

oznu avatar oznu commented on May 13, 2024

@grover - I can replicate the issue of mdns not resolving hostnames in the alpine container. I was going to suggest you try the Bonjour module as this provides the same functionality in native javascript but see you have already attempted this without success.

I'm wondering what went wrong with the Bonjour module? I use this in one of my own plugins running inside Homebridge Docker without issue: https://github.com/oznu/homebridge-daikin-esp8266/blob/master/index.js#L24-L28


I created two test files to help debug the issue:

MDNS Test:

const mdns = require('mdns')

const ResolverSequence = [
  mdns.rst.DNSServiceResolve(),
  'DNSServiceGetAddrInfo' in mdns.dns_sd ? mdns.rst.DNSServiceGetAddrInfo() : mdns.rst.getaddrinfo({ families: [0] }),
   mdns.rst.makeAddressesUnique()
]

const browser = mdns.createBrowser(
  mdns.tcp('touch-able'),
  { resolverSequence: ResolverSequence }
)

browser.on('serviceUp', console.log)

browser.on('serviceDown', console.log)

browser.on('error', console.error)

browser.start()

Bonjour Test:

const bonjour = require('bonjour')()

const browser = bonjour.find({
  type: 'touch-able',
  protocol: 'tcp'
})

browser.on('up', console.log)

browser.on('down', console.log)

browser.on('error', console.error)

The mdns test file fails with the same {"code":-3008,"errno":-3008,"syscall":"getaddrinfo"} error.

However the Bonjour test works for me:

{ addresses: [ 'fe80::8af:496e:1f07:3729', '192.168.1.243' ],
  rawTxt: <Buffer 09 74 78 74  ... >,
  txt:
   { txtvers: '1',
     dvsv: '3187',
     dvty: 'iTunes',
     ossi: '0x1F5',
     dbid: 'xxxxxxxxxxxxxxxxx',
     ctln: 'oznu’s Library',
     icsv: '65540',
     iv: '196622',
     ver: '131077' },
  name: 'xxxxxxxxxxxxxxxxx',
  fqdn: 'xxxxxxxxxxxxxxxxx._touch-able._tcp.local',
  host: 'mac.local',
  referer:
   { address: '192.168.1.243',
     family: 'IPv4',
     port: 5353,
     size: 316 },
  port: 3689,
  type: 'touch-able',
  protocol: 'tcp',
  subtypes: [] }

{ addresses: [ 'fe80::86d:25e1:ccd4:83b0', '192.168.1.199' ],
  rawTxt: <Buffer 0a 56 65 72 ... >,
  txt:
   { ver: '131075',
     atcv: '65536',
     atsv: '65539',
     dvty: 'AppleTV5,3',
     ctln: 'Apple TV' },
  name: 'xxxxxxxxxxxxxxxxx',
  fqdn: 'xxxxxxxxxxxxxxxxx._touch-able._tcp.local',
  host: 'Apple-TV.local',
  referer: { address: '192.168.1.199', family: 'IPv4', port: 5353, size: 286 },
  port: 3689,
  type: 'touch-able',
  protocol: 'tcp',
  subtypes: [] }

It looks like the Bonjour module works as far as discovering iTunes / Apple TV goes. Using your master branch iTunes won't pair, it just get's stuck on Verifying Remote Passcode.

image

from docker-homebridge.

oznu avatar oznu commented on May 13, 2024

A combination of both Bonjour and mDNS works. It feels very messy though.

grover/homebridge-dacp@master...oznu:master

from docker-homebridge.

grover avatar grover commented on May 13, 2024

@oznu thanks for the branch. I believe the culprit and difference being that you’re going straight to the referrer of the bonjour announcement. You’re not actually resolving the name, but assume that the sender will be the one. I guess this is ok as far as I have not seen any MDNS caches floating around.

What surprised me though is that you also had to change the advertisement code. Why is that?

I may have to setup Docker and homebridge-docker on my Mac to get a better understanding of this.

from docker-homebridge.

oznu avatar oznu commented on May 13, 2024

Hi @grover,

I swapped back to mDNS for advertisements as, for reasons that I am not sure of, when using the Bonjour library to advertise iTunes refused to pair. I probably missed something and was just trying to get a quick PoC up and running.

from docker-homebridge.

grover avatar grover commented on May 13, 2024

I've applied your referer workaround use a feature toggle on the latest master, but kept the advertisement stuff via Bonjour for now. I've tested multiple pairings with iTunes and AppleTV without issues this way today and hope that this was just a strange side effect. See also my comment in Issue #10 - would be great if you could give the latest master a try.

from docker-homebridge.

thechrisreese avatar thechrisreese commented on May 13, 2024

I was trying to figure out why my new update of homebridge is no longer advertising on my network. Could all this be part of the reason?

QNAP NAS running in Docker through Container Station

from docker-homebridge.

oznu avatar oznu commented on May 13, 2024

@thechrisreese - this issue won't be related.

from docker-homebridge.

oznu avatar oznu commented on May 13, 2024

To keep everything in once place I'll close this in favour of grover/homebridge-dacp#10 - which I'm watching.

from docker-homebridge.

sommo avatar sommo commented on May 13, 2024

Hi oznu,
this is not the correct place but i have issue on a different your project (homebridge-daikin-esp8266).
I can't load homebridge with your plugin:

[8/6/2018, 12:16:56 PM] ====================
[8/6/2018, 12:16:56 PM] ERROR LOADING PLUGIN homebridge-daikin-esp8266:
[8/6/2018, 12:16:56 PM] TypeError: util.promisify is not a function
at Object. (/usr/local/lib/node_modules/homebridge-daikin-esp8266/node_modules/mdns-resolver/dist/index.js:32:24)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at Object. (/usr/local/lib/node_modules/homebridge-daikin-esp8266/dist/index.js:12:22)
at Module._compile (module.js:571:32)
[8/6/2018, 12:16:56 PM] ====================

Sorry posting here but there is no issue option under that project.
Thank you!

from docker-homebridge.

oznu avatar oznu commented on May 13, 2024

You'll need Node.js version 8 or higher.

from docker-homebridge.

sommo avatar sommo commented on May 13, 2024

ok Thank you! i will update to newer node!
another last question, i'm trying to send curl to the arduino in different way to change a json value, but i can't change them, i'm trying to understand the logic behind but can't:

send 1:
curl -d '{"name" : "targetFanSpeed", "values" : "min"}' -X POST http://192.168.0.134/daikin -H Content-Type:application/json

recieve1:
{"status": "0"}

send 2:
curl -d '{"name" : "targetFanSpeed", "values" : 'min'}' -X POST http://192.168.0.134/daikin -H Content-Type:Origin

always recieve an ok:
{"status": "0"}

send 3:
curl -d '{"name" : "targetFanSpeed", "values" : min}' -X POST http://192.168.0.134/daikin -H Content-Type:application/json

"status": "0"}

but when asking the arduino it's state:
curl 192.168.0.134/daikin

{"currentTemperature":25.7,"currentHumidity":77.9,"targetMode":"off","targetFanSpeed":"auto","targetTemperature":23,"verticalSwing":false,"horizontalSwing":false,"quietMode":false,"powerfulMode":false}

did'nt change anything also if getting 200ok.

from docker-homebridge.

oznu avatar oznu commented on May 13, 2024

I don't have issues enabled on the project as I didn't really want to support it 😄

To do a POST just send back the same json you get from the GET request. All attributes are optional.

eg:

{
    "targetMode": "heat",
    "targetFanSpeed": "auto",
    "targetTemperature": 24,
    "verticalSwing": false,
    "horizontalSwing": false,
    "quietMode": false,
    "powerfulMode": false
}

Setting fan speed:

curl -d '{"targetFanSpeed":  "min"}' -X POST http://192.168.0.134/daikin -H Content-Type:application/json

Setting target temp:

curl -d '{"targetTemperature":  24}' -X POST http://daikin-thermostat.local/daikin -H Content-Type:application/json

Or doing both at the same time:

curl -d '{"targetTemperature":  24, "targetFanSpeed":  "min"}' -X POST http://daikin-thermostat.local/daikin -H Content-Type:application/json

Make sure you send valid JSON, this means double quoting strings, not quoting integers, and not having any extra commas.

Allowed modes = cool, heat, auto, dry, off
Allowed fan speeds = auto, min, max

from docker-homebridge.

sommo avatar sommo commented on May 13, 2024

amazing, it works! THANK YOU (wanted caps lock) :)

from docker-homebridge.

oznu avatar oznu commented on May 13, 2024

You're welcome. It's good to know other people can make use of it.

I've not touched the factory daikin remote controller in over 18 months 😄

from docker-homebridge.

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.