jsiegenthaler / homebridge-eosstb

A homebridge plugin for the EOS set-top box as used by Sunrise, Telenet, Ziggo, Virgin Media and maybe more in various countries on the Horizon Go (HGO) platform
https://github.com/jsiegenthaler/homebridge-eosstb
32 stars 4 forks source link

Problem adding to home app #79

Closed GillesWi closed 1 year ago

GillesWi commented 1 year ago

Hi, before it was perfectly and it suddenly disappeared. I use a Telenet TV box in Belgium. The logs say it's connecting but I am unable to add it in the home app. I tried everything. Can someone confirm it's still working with Telenet? Thanks!

jsiegenthaler commented 1 year ago

Hi @GillesWi. What version of the plugin are you using? Goes the log show successful login to Telenet? Does the log show the accessory was created? If the login was successful and the accessory was created, then do the following:

  1. Force close the Home app
  2. Restart Homebridge
  3. Wait 5 to 10 minutes for the accessory to be advertised on the network
  4. Open the Home app and try to add the accessory

If the above doesn't work, let me know, and please post some logs here (sanitise them first by removing username/password if visible). Logs help hugely.

GillesWi commented 1 year ago

Did everything above. But still nothing. Homekit just keeps searching for the accessory when I fill in the setup code. The logs say it's connected to homebridge right? Because it loads the profiles etc... Its just nowhere to be found on the network

Thanks for all the help!

Screenshot 2022-11-19 at 12 21 27 PM Screenshot 2022-11-19 at 12 23 24 PM
jsiegenthaler commented 1 year ago

@GillesWi Thanks for the logs. The log shows that the plugin started and created the accessory without any errors. It is properly reading the set-top box status and updating the characteristics without error. Thus the plugin is working OK.

Your issue appears to be a HomeKit / Home app pairing issue .

On my development laptop running Windows 10, I note that my accessory cannot be added to HomeKit when my laptop is connected by Wi-Fi, but it can when the laptop is connected by Ethernet LAN cable. On Wi-Fi, the Home app sees that the accessory exists but cannot pair it, showing the same errors as you observe. On the LAN connection it works perfectly. This indicates that my Wi-Fi network is not propagating the necessary info to the LAN to reach the Home hub during a pairing request. As this is low level networking protocol, I cannot do much to change this. But maybe I could investigate the debug logs of HAP-NodeJS.

Make sure that your Homebridge is running on a device connected by a hard-wired Ethernet LAN cable to your home network. Let me know more about your Homebridge setup. What is it running on (Windows server, Mac server, Linux server) and how is it connected to your network (Wi-Fi or LAN)?

GillesWi commented 1 year ago

Hi! I understand it! The weird thing is that I did not change my setup. Wireless Raspberry Pi4... I only updated the plugin, the Homebridge version and Node... So maybe something broke it there. For me it's not a big problem. I will give it some time and if it's fixed I will of sure let you know!

jsiegenthaler commented 1 year ago

I'm very interested in getting to the bottom of this. For your reference, here is my system on startup. Logging HAP-NodeJS. (add the text "HAP-NodeJS:*" in the Homebridge DEBUG Environment Variable.

Here's my Win10 laptop starting up when connected to LAN via Ethernet cable:

'[19/11/2022, 13:59:09] Loaded plugin: homebridge-eosstb@2.0.1 [19/11/2022, 13:59:09] Registering platform 'homebridge-eosstb.eosstb' [19/11/2022, 13:59:09] --- [19/11/2022, 13:59:09] Loading 2 platforms... [19/11/2022, 13:59:09] [EOSSTB] Initializing eosstb platform... [19/11/2022, 13:59:09] [EOSSTB] homebridge-eosstb v2.0.1 2022-11-19T12:59:09.946Z HAP-NodeJS:Advertiser Preparing Advertiser for 'Homebridge DevNew 3239 0CAD' using bonjour-hap backend! Setup Payload: X-HM://0024NZPA8UQPZ Enter this code with your HomeKit app on your iOS device to pair with Homebridge:

┌────────────┐     
│ xxx-xx-xxx │     
└────────────┘     

