peterbuga / HASS-sonoff-ewelink

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

Can't get working on HA 0.110.4 #243

Open ciandial opened 4 years ago

ciandial commented 4 years ago

I can't get this working on latest Home assistant 0.110.4 with default configuration.yaml file I copy paste your sonoff entry and fill my account credentials Configuration validation passing OK I use HA installed on PC. The error I get on web interface notify is not informative:

Invalid config The following integrations and platforms could not be set up:

sonoff Please check your config.

johnjoemorgan commented 4 years ago

Please post your config exactly as you have it

On Fri, 5 Jun 2020, 06:44 ciandial, notifications@github.com wrote:

I can't get this working on latest Home assistant 0.110.4 with default configuration.yaml file I copy paste your sonoff entry and fill my account credentials Configuration validation passing OK The error I get on web interface notify is not informative: Invalid config The following integrations and platforms could not be set up:

sonoff Please check your config.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/peterbuga/HASS-sonoff-ewelink/issues/243, or unsubscribe https://github.com/notifications/unsubscribe-auth/AK5MTVSWYFA7YKDL2NXXHODRVAPTHANCNFSM4NTBI76A .

ciandial commented 4 years ago
# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:

# Text to speech
tts:
  - platform: google_translate

group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml

sonoff:
  username: user.mail@mail.com
  password: password
  scan_interval: 60 #(optional, lower values than 60 won't work anymore!)
  grace_period: 600 #(optional)
  api_region: 'eu' #(optional)
  entity_prefix: True #(optional)
  debug: False #(optional)
ciandial commented 4 years ago

found home-assistant.log I have home assistant installed on Windows 10 pc

