peterbuga / HASS-sonoff-ewelink

Home Assistant component to control Sonoff/eWeLink devices with original firmware
MIT License
792 stars 296 forks source link

https://eu-api.coolkit.cc:8080/api gives 503 Service Temporarily Unavailable #269

Open stefanbesteman-weareyou opened 3 years ago

stefanbesteman-weareyou commented 3 years ago

delete this template text while filling your issue/request but before that please check if:

jcdlca commented 3 years ago

Hi peterbuga,

I think I have the same problem than stefanbesteman..

I use home assistant version 0.101.3 with the lattest version of HASS-sonoff-ewelink (HASS-sonoff-ewelink-0.3.3.tar.gz) installed. It was working perfectly but yesterday it begins to fail.. It retrieves all sensor data perfect, but if I try to switch on / off.... It does not work and home assisstant log shows the next message:

2020-10-30 23:49:02 ERROR (Thread-2) [custom_components.sonoff] websocket error: Connection is already closed.

I am going to try install this in the lattest home assistant version with the patch that I have seen are needed in init.py code..

Thank you very much.

This service is very ussefull..

Kind regards, Juan Carlos

jcdlca commented 3 years ago

I have tried in home assisstant 0.115.3 with the change that I have seen in other issue.. but now in this server the log shows:

2020-10-31 00:12:57 WARNING (MainThread) [homeassistant.util.async_] Detected I/O inside the event loop. This is causing stability issues. Please report issue to the custom component author for sonoff doing I/O at custom_components/sonoff/init.py, line 372: r = requests.get('https://{}-api.coolkit.cc:8080/api/user/device?lang=en&apiKey={}&getTags=1&version=6&ts=%s&nonce=%s&appid=oeVkj2lYFGnJu5XUtWisfW4utiN4u9Mq&imei=%s&os=iOS&model=%s&romVersion=%s&appVersion=%s'.format(
2020-10-31 00:13:01 ERROR (Thread-3) [custom_components.sonoff] websocket error: Connection is already closed

Is anyone that has the same problem?.

Kind regards, Juan Carlos

cris88 commented 3 years ago

Hello, I have the same issue than @jcdlca .

"websocket error: Connection is already closed."

jcdlca commented 3 years ago

Hi @cris88,

I am testing with https://github.com/AlexxIT/SonoffLAN and It works well. There are few changes to work with the configuration of HASS-sonoff-ewelink.

Kind regards, Juan Carlos

sarbumarius commented 3 years ago

@cris88 @jcdlca in init.py from custom_components/sonoff/ at line 605 you need to add appid and imei, change de payload with this

    payload = {
        'action'    : "userOnline",
        'userAgent' : 'app',
        'version'   : 6,
        'nonce'     : ''.join(random.choice(string.ascii_lowercase + string.digits) for _ in range(8)),
        'apkVersion': "1.8",
        'os'        : 'iOS',
        'at'        : self._sonoff.get_bearer_token(),
        'apikey'    : self._sonoff.get_user_apikey(),
        'ts'        : str(int(time.time())),
        'model'     : self._sonoff.get_model(),
        'romVersion': self._sonoff.get_romVersion(),
        'sequence'  : str(time.time()).replace('.',''),
        'appid'     : 'oeVkj2lYFGnJu5XUtWisfW4utiN4u9Mq', 
        'imei'      : 'a6372777-890f-4dea-8fd0-4fb29fa4982f'
    }
cris88 commented 3 years ago

@sarbumarius it works! Thank you!!

vldfr commented 3 years ago

@cris88 @jcdlca in init.py from custom_components/sonoff/ at line 605 you need to add appid and imei, change de payload with this

    payload = {
        'action'    : "userOnline",
        'userAgent' : 'app',
        'version'   : 6,
        'nonce'     : ''.join(random.choice(string.ascii_lowercase + string.digits) for _ in range(8)),
        'apkVersion': "1.8",
        'os'        : 'iOS',
        'at'        : self._sonoff.get_bearer_token(),
        'apikey'    : self._sonoff.get_user_apikey(),
        'ts'        : str(int(time.time())),
        'model'     : self._sonoff.get_model(),
        'romVersion': self._sonoff.get_romVersion(),
        'sequence'  : str(time.time()).replace('.',''),
        'appid'     : 'oeVkj2lYFGnJu5XUtWisfW4utiN4u9Mq', 
        'imei'      : 'a6372777-890f-4dea-8fd0-4fb29fa4982f'
    }

This is perfect, works instantly! what i did: Modified and saved the file with HA running and then restarted HA and works perfectly!

iosoft commented 3 years ago

'appid' : 'oeVkj2lYFGnJu5XUtWisfW4utiN4u9Mq', 'imei' : 'a6372777-890f-4dea-8fd0-4fb29fa4982f'

Just for my general knowledge, whose appid and imei is this?

zalcock commented 3 years ago

'appid' : 'oeVkj2lYFGnJu5XUtWisfW4utiN4u9Mq', 'imei' : 'a6372777-890f-4dea-8fd0-4fb29fa4982f'

Who's app id is this and how will i find mine

josrafafonlo commented 3 years ago

@cris88 @jcdlca in init.py from custom_components/sonoff/ at line 605 you need to add appid and imei, change de payload with this

    payload = {
        'action'    : "userOnline",
        'userAgent' : 'app',
        'version'   : 6,
        'nonce'     : ''.join(random.choice(string.ascii_lowercase + string.digits) for _ in range(8)),
        'apkVersion': "1.8",
        'os'        : 'iOS',
        'at'        : self._sonoff.get_bearer_token(),
        'apikey'    : self._sonoff.get_user_apikey(),
        'ts'        : str(int(time.time())),
        'model'     : self._sonoff.get_model(),
        'romVersion': self._sonoff.get_romVersion(),
        'sequence'  : str(time.time()).replace('.',''),
        'appid'     : 'oeVkj2lYFGnJu5XUtWisfW4utiN4u9Mq', 
        'imei'      : 'a6372777-890f-4dea-8fd0-4fb29fa4982f'
    }

It seems to not be working anymore, anytime I add the lines, however I do it, hass hangs on initializing