dxdc / homebridge-blinds

:sunrise: Homebridge Plugin to control my blinds over HTTP
https://www.npmjs.com/package/homebridge-blinds
ISC License
54 stars 26 forks source link

Error sending request (HTTP status code not defined #80

Closed barzoock closed 10 months ago

barzoock commented 10 months ago

I have several blinds, I refer to only one so that it can be read clearly. Also, I use "xxx" where it has private information.

[12/3/2023, 5:50:06 PM] [Bar Blind] Requested TargetPosition: 0%
[12/3/2023, 5:50:06 PM] [Bar Blind] Requested CurrentPosition: 0%
[12/3/2023, 5:50:09 PM] [Bar Blind] Requested Move up (to 2%)
[12/3/2023, 5:50:10 PM] [Bar Blind] Requested Move up (to 15%)
[12/3/2023, 5:50:29 PM] [Bar Blind] Error sending request (HTTP status code not defined): Error: connect ECONNREFUSED xxx:80
[12/3/2023, 5:50:29 PM] [Bar Blind] 5 / 5 attempts failed after 20077 ms
[12/3/2023, 5:50:29 PM] [Bar Blind] Body: undefined
[12/3/2023, 5:50:30 PM] [Bar Blind] Error sending request (HTTP status code not defined): Error: connect ECONNREFUSED xxx:80
[12/3/2023, 5:50:30 PM] [Bar Blind] 5 / 5 attempts failed after 20221 ms
[12/3/2023, 5:50:30 PM] [Bar Blind] Body: undefined

Here's the config:

{
    "name": "Bar Blind",
    "up_url": {
        "url": "http://xxx/v2/devices/xxx/actions/Open",
        "method": "PUT",
        "headers": {
            "BOND-Token": "xxx"
        },
        "body": "{}"
    },
    "down_url": {
        "url": "http://xxx/v2/devices/xxx/actions/Close",
        "method": "PUT",
        "headers": {
            "BOND-Token": "xxx"
        },
        "body": "{}"
    },
    "motion_time_graph": {
        "up": [
            {
                "pos": 0,
                "seconds": 0
            },
            {
                "pos": 1,
                "seconds": 9.05
            },
            {
                "pos": 100,
                "seconds": 25.075
            }
        ],
        "down": [
            {
                "pos": 100,
                "seconds": 0
            },
            {
                "pos": 1,
                "seconds": 15
            },
            {
                "pos": 0,
                "seconds": 23.3
            }
        ]
    },
    "show_toggle_button": false,
    "verbose": true,
    "stop_url": {
        "url": "http://xxx/v2/devices/xxx/actions/Hold",
        "method": "PUT",
        "headers": {
            "BOND-Token": "xxx"
        },
        "body": "{}"
    },
    "show_stop_button": true,
    "trigger_stop_at_boundaries": false,
    "response_lag_ms": 1000,
    "http_success_codes": [
        200,
        204
    ],
    "show_favorite_buttons": [
        1
    ],
    "accessory": "BlindsHTTP"
}
          @barzoock please open a new issue, and post your complete config as well as logs with verbose enabled. e.g.,
        "verbose": true,
        "accessory": "BlindsHTTP"

Given that yours is the only report, it sounds like an issue with your http endpoint and not the plugin, but the logs and config will reveal what is happening.

Originally posted by @dxdc in https://github.com/dxdc/homebridge-blinds/issues/69#issuecomment-1837511798

dxdc commented 10 months ago

Your endpoint API is rejecting the request, which is strange. Are you using Bond (based on your config, it appears you are)? I'm wondering if your HB device has intermittent network connectivity.

Error: connect ECONNREFUSED xxx:80

barzoock commented 10 months ago

Your endpoint API is rejecting the request, which is strange. Are you using Bond (based on your config, it appears you are)? I'm wondering if your HB device has intermittent network connectivity.

Error: connect ECONNREFUSED xxx:80

The HB server is stable, and I've set up Bond with a static IP. This ensures that the plugin consistently connects to the same IP and functions properly. Despite resetting the internet several times, this issue wasn't resolved. However, switching to DHCP and using a different IP seemed to work. Consequently, I configured a static IP directly in the internet modem. Now, everything is functioning smoothly, and the IP remains constant. I will continue to monitor the setup over the next few days to confirm its stability.

dxdc commented 10 months ago

Thanks for following up @barzoock. Please feel free to re-open this issue if needed. Note that you can also customize the retry (see the documentation) which may help in your case if you have further issues.