2022-11-19T12:59:09.965Z HAP-NodeJS:EventedHTTPServer Server listening on [::]:51040 2022-11-19T12:59:09.965Z HAP-NodeJS:Advertiser Starting to advertise 'Homebridge DevNew 3239 0CAD' using bonjour-hap backend! [19/11/2022, 13:59:09] Homebridge v1.6.0-beta.4 (HAP v0.11.0) (Homebridge DevNew 3239) is running on port 51040. 2022-11-19T12:59:10.869Z HAP-NodeJS:EventEmitter [::ffff:192.168.0.72] Registered event 'REQUEST' (total: 1) at EventedHTTPServer.onConnection (C:\Users\jochen\AppData\Roaming\npm\node_modules\homebridge\node_modules\hap-nodejs\src\lib\util\eventedhttp.ts:231:16) 2022-11-19T12:59:10.870Z HAP-NodeJS:EventEmitter [::ffff:192.168.0.72] Registered event 'AUTHENTICATED' (total: 1) at EventedHTTPServer.onConnection (C:\Users\jochen\AppData\Roaming\npm\node_modules\homebridge\node_modules\hap-nodejs\src\lib\util\eventedhttp.ts:234:16) 2022-11-19T12:59:10.870Z HAP-NodeJS:EventEmitter [::ffff:192.168.0.72] Registered event 'CLOSED' (total: 1) at EventedHTTPServer.onConnection (C:\Users\jochen\AppData\Roaming\npm\node_modules\homebridge\node_modules\hap-nodejs\src\lib\util\eventedhttp.ts:235:16) 2022-11-19T12:59:10.870Z HAP-NodeJS:EventedHTTPServer [::ffff:192.168.0.72] New connection from client on interface Ethernet (::ffff:192.168.0.72) 2022-11-19T12:59:10.872Z HAP-NodeJS:EventedHTTPServer:Connection [::ffff:192.168.0.72] Internal HTTP server listening on 127.0.0.1:62287 2022-11-19T12:59:10.874Z HAP-NodeJS:EventedHTTPServer:Connection [::ffff:192.168.0.72] Internal HTTP socket connected. HAPConnection now fully set up!'

jsiegenthaler commented 1 year ago

And here's my Win10 laptop starting up when connected to WiFi:

[19/11/2022, 14:05:07] Loaded plugin: homebridge-eosstb@2.0.1 [19/11/2022, 14:05:07] Registering platform 'homebridge-eosstb.eosstb' [19/11/2022, 14:05:07] --- [19/11/2022, 14:05:07] Loading 2 platforms... [19/11/2022, 14:05:07] [EOSSTB] Initializing eosstb platform... [19/11/2022, 14:05:07] [EOSSTB] homebridge-eosstb v2.0.1 2022-11-19T13:05:07.476Z HAP-NodeJS:Advertiser Preparing Advertiser for 'Homebridge DevNew 3239 0CAD' using bonjour-hap backend! Setup Payload: X-HM://0024NZPA8UQPZ Enter this code with your HomeKit app on your iOS device to pair with Homebridge:

┌────────────┐     
│ xxx-xx-xxx │     
└────────────┘     

2022-11-19T13:05:07.495Z HAP-NodeJS:EventedHTTPServer Server listening on [::]:51040 2022-11-19T13:05:07.495Z HAP-NodeJS:Advertiser Starting to advertise 'Homebridge DevNew 3239 0CAD' using bonjour-hap backend! [19/11/2022, 14:05:07] Homebridge v1.6.0-beta.4 (HAP v0.11.0) (Homebridge DevNew 3239) is running on port 51040. [19/11/2022, 14:05:22] [EOSSTB] sessionWatchdog(1): homebridge-eosstb running in DEV environment with debugLevel 0 [19/11/2022, 14:05:22] [EOSSTB] Session DISCONNECTED. Starting session connection process ... Snip: a bunch of irrelevant eostb log entries ...

2022-11-19T13:05:23.527Z HAP-NodeJS:Advertiser Preparing Advertiser for 'Sunrise DEV 47DC' using bonjour-hap backend! [19/11/2022, 14:05:23] [EOSSTB] Discovery completed 2022-11-19T13:05:23.558Z HAP-NodeJS:EventedHTTPServer Server listening on [::]:57618 2022-11-19T13:05:23.558Z HAP-NodeJS:Advertiser Starting to advertise 'Sunrise DEV 47DC' using bonjour-hap backend! ... Snip: a bunch of irrelevant eostb log entries ...

2022-11-19T13:06:07.510Z HAP-NodeJS:EventedHTTPServer Currently 0 hap connections open: 2022-11-19T13:06:23.569Z HAP-NodeJS:EventedHTTPServer Currently 0 hap connections open:

It looks like port 51040 is not open to WiFi for me

GillesWi commented 1 year ago

This are my logs: Think there is indeed no open port to connect to.