2020-06-05 13:46:54 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for sonoff which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant.
2020-06-05 13:46:56 ERROR (MainThread) [homeassistant.setup] Error during setup of component sonoff
Traceback (most recent call last):
  File "c:\users\tetris\appdata\local\programs\python\python38-32\lib\site-packages\homeassistant\setup.py", line 170, in _async_setup_component
    result = await component.async_setup(  # type: ignore
  File "C:\Users\Tetris\AppData\Roaming\.homeassistant\custom_components\sonoff\__init__.py", line 53, in async_setup
    hass.data[DOMAIN] = Sonoff(hass, config)
  File "C:\Users\Tetris\AppData\Roaming\.homeassistant\custom_components\sonoff\__init__.py", line 100, in __init__
    self.do_login()
  File "C:\Users\Tetris\AppData\Roaming\.homeassistant\custom_components\sonoff\__init__.py", line 175, in do_login
    r = requests.post('https://{}-api.coolkit.cc:8080/api/user/login'.format(self._api_region),
  File "c:\users\tetris\appdata\local\programs\python\python38-32\lib\site-packages\requests\api.py", line 119, in post
    return request('post', url, data=data, json=json, **kwargs)
  File "c:\users\tetris\appdata\local\programs\python\python38-32\lib\site-packages\requests\api.py", line 61, in request
    return session.request(method=method, url=url, **kwargs)
  File "c:\users\tetris\appdata\local\programs\python\python38-32\lib\site-packages\requests\sessions.py", line 530, in request
    resp = self.send(prep, **send_kwargs)
  File "c:\users\tetris\appdata\local\programs\python\python38-32\lib\site-packages\requests\sessions.py", line 643, in send
    r = adapter.send(request, **kwargs)
  File "c:\users\tetris\appdata\local\programs\python\python38-32\lib\site-packages\requests\adapters.py", line 439, in send
    resp = conn.urlopen(
  File "C:\Users\Tetris\AppData\Roaming\.homeassistant\deps\Python38\site-packages\urllib3\connectionpool.py", line 670, in urlopen
    httplib_response = self._make_request(
  File "C:\Users\Tetris\AppData\Roaming\.homeassistant\deps\Python38\site-packages\urllib3\connectionpool.py", line 392, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "c:\users\tetris\appdata\local\programs\python\python38-32\lib\http\client.py", line 1230, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "c:\users\tetris\appdata\local\programs\python\python38-32\lib\http\client.py", line 1241, in _send_request
    self.putrequest(method, url, **skips)
  File "C:\Users\Tetris\AppData\Roaming\.homeassistant\deps\Python38\site-packages\urllib3\connection.py", line 199, in putrequest
    return _HTTPConnection.putrequest(self, method, url, *args, **kwargs)
  File "c:\users\tetris\appdata\local\programs\python\python38-32\lib\site-packages\homeassistant\util\async_.py", line 120, in protected_loop_func
    check_loop()
  File "c:\users\tetris\appdata\local\programs\python\python38-32\lib\site-packages\homeassistant\util\async_.py", line 91, in check_loop
    raise RuntimeError(
RuntimeError: Detected I/O inside the event loop. This is causing stability issues. Please report issue
ciandial commented 4 years ago

In result I get myself SonoffLAN from AlexxIT repo, works fine

lucasmendes commented 4 years ago

+1 Running fresh install of 0.110.5 in Windows with Python 3.8. Only installed this sonoff component.

configuration.yaml:

# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:

# Text to speech
tts:
  - platform: google_translate

group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml

sonoff:
  username: email@gmail.com
  password: ********
  scan_interval: 60 #(optional, lower values than 60 won't work anymore!)
  grace_period: 600 #(optional)
#  api_region: 'us' #(optional)

log:

2020-06-09 00:09:43 ERROR (MainThread) [homeassistant.setup] Error during setup of component sonoff
Traceback (most recent call last):
  File "C:\Users\lucas\AppData\Local\Programs\Python\Python38-32\lib\site-packages\homeassistant\setup.py", line 170, in _async_setup_component
    result = await component.async_setup(  # type: ignore
  File "C:\Users\lucas\AppData\Roaming\.homeassistant\custom_components\sonoff\__init__.py", line 53, in async_setup
    hass.data[DOMAIN] = Sonoff(hass, config)
  File "C:\Users\lucas\AppData\Roaming\.homeassistant\custom_components\sonoff\__init__.py", line 100, in __init__
    self.do_login()
  File "C:\Users\lucas\AppData\Roaming\.homeassistant\custom_components\sonoff\__init__.py", line 175, in do_login
    r = requests.post('https://{}-api.coolkit.cc:8080/api/user/login'.format(self._api_region),
  File "C:\Users\lucas\AppData\Local\Programs\Python\Python38-32\lib\site-packages\requests\api.py", line 119, in post
    return request('post', url, data=data, json=json, **kwargs)
  File "C:\Users\lucas\AppData\Local\Programs\Python\Python38-32\lib\site-packages\requests\api.py", line 61, in request
    return session.request(method=method, url=url, **kwargs)
  File "C:\Users\lucas\AppData\Local\Programs\Python\Python38-32\lib\site-packages\requests\sessions.py", line 530, in request
    resp = self.send(prep, **send_kwargs)
  File "C:\Users\lucas\AppData\Local\Programs\Python\Python38-32\lib\site-packages\requests\sessions.py", line 643, in send
    r = adapter.send(request, **kwargs)
  File "C:\Users\lucas\AppData\Local\Programs\Python\Python38-32\lib\site-packages\requests\adapters.py", line 439, in send
    resp = conn.urlopen(
  File "C:\Users\lucas\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib3\connectionpool.py", line 670, in urlopen
    httplib_response = self._make_request(
  File "C:\Users\lucas\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib3\connectionpool.py", line 392, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "C:\Users\lucas\AppData\Local\Programs\Python\Python38-32\lib\http\client.py", line 1240, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "C:\Users\lucas\AppData\Local\Programs\Python\Python38-32\lib\http\client.py", line 1251, in _send_request
    self.putrequest(method, url, **skips)
  File "C:\Users\lucas\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib3\connection.py", line 199, in putrequest
    return _HTTPConnection.putrequest(self, method, url, *args, **kwargs)
  File "C:\Users\lucas\AppData\Local\Programs\Python\Python38-32\lib\site-packages\homeassistant\util\async_.py", line 120, in protected_loop_func
    check_loop()
  File "C:\Users\lucas\AppData\Local\Programs\Python\Python38-32\lib\site-packages\homeassistant\util\async_.py", line 91, in check_loop
    raise RuntimeError(
RuntimeError: Detected I/O inside the event loop. This is causing stability issues. Please report issue
csalhammar commented 4 years ago

Isn’t this same as issue: Detected I/O inside the event loop #232

Tried async-patch branch? https://github.com/peterbuga/HASS-sonoff-ewelink/tree/async-patch

This solved it for me.

lucasmendes commented 4 years ago

Fixed with async-patch branch! Tks @csalhammar .