aurc / melview-mitsubishi-au-nz

Apache License 2.0
9 stars 5 forks source link

Plugin Fails to Load - Error message: [MitsubishiAUNZ] Failed to process platform discovery. Fix the problem and restart the service. (seems to be similar problem to issue #6, but I am in NZ) #8

Open skc666 opened 2 years ago

skc666 commented 2 years ago

Hi, Thanks for your plugin - I am having an issue at the moment and would appreciate some help if you have time.

On restarting homebridge I recieve an Error [MitsubishiAUNZ] Failed to process platform discovery. Fix the problem and restart the service. And the plugin fails to load.

I have multiple units in the house, all are pingable from the computer with homebridge installed, all are controlable through the Mitsubishi iOS App

Logs:

-----snip ----- sensitive information changed to *****

[7/21/2022, 8:11:42 PM] [Homebridge UI] Homebridge restart request received [7/21/2022, 8:11:42 PM] [Homebridge UI] UI / Bridge settings have not changed; only restarting Homebridge process [7/21/2022, 8:11:42 PM] [Homebridge UI] Sending SIGTERM to Homebridge [7/21/2022, 8:11:42 PM] Got SIGTERM, shutting down Homebridge... [7/21/2022, 8:11:42 PM] [WizSmarthome] [Socket] Shutting down socket [7/21/2022, 8:11:47 PM] [HB Supervisor] Homebridge Process Ended. Code: 143, Signal: null [7/21/2022, 8:11:52 PM] [HB Supervisor] Restarting Homebridge... [7/21/2022, 8:11:52 PM] [HB Supervisor] Starting Homebridge with extra flags: -I -D [7/21/2022, 8:11:52 PM] [HB Supervisor] Started Homebridge v1.5.0 with PID: 9546 [7/21/2022, 8:11:52 PM] Loaded config.json with 0 accessories and 3 platforms. [7/21/2022, 8:11:52 PM] Loaded 4 cached accessories from cachedAccessories. [7/21/2022, 8:11:52 PM] --- npm WARN config global --global, --local are deprecated. Use --location=global instead. [7/21/2022, 8:11:53 PM] Loaded plugin: homebridge-airconditioner-mitsubishi-au-nz@1.2.6 [7/21/2022, 8:11:53 PM] Registering platform 'homebridge-airconditioner-mitsubishi-au-nz.MitsubishiAUNZ' [7/21/2022, 8:11:53 PM] --- [7/21/2022, 8:11:53 PM] Loaded plugin: homebridge-config-ui-x@4.50.0 [7/21/2022, 8:11:53 PM] Registering platform 'homebridge-config-ui-x.config' [7/21/2022, 8:11:53 PM] --- [7/21/2022, 8:11:53 PM] Loaded plugin: homebridge-wiz-lan@3.2.1 [7/21/2022, 8:11:53 PM] Registering platform 'homebridge-wiz-lan.WizSmarthome' [7/21/2022, 8:11:53 PM] --- [7/21/2022, 8:11:53 PM] Loading 3 platforms... [7/21/2022, 8:11:53 PM] [WizSmarthome] Initializing WizSmarthome platform... [7/21/2022, 8:11:53 PM] [MitsubishiAUNZ] Initializing MitsubishiAUNZ platform... [7/21/2022, 8:11:53 PM] [MitsubishiAUNZ] Finished initializing platform [7/21/2022, 8:11:53 PM] [MitsubishiAUNZ] Service Instantiated! [7/21/2022, 8:11:53 PM] [WizSmarthome] Loading accessory from cache: Wiz Tunable White Bulb **** [7/21/2022, 8:11:53 PM] [WizSmarthome] [Adaptive Lighting] Initializing adaptive lighting for **** [7/21/2022, 8:11:53 PM] [WizSmarthome] Loading accessory from cache: Wiz Tunable White Bulb **** [7/21/2022, 8:11:53 PM] [WizSmarthome] [Adaptive Lighting] Initializing adaptive lighting for **** [7/21/2022, 8:11:53 PM] [WizSmarthome] Loading accessory from cache: Wiz Tunable White Bulb **** [7/21/2022, 8:11:53 PM] [WizSmarthome] [Adaptive Lighting] Initializing adaptive lighting for **** [7/21/2022, 8:11:53 PM] [WizSmarthome] Loading accessory from cache: Wiz Tunable White Bulb **** [7/21/2022, 8:11:53 PM] [WizSmarthome] [Adaptive Lighting] Initializing adaptive lighting for **** [7/21/2022, 8:11:53 PM] [WizSmarthome] Executed didFinishLaunching callback [7/21/2022, 8:11:53 PM] [WizSmarthome] [Socket] Setting up socket on 192.168.1.177:38900 [7/21/2022, 8:11:53 PM] [MitsubishiAUNZ] Executed didFinishLaunching callback [7/21/2022, 8:11:53 PM] Publishing bridge accessory (name: Homebridge 0679, publishInfo: { username: ':::::', port: 51857, pincode: '*-*-', category: 2, bind: undefined, mdns: undefined, addIdentifyingMaterial: true, advertiser: undefined }). Setup Payload:

Enter this code with your HomeKit app on your iOS device to pair with Homebridge:

┌────────────┐     
│ ***-**-*** │     
└────────────┘     

[7/21/2022, 8:11:53 PM] [WizSmarthome] [Socket] Socket Bound: UDP IPv4 listening on 192.168.1.177:38900 [7/21/2022, 8:11:53 PM] [WizSmarthome] [Discovery] Initiating discovery handlers [7/21/2022, 8:11:53 PM] [WizSmarthome] [Discovery] Sending discovery UDP broadcast to 255.255.255.255:38899 [7/21/2022, 8:11:53 PM] Homebridge v1.5.0 (HAP v0.10.2) (Homebridge 0679) is running on port 51857. [7/21/2022, 8:11:53 PM] [MitsubishiAUNZ] Failed to process platform discovery. Fix the problem and restart the service. [7/21/2022, 8:11:53 PM] [MitsubishiAUNZ] SyntaxError: Unexpected token T in JSON at position 0 at JSON.parse () at MelviewService.discover (/usr/local/lib/node_modules/homebridge-airconditioner-mitsubishi-au-nz/src/melviewService.ts:80:30) at processTicksAndRejections (node:internal/process/task_queues:96:5) at MelviewMitsubishiHomebridgePlatform.discoverDevices (/usr/local/lib/node_modules/homebridge-airconditioner-mitsubishi-au-nz/src/platform.ts:71:19) [7/21/2022, 8:11:54 PM] [WizSmarthome] [getPilot] Sending getPilot to **** [7/21/2022, 8:11:54 PM] [WizSmarthome] [getPilot] Sending getPilot to **** [7/21/2022, 8:11:54 PM] [WizSmarthome] [getPilot] Sending getPilot to **** [7/21/2022, 8:11:54 PM] [WizSmarthome] [getPilot] Sending getPilot to **** [7/21/2022, 8:11:54 PM] [WizSmarthome] [Socket] [192.168.1.245:38899] Received message: {"method":"getPilot","env":"pro","result":{"mac":"****","rssi":-85,"src":"","state":true,"sceneId":6,"dimming":100}} [7/21/2022, 8:11:54 PM] [WizSmarthome] [Socket] [192.168.1.198:38899] Received message: {"method":"getPilot","env":"pro","result":{"mac":"****","rssi":-55,"src":"","state":false,"sceneId":0,"temp":4500,"dimming":100}} [7/21/2022, 8:11:54 PM] [WizSmarthome] [Socket] [192.168.1.150:38899] Received message: {"method":"getPilot","env":"pro","result":{"mac":"****","rssi":-53,"src":"","state":false,"sceneId":0,"temp":4500,"dimming":100}} [7/21/2022, 8:11:54 PM] [WizSmarthome] [Socket] [192.168.1.27:38899] Received message: {"method":"getPilot","env":"pro","result":{"mac":"****","rssi":-49,"src":"","state":false,"sceneId":0,"temp":4500,"dimming":100}}

Plugin Config:

{ "bridge": { "name": "Homebridge 0679", "username": ":::::", "port": 51857, "pin": "*-*-" }, "accessories": [], "platforms": [ { "name": "Config", "port": 8581, "auth": "form", "theme": "auto", "tempUnits": "c", "lang": "auto", "platform": "config" }, { "platform": "WizSmarthome", "name": "WizSmarthome" }, { "user": "@..", "password": "****", "dry": false, "platform": "MitsubishiAUNZ" } ], "disabledPlugins": [] }

klautusi commented 2 months ago

I am having the same issue. Also in New Zealand. Source of the issue also looks like:

Unexpected token T in JSON at position 0

Any word on when this could be looked at? Anything i can do to help?

klautusi commented 2 months ago

I chucked some logging in to where the error is coming from. It is not JSON (as per the error) and what is being returned is: "The service is unavailable."

Any thoughts about what to do next? I am happy to help if it is useful. I have pretty good JS chops, though never done any homebridge dev before

klautusi commented 2 months ago

Looks like auth is silently failing. What is attempting to be written as headers in this.prepareHeaders() is:

{
    "User-Agent":"Mozilla/5.0 (Windows NT 10.0; WOW64; rv:54.0) Gecko/20100101 Firefox/54.0",
    "Content-Type":"application/json",
    "cookie":"auth="
}

I assume you are expecting an auth token to come in the cookies? this is what cookies returned looks like:
'auth=; domain=.melview.net; expires=Mon, 11-Oct-1999 11:00:00 GMT; path=/; secure; SameSite=None'

klautusi commented 2 months ago

Ok after a bunch of messing around, it looks like the issue is at Mitsubishis end. For anyone still experiencing this issue, go here and try to log in: https://app.melview.net/login.html

You will likely also not be able to login. And if you are a nerd you can also check out the response headers and see there is no auth token returned. I also noticed my wife was unable to login to the app while this was an issue (but my phone, already logged in, continued to work)

The way to fix it is reset your password. You will be sent a temporary password that will let you login to your app again and then ask you to reset to a non temp one. You can just set it back to your original password at this point.

Login through the site, and through any phone no longer working will start to work again, and this will mean homebridge will start to work again 😅