[19/11/2022, 14:15:30] [Telenet] Telenet: Initialization completed [19/11/2022, 14:15:30] Publishing external accessory (name: Telenet, publishInfo: { username: 'AC:15:C0:76:3F', pincode: '*-*-', category: 35, port: undefined, bind: undefined, mdns: undefined, addIdentifyingMaterial: true, advertiser: undefined }). 2022-11-19T13:15:30.261Z HAP-NodeJS:Advertiser Preparing Advertiser for 'Telenet 10DA' using bonjour-hap backend! [19/11/2022, 14:15:30] [Telenet] Discovery completed [19/11/2022, 14:15:30] [Telenet] sessionWatchdog: ++++++ step 6: devices found: 1 [19/11/2022, 14:15:30] [Telenet] sessionWatchdog: ++++++ step 6: calling getJwtToken [19/11/2022, 14:15:30] [Telenet] Getting jwt token for householdId DTV3656471_b [19/11/2022, 14:15:30] [Telenet] getJwtToken: jwtAxiConfig: { method: 'GET', url: 'https://prod.spark.tenet.tv/auth-service/v1/mqtt/token', headers: { 'X-OESP-Token': 'eyJhbGciOiJIUzI1NiIsInI6IkpXVCIsImtpZCI6Im9lc3BfdG9rZW5fcHJvZF8yMDIwMDgxOSJ9.eyJpc3MiOiJ3ZWItYXBpLXByb2Qtb2JvLmhvcml6b24udHYiLCaWQiOiJmZTFmNjdiMGFlY2EwNGZlNDcwZWM0MzIwZGQwNDg4MjMwYmNlZDlhNjZiMTM1ZDNhMjRjYzhjNWEyNmJkYTZjIiwiaWF0IjoxNjY4ODYzNzI4LCJleHAiOjE2Njg4NzA5MjgsInN1YiI6IkRUVjM2NTY0NzFfYmUifQ.QrDBNJNfrnZspc0Dpz21JGiSRwZ0IfBnm3Qxv2vfszQ', 'X-OESP-Username': 'mailgilled.com' } } 2022-11-19T13:15:30.270Z HAP-NodeJS:EventedHTTPServer Server listening on [::]:34259 2022-11-19T13:15:30.270Z HAP-NodeJS:Advertiser Starting to advertise 'Telenet 10DA' using bonjour-hap backend! [19/11/2022, 14:15:30] Telenet 10DA is running on port 34259. [19/11/2022, 14:15:30] Please add [Telenet 10DA] manually in Home app. Setup Code: 735-99-3 [19/11/2022, 14:15:30] [Telenet] Telenet: MostWatched list refreshed with 157 channels [19/11/2022, 14:15:30] [Telenet] sessionWatchdog: ++++++ step 7: getJwtToken token was retrieved, token eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6Im9lc3BfbXF0dCJ9.eyiOjE2Njg4NjM3MzAsImV4cCI6MTY2ODg4MTczMCwiY29tcy1ncm91cC1pZCI6IkRUVjM2NTY0NzFfYmUifQ.dwdgpQCYcecpbyuXcI__RmbVbKelZ6Id1-PUl1FCuqs [19/11/2022, 14:15:30] [Telenet] sessionWatchdog: ++++++ step 7: start mqtt client [19/11/2022, 14:15:31] [Telenet] mqttClient: Connected: true [19/11/2022, 14:15:31] [Telenet] Refreshing recording state [19/11/2022, 14:15:31] [Telenet] Refreshing recording bookings [19/11/2022, 14:15:31] [Telenet] Telenet: Recording bookings: planned recordings found: local 0, network 2, current Program Mode 1 [PROGRAM_SCHEDULED] [19/11/2022, 14:15:31] [Telenet] Telenet: Status Fault changed from undefined [undefined] to 0 [NO_FAULT] [19/11/2022, 14:15:31] [Telenet] Telenet: Status Active changed from undefined [undefined] to 1 [ACTIVE] [19/11/2022, 14:15:31] [Telenet] Telenet: In Use changed from undefined [undefined] to 0 [NOT_IN_USE] [19/11/2022, 14:15:31] [Telenet] Telenet: Picture Mode changed from null [OTHER] to 1 [STANDARD] [19/11/2022, 14:15:31] [Telenet] Telenet: Program Mode changed from undefined [undefined] to 1 [PROGRAM_SCHEDULED] [19/11/2022, 14:15:31] [Telenet] Telenet: Input Device Type changed on input 0 ID_UNKNOWN from undefined [undefined] to 1 [TV] [19/11/2022, 14:15:31] [Telenet] Telenet: Input Source Type changed on input 0 ID_UNKNOWN from undefined [undefined] to 2 [TUNER] [19/11/2022, 14:15:31] [Telenet] Telenet: Recording state: ongoing recordings found: local 0, network 0, current Recording State 0 [IDLE] [19/11/2022, 14:15:33] [Telenet] Telenet: Status Active changed from 1 [ACTIVE] to 0 [NOT_ACTIVE]

