petro-kushchak / homebridge-ch-ac-eve

MIT License
1 stars 5 forks source link

Exception when using with Cooper&Hunter AC #5

Open nobugsincode opened 1 year ago

nobugsincode commented 1 year ago

Trying to use this plugin with Cooper&Hunter AC. But when I try to enable the AC I'm getting an error:

This plugin threw an error from the characteristic 'Active': Unhandled error thrown inside write handler for characteristic: Port should be > 0 and < 65536. Received 0..

Se seems like the plugin can't discover the AC probably. Any advice?

petro-kushchak commented 1 year ago

Hi, could you share you plugin configuration json?

nobugsincode commented 1 year ago

@petro-kushchak sure, here it is:

{
        "name": "Cooper&HunterAC",
        "model": "CH-S09FTXE WIFI",
        "serial": "ch-00-00-01",
        "host": "192.168.72.5",
        "updateInterval": 10000,
        "accessory": "Cooper&HunterAC"
}
petro-kushchak commented 1 year ago

Seems to be fine, is there anything else in the logs except this error? I suspect that there is some connection issue from plugin to your C&H AC...

Can you grab plugin initial logs by restarting Homebridge and running something like sudo hb-service logs | grep Cooper ?

Thanks

nobugsincode commented 1 year ago

@petro-kushchak here are the logs:

[6/26/2023, 3:34:41 PM] Registering accessory '@petro-kushchak/homebridge-ch-ac-eve.Cooper&HunterAC'
[6/26/2023, 3:34:41 PM] [Cooper&HunterAC] Initializing Cooper&HunterAC accessory...
[6/26/2023, 3:34:42 PM] [Cooper&HunterAC] Started discover device 192.168.72.5
[6/26/2023, 3:34:42 PM] [Cooper&HunterAC] Connecting new C&H AC device
[6/26/2023, 3:34:42 PM] [Cooper&HunterAC] host: 192.168.72.5
[6/26/2023, 3:34:42 PM] [Cooper&HunterAC] port: 8005
[6/26/2023, 3:34:42 PM] [Cooper&HunterAC] Setting up HTTP server on port 4567...
[6/26/2023, 3:34:43 PM] [Cooper&HunterAC] Sent scan message to identify devices

and when I've tried to start the AC I've got:

[6/26/2023, 3:38:10 PM] [Cooper&HunterAC] Triggered SET ThermostatActive: true
[6/26/2023, 3:38:10 PM] [@petro-kushchak/homebridge-ch-ac-eve] This plugin threw an error from the characteristic 'Active': Unhandled error thrown inside write handler for characteristic: Port should be > 0 and < 65536. Received 0.. See https://homebridge.io/w/JtMGR for more info.

Seems like the discovery device step isn't completed but no error message in the logs though.

nobugsincode commented 1 year ago

btw why is the device port set in quite random way?

petro-kushchak commented 1 year ago

Port selection originally implemented here: https://github.com/norberttech/homebridge-ch-ac/blob/master/app/deviceFactory.js

Looks like your Cooper&Hunter AC uses different logic for port. We can try to fallback to port 7000 like in original GREE plugin: https://github.com/ddenisyuk/homebridge-gree-heatercooler/blob/master/app/deviceFactory.js

I will add "device port" option to the plugin and release alpha build, so you could try different options

nobugsincode commented 1 year ago

Thanks a lot @petro-kushchak 👍 Will wait for the new version

petro-kushchak commented 1 year ago

@nobugsincode, I've published @petro-kushchak/homebridge-ch-ac-eve@1.0.21 with optional acPort which you can use to set your AC custom port (try 7000 as default port used in original GREE plugin)

Follow this guide for installing beta plugin: https://github.com/homebridge/homebridge/wiki/How-to-Install-Alternate-Plugin-Versions

nobugsincode commented 1 year ago

@petro-kushchak thanks for your efforts. Unfortunately port 7000 didn't help :( The result is still the same: I see the messages that message to discover devices sent but nothing more :(

petro-kushchak commented 1 year ago

well, try to use this script to check if your AC is responding:

https://github.com/tomikaa87/gree-remote/blob/master/PythonCLI/gree.py

Based on docs should be something like:

python gree.py search

nobugsincode commented 1 year ago

@petro-kushchak no luck :(

Search finished, found 0 device(s)

Probably my Wi-Fi module uses different port maybe...

petro-kushchak commented 1 year ago

In my case I get:

❯ python3 gree.py search --broadcast 192.168.1.255
Searching for devices using broadcast address: 192.168.1.255
Search finished, found 1 device(s)
Binding device: 192.168.1.44

Try to google/investigate wifi config for your AC

petro-kushchak commented 1 year ago

@nobugsincode I did some additional research (had to connect another one AC at home) and looks like latest Cooper&Hunter ACs does not send full information needed for this plugin (some device IDs and names).

If you reset/reconnect your AC to Wifi, and running gree.py finds your device, try to use this plugin platform:

@petro-kushchak/homebridge-ch-gree-ac-eve-platform@1.0.10-beta.0

nobugsincode commented 1 year ago

@petro-kushchak thanks a lot for your efforts. Still no luck though. Plugin you've mentioned causing an error:

No plugin was found for the platform "GreeACPlatformWithWebHooks" in your config.json. Please make sure the corresponding plugin is installed correctly.

Btw I don't see 1.0.10-beta.0 version available, only 1.0.1

petro-kushchak commented 1 year ago

Make sure you have installed correct plugin: @petro-kushchak/homebridge-ch-gree-ac-eve-platform

If plugin is correct, try to get latest version (v1.0.10-beta.0) using guide for installing beta plugin: https://github.com/homebridge/homebridge/wiki/How-to-Install-Alternate-Plugin-Versions

nobugsincode commented 1 year ago

@petro-kushchak yeah, now the plugin is correct. So now I have the following logs:

[7/10/2023, 3:59:50 PM] [Gree ACs] Initializing ChGreeACPlatformWithWebHooks platform...
[7/10/2023, 3:59:50 PM] [Gree ACs] Setting up HTTP server on port 4567...

That's it. And no devices in the Home app as well.

petro-kushchak commented 1 year ago

@nobugsincode weird, so gree.py search can find your AC? Can you run it in verbose mode and paste output here?

nobugsincode commented 1 year ago

@petro-kushchak unfortunately it can't find anything despite the fact I have 3 ACs in the network... Seems like the WiFi module works in a different way but I can't understand what's the manufacturer and model of it