树莓派HomeBridge eWeLink插件WebSocketClient报200响应异常求助
Hey there, let's work through this problem step by step—those undefined device values and WebSocket unexpected server response (200) errors are usually tied to outdated plugin versions or incorrect regional configuration. Here's what to do:
1. Verify Your eWeLink Regional Configuration
First, check your HomeBridge config.json file (usually located at ~/.homebridge/config.json). The eWeLink plugin needs the correct region matching your account's registered location:
- For European accounts: use
"region": "eu" - For Chinese accounts: use
"region": "cn" - For US accounts: use
"region": "us" - For other regions: try
"region": "as"(Asia) or"region": "oc"(Oceania)
If you don't specify a region, the plugin might guess incorrectly (like it did with eu-ota.coolkit.cc in your log), leading to failed API calls and undefined data.
2. Update the eWeLink Plugin to the Latest Stable Version
The version you're using (circa 2018) is likely incompatible with eWeLink's updated API endpoints. Uninstall the old version and install the latest one:
sudo npm uninstall -g homebridge-ewelink sudo npm install -g homebridge-ewelink@latest
Newer versions automatically handle the correct API/WebSocket endpoints for your region, fix the API key retrieval issue, and properly parse device data.
3. Validate Your eWeLink Credentials
Double-check that your config.json has the correct eWeLink username and password. Avoid special characters that might cause parsing issues—if you have them, try changing your password temporarily to test.
Example config.json snippet for eWeLink:
"platforms": [ { "platform": "eWeLink", "name": "eWeLink", "username": "your-ewelink-email", "password": "your-ewelink-password", "region": "eu" } ]
4. Clear the Local Cache
Your log mentions loading 0 accessories from the local cache—corrupted cache data might be causing issues. Delete the cache file:
rm ~/.homebridge/ewelinkCache.json
Restart HomeBridge after deleting this file, and the plugin will re-fetch fresh device data from eWeLink's API.
5. Restart HomeBridge and Check Logs
After making these changes, restart HomeBridge:
sudo systemctl restart homebridge # Or if you're running it directly: homebridge -D
Check the logs again—you should see the plugin successfully fetch your devices (no more undefined values), retrieve a valid API key, and connect to the WebSocket without the 200 error.
内容的提问来源于stack exchange,提问作者stehof