tooh commented 1 year ago

Out of interest:

I deduct from the log that you are using bonjour as discovery service.

Is changing this to ciao an option?

https://github.com/homebridge/homebridge/wiki/mDNS-Options

jsiegenthaler commented 1 year ago

@tooh Thanks for that, I had overlooked it. I was mucking around trying both to see the difference. I just changed to using ciao, but it makes no difference to my problem. I have no HAP-communication over WiFi, only over Ethernet. Weird.

jsiegenthaler commented 1 year ago

@GillesWi : enable Node-HAP debugging, restart, and try and pair the accessory with your device. Instructions to enable debugging are here: https://github.com/homebridge/HAP-NodeJS/wiki/FAQ#debug-mode

GillesWi commented 1 year ago

Yes, I tried that. Also about the WiFi problem that you have, do other accessories/ plugins work on WiFi?

jsiegenthaler commented 1 year ago

@GillesWi My wifi HAP issue is only on my dev Homebridge environment. My "prod" environment is a raspberry pi, connected to Ethernet LAN. The pi works perfectly. The laptop works perfectly when connected by Ethernet LAN

jsiegenthaler commented 1 year ago

@GillesWi I raised a question on discord: https://discord.com/channels/432663330281226270/435671317161705484

What's your Homebridge environment? How is it connected? Ethernet LAN?

jsiegenthaler commented 1 year ago

@GillesWi You wrote " Wireless Raspberry Pi4... I only updated the plugin, the Homebridge version and Node..." What Node are you on? I'm wondering if this is a Node issue. My Win laptop and my raspberry pi are both on Node 18.12.1 I'll try downgrading to node 16...

jsiegenthaler commented 1 year ago

@GillesWi I downgraded to Homebridge v1.4.1 with HAP-NodeJS v0.10.4 running on Node v16.18.1. No difference.

jsiegenthaler commented 1 year ago

@GillesWi can you connect your pi to an Ethernet LAN cable to your network as a test? If that works, then we both have a commonality: the issue happens when Homebridge is connected over WiFi

jsiegenthaler commented 1 year ago

I added a Wiki entry for this issue: https://github.com/jsiegenthaler/homebridge-eosstb/wiki/FAQ

jsiegenthaler commented 1 year ago

@GillesWi Problem resolved. Sometimes these things are much simpler than you think. The root cause of my HAP not working over Wi-Fi on my laptop was my Homebridge Settings: > Network Interfaces > Select the network interfaces that Homebridge should advertise and listen on. > I only had Ethernet configured. I added Wi-Fi and now my Homebridge advertises and listens on both Ethernet and Wi-Fi interfaces. Check your own settings.

GillesWi commented 1 year ago

Just connected it with Ethernet cable and I don't see a difference. Saw I was running an older node version, updated it, but still no difference. I'm running Node.js Version v18.12.1 now. Also just reinstalled the plugin, created a child bridge and everything without any succes... Could be a Telenet only related issue?

jsiegenthaler commented 1 year ago

@GillesWi Is the accessory visible in the Home app screen Select an Accessory to Add to Homename? If it is, then the accessory exists and it's details are being broadcast by mDNS. That's nothing to do with Telenet. If you can progress to the Connecting to Set-Top Box step and then received the error Unable to Add Accessory - Accessory is not reachable then this is a clear sign that Homebridge is not broadcasting the HAP data to the Home Hub. The Home Hub cannot reach the accessory. That's a local LAN networking issue. That's nothing to do with Telenet.

GillesWi commented 1 year ago

No, the accessory is not visible there. I just get the spinning wheel. When clicking on "my accessory isn't shown here" and filling in the setup code its just not finding it.

jsiegenthaler commented 1 year ago

It may already exist as a paired accessory. Check the Homebridge cache. Clear any existing entries for the accessory. Homebridge Settings > Reset > Unpair Bridges / Cameras / TVs / External Accessories. Delete only the set-top box if found.

GillesWi commented 1 year ago

Because I had some problems with HKSV also, I just removed all my HomePods, Apple TV and set them up again. Now everything is working again! It was indeed a cache problem.

Also, a question. Is it difficult for you to create an option in the plugin to disable the log on startup, then its maybe easier to find error messages in the future.

jsiegenthaler commented 1 year ago

Hi, Thanks for the good news! I am reworking my debug concept, its always a balance between too much and too little logging...