moifort / homebridge-create-fan

Connect your create ceiling fan into homekit
Apache License 2.0
8 stars 4 forks source link

Error : Error: Error from socket: read ECONNRESET #18

Open ThibaultTourailles opened 4 months ago

ThibaultTourailles commented 4 months ago

Connection to the ceiling fan is not properly working. In the log, there's a notification that connection has been reset. I've followed the steps in https://github.com/jasonacox/tinytuya/tree/master#setup-wizard---getting-local-keys, I managed to get the keys. I managed to test the fetched information with this python script:

import tinytuya

# Connect to Device
d = tinytuya.OutletDevice(
    dev_id='<DEVICE_ID>',
    address='<IP_ADDRESS>',
    local_key="<LOCAL_KEY>",
    version=3.4)

data = d.set_status(True, 20)
if data:
    print('set_status() result %r' % data)

And it turned the light on.

Logs:

[7/2/2024, 2:43:40 PM] [Create Ceiling Fan] Error : Error: Error from socket: read ECONNRESET
    at Socket.<anonymous> (/usr/local/lib/node_modules/homebridge-create-ceiling-fan/node_modules/tuyapi/index.js:651:26)
    at Socket.emit (node:events:520:28)
    at emitErrorNT (node:internal/streams/destroy:170:8)
    at emitErrorCloseNT (node:internal/streams/destroy:129:3)
    at processTicksAndRejections (node:internal/process/task_queues:82:21)
[7/2/2024, 2:43:40 PM] [Create Ceiling Fan] Try to connect
[7/2/2024, 2:43:40 PM] [Create Ceiling Fan] Connecting...
[7/2/2024, 2:43:40 PM] [Create Ceiling Fan] Connected
[7/2/2024, 2:43:40 PM] [Create Ceiling Fan] Disconnected... Try to connect
[7/2/2024, 2:43:40 PM] [Create Ceiling Fan] Connecting...
[7/2/2024, 2:43:40 PM] [Create Ceiling Fan] Connected
[7/2/2024, 2:43:40 PM] [Create Ceiling Fan] Error : Error: Error from socket: read ECONNRESET
    at Socket.<anonymous> (/usr/local/lib/node_modules/homebridge-create-ceiling-fan/node_modules/tuyapi/index.js:651:26)
    at Socket.emit (node:events:520:28)
    at emitErrorNT (node:internal/streams/destroy:170:8)
    at emitErrorCloseNT (node:internal/streams/destroy:129:3)
    at processTicksAndRejections (node:internal/process/task_queues:82:21)

Plugin Config:

{
    "bridge": {
        "name": "Homebridge C2C7",
        "username": "<USERNAME>",
        "port": 51274,
        "pin": "<PIN>",
        "advertiser": "bonjour-hap"
    },
    "accessories": [],
    "platforms": [
        {
            "name": "Config",
            "port": 8581,
            "platform": "config"
        },
        {
            "name": "Create Ceiling Fan",
            "devices": [
                {
                    "id": "<SAME_ID_AS_PYTHON_SCRIPT>",
                    "key": "<SAME_KEY_AS_PYTHON_SCRIPT>",
                    "ip": "<SAME_IP_AS_PYTHON_SCRIPT>",
                    "version": "3.4",
                    "name": "Ceiling Fan",
                    "hasLight": true
                }
            ],
            "platform": "HomebridgeCreateCeilingFan"
        }
    ]
}

Environment:

Pi88no commented 3 months ago

It worked for two days, but today I also get this error message.

 [7/16/2024, 12:55:44 PM] [Deckenventilator] Error : Error: Error from socket: read ECONNRESET
    at Socket.<anonymous> (/usr/local/lib/node_modules/homebridge-create-ceiling-fan/node_modules/tuyapi/index.js:651:26)
    at Socket.emit (node:events:519:28)
    at emitErrorNT (node:internal/streams/destroy:169:8)
    at emitErrorCloseNT (node:internal/streams/destroy:128:3)
    at processTicksAndRejections (node:internal/process/task_queues:82:21)
[7/16/2024, 12:55:44 PM] [Deckenventilator] Try to connect
[7/16/2024, 12:55:44 PM] [Deckenventilator] Connecting...
[7/16/2024, 12:55:44 PM] [Deckenventilator] Connection failed Error: read ECONNRESET
    at TCP.onStreamRead (node:internal/stream_base_commons:218:20) {
  errno: -54,
  code: 'ECONNRESET',
  syscall: 'read'
}
[7/16/2024, 12:55:44 PM] [Deckenventilator] Retry in 1 minute
RedJohn14 commented 2 months ago

I get exact the same error today. Plugin not working.