KraigM / homebridge-harmonyhub

HomeBridge Plugin for Logitech Harmony Hub
182 stars 52 forks source link

Pass options to Discover #117

Open stblassitude opened 6 years ago

stblassitude commented 6 years ago

This enables passing options to harmonyhubjs-discover's Discover constructor.

This closes #105.

For systems with multiple interfaces, using the default broadcast address of 255.255.255.255 will not give consistent results. Instead, you need to pass the appropriate broadcast address for the network you're addressing, like 192.168.1.255 for the network 192.168.1.0/24.

This PR requires swissmanu/harmonyhubjs-discover#8 to be merged and released.

(Atom fixed the whitespace problems automatically. If you prefer, I can roll those back.)

stblassitude commented 6 years ago

With the release of harmonyhubjs-discover 1.1.1, this pull request should now be complete.

andyblac commented 6 years ago

can this get committed ? i have separate network for IoT.

andyblac commented 6 years ago

tried manually adding code above, but it still won't see my hubs sitting in the separate VLAN. any ideas?

        {
            "platform": "HarmonyHub",
            "name": "Harmony Hub",
            "discoverOptions": {
                "address": "192.168.3.255"
            }
         }
stblassitude commented 6 years ago

That config snippet looks just fine. This looks identical to my running config.

andyblac commented 6 years ago
Loading logs from file
CMD: tail -n 100 -f /homebridge/logs/homebridge.log

[2018-3-10 10:46:44] Homebridge is running on port 51826.

┌───────────────────────────────────────────────────┐
│              npm update check failed              │
│        Try running with sudo or get access        │
│       to the local update config store via        │
│ sudo chown -R $USER:$(id -gn $USER) /root/.config │
└───────────────────────────────────────────────────┘
[2018-3-10 10:46:45] [Config] Using Form Authentication
[2018-3-10 10:46:45] [Config] Console is listening on port 8581.
[2018-3-10 10:56:53] [Config] Changes to config.json saved.
[2018-3-10 10:57:04] [Config] Changes to config.json saved.
[2018-3-10 10:57:07] [Config] Homebridge restart request received
[2018-3-10 10:57:07] [Config] No restart command defined, killing process...
*** WARNING *** The program 'node' uses the Apple Bonjour compatibility layer of Avahi.
*** WARNING *** Please fix your application to use the native API of Avahi!
*** WARNING *** For more information see <http://0pointer.de/avahi-compat?s=libdns_sd&e=node>
*** WARNING *** The program 'node' called 'DNSServiceRegister()' which is not supported (or only supported partially) in the Apple Bonjour compatibility layer of Avahi.
*** WARNING *** Please fix your application to use the native API of Avahi!
*** WARNING *** For more information see <http://0pointer.de/avahi-compat?s=libdns_sd&e=node&f=DNSServiceRegister>

┌───────────────────────────────────────────────────┐
│              npm update check failed              │
│        Try running with sudo or get access        │
│       to the local update config store via        │
│ sudo chown -R $USER:$(id -gn $USER) /root/.config │
└───────────────────────────────────────────────────┘
[2018-3-10 10:57:14] Loaded plugin: homebridge-config-ui-x
[2018-3-10 10:57:14] Registering platform 'homebridge-config-ui-x.config'
[2018-3-10 10:57:14] ---
[2018-3-10 10:57:14] Loaded plugin: homebridge-dummy
[2018-3-10 10:57:14] Registering accessory 'homebridge-dummy.DummySwitch'
[2018-3-10 10:57:14] ---
[2018-3-10 10:57:14] Loaded plugin: homebridge-harmonyhub
[2018-3-10 10:57:14] Registering platform 'homebridge-harmonyhub.HarmonyHub'
[2018-3-10 10:57:14] ---
[2018-3-10 10:57:14] Loaded plugin: homebridge-tplink-smarthome
[2018-3-10 10:57:14] Registering platform 'homebridge-tplink-smarthome.TplinkSmarthome'
[2018-3-10 10:57:14] ---
[2018-3-10 10:57:14] Loaded config.json with 0 accessories and 3 platforms.
[2018-3-10 10:57:14] ---
[2018-3-10 10:57:14] Loading 3 platforms...
[2018-3-10 10:57:14] [Config] Initializing config platform...
[2018-3-10 10:57:14] [Harmony Hub] Initializing HarmonyHub platform...
[2018-3-10 10:57:14] [TplinkSmarthome] Initializing TplinkSmarthome platform...
[2018-3-10 10:57:14] [TplinkSmarthome] homebridge-tplink-smarthome v3.11.0, node v8.9.4, homebridge v0.4.38
[2018-3-10 10:57:14] Loading 0 accessories...
[2018-3-10 10:57:14] Homebridge is running on port 51826.

┌───────────────────────────────────────────────────┐
│              npm update check failed              │
│        Try running with sudo or get access        │
│       to the local update config store via        │
│ sudo chown -R $USER:$(id -gn $USER) /root/.config │
└───────────────────────────────────────────────────┘
[2018-3-10 10:57:14] [Config] Using Form Authentication
[2018-3-10 10:57:14] [Config] Console is listening on port 8581.
[2018-3-10 10:57:14] [TplinkSmarthome] New Device Online: [Christmas Tree] plug [xxxxxxxxx] 192.168.3.19 9999
[2018-3-10 10:57:14] [TplinkSmarthome] Adding: [Christmas Tree] plug [xxxxxxxxx]
[2018-3-10 10:57:14] [TplinkSmarthome] New Device Online: [Lounge Lamp3] plug [xxxxxxxxx] 192.168.3.12 9999
[2018-3-10 10:57:14] [TplinkSmarthome] Adding: [Lounge Lamp3] plug [xxxxxxxxx]
[2018-3-10 10:57:14] [TplinkSmarthome] New Device Online: [Sideboard Lights] plug [xxxxxxxxx] 192.168.3.20 9999
[2018-3-10 10:57:14] [TplinkSmarthome] Adding: [Sideboard Lights] plug [xxxxxxxxx]
andyblac commented 6 years ago

i can ping them too

/homebridge # ping 192.168.3.5                                                                                                                                        
PING 192.168.3.5 (192.168.3.5): 56 data bytes                                                                                                                         
64 bytes from 192.168.3.5: seq=0 ttl=63 time=3.678 ms                                                                                                                 
64 bytes from 192.168.3.5: seq=1 ttl=63 time=1.456 ms                                                                                                                 
64 bytes from 192.168.3.5: seq=2 ttl=63 time=1.460 ms                                                                                                                 
^C                                                                                                                                                                    
--- 192.168.3.5 ping statistics ---                                                                                                                                   
3 packets transmitted, 3 packets received, 0% packet loss                                                                                                             
round-trip min/avg/max = 1.456/2.198/3.678 ms                                                                                                                         
/homebridge #                                                                                                                                  
andyblac commented 6 years ago

@stblassitude it seems to parsing the object ok

[2018-3-10 12:01:33] [Harmony Hub] Initializing HarmonyHub platform...
[2018-3-10 12:01:33] [Harmony Hub] OPTIONS: {"address":"192.168.3.255"}
eddieroger commented 6 years ago

Seconding this merge request - I also operate a separate IoT VLAN and being able to pass discovery address would be really helpful.