Sonoff /eWeLink component for original firmware

Open Web Interface , Goto Configuration/Customizations. Find your SonOff entity in a drop down box . Change Name attribute. Click Save.

I’m really enjoying the component. I’m trying to automate my Sonoff devices. I can switch them on and off manually. I’ve created an action, any advice on why it’s not working?

You need to use service “switch.turn_on”, “switch.turn_off” or “switch.toggle”.

EDIT: Now I wonder what kind of an usecase is “condition” as an action anyway. :thinking:

1 Like

This is the first time for me configuring automation. Using service action type worked. Thank you.

@peterbuga
Update fw for sonoff basic and 4chpro 3.3.0 --> 3.4.0 ok

@peterbuga, i have a hassio system in which i monitor my AC’s units energy consumption using some tp-link hs110 plugs and a sonoff pow r2.
I have forced a 1 sec scan interval to all entities using this automation:

`

  • id: update_tp_link
    initial_state: ‘on’
    trigger:
    • platform: time_pattern
      seconds: ‘/1’ # every 1 seconds
      action:
    • service: homeassistant.update_entity
      data:
      entity_id:
      • switch.fujitsu_asyg24klca
      • switch.daikin_atxc25b
      • switch.carrier_42qhb09d8sa
        `

This is working fine on tplinks.

Is there a way to have a similar result to the sonoff plug?
I know that there is a 60secs limitation to scan_interval.
Is it possible to remove this limitation?
As it is i have this really ugly and difficult to analyze result as you can see in the following picture of grafana where the really smooth blue line we can see an AC unit having a 1sec interval from a tplink plug, while with the orange line we can see the 60secs blocks coming from sonoff:


Thanks

hi @liakjim
1st of all the Pow R2 stopped actively reporting on firmwares 3.x+
2nd even if you still are on lower firmware and Pow R2 still works for you the changes in reported values are definitely not changing by second => i assume you’ll still have “blocky” reports (the scan_interval is used as a polling fallback mechanism when/if websocket fail, but even so read next…)
3rd it has been softly reported that iTead will soon-ish block the usage of this component and others alike based on its logic, so I guess it doesn’t make much sense to fix more of it (you’ll have to make peace with your OCD :stuck_out_tongue:) - the reason for this is I assume we killed their servers with possible thousands of “simulated apps” running 24/7, luckily some of the new firmwares have some kind of local controlling possibilities so it’s not all bad

Hi!

  1. No they didn’t. The screenshot i uploaded is from a pow r2 with 3.4.0 firmware.
  2. Same as 1.
  3. Interesting.

I have a sonoff wall switch which I trigger through my lights dashboard with switch on and off .

I have however noticed recently that the input booleans I was using to get the status updates from the sonoff app are no longer working, so if I turn the light on and off either through the app or the wall switch it doesn’t show in the lights card .

The logs show the following error :

ERROR (zeroconf-ServiceBrowser_eWeLink_1000883763._ewelink._tcp.local.) [homeassistant.components.switch.sonoff_lan_mode_r3] Error updating service for device 1000883763: encoding without a string argument, probably wrong API key: eWeLink_1000883763._ewelink._tcp.local

After googling the error I came across this thread so I believe it’s related to the firmware update (currently on 3.3.0) .

Turning the light on and off still works perfect but the updates don’t …

Is there any way around this guys ?

Ricardo, that error is from my component. With that component you need to specify the API key in the configuration.yml

Is Sonoff Pow R2 supported?

Hi,
There is warning in the HA 0.109.0

  • 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 176: headers=self._headers, json=app_details)
  • 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 374: ), headers=self._headers)
  • 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 221: r = requests.post(‘https://%s-disp.coolkit.cc:8080/dispatch/app’ % self._api_region, headers=self._headers)
3 Likes

i have mainly error line 374

2020-04-29 19:09:01 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 374: ), headers=self._headers)

Error comes from this code part:

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(
            self._api_region, self.get_user_apikey(), str(int(time.time())), ''.join(random.choice(string.ascii_lowercase + string.digits) for _ in range(8)), self._imei, self._model, self._romVersion, self._appVersion
            ), headers=self._headers)
2 Likes

Getting the same error on my setup as well

Hi,
I have the same warnings in HA version 0.109.1
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 374: ), headers=self._headers).
Maybe it will need a fix.
Thanks

@ reported warning above https://github.com/peterbuga/HASS-sonoff-ewelink/issues/232#issuecomment-621987827

2 Likes

hi,
i am having the folowing error all the time:
ERROR (Thread-2) [custom_components.sonoff] websocket error: [Errno 104] Connection reset by peer
(rp3 with hassio)
and hassio stop responding after about 1/2 days.
do you have any idea what can cause it ?

Sounds like he may not be able to look into it right away.
This one worked for me, simply removed the “api_region” line, I had a very basic setup.

Thanks for all your time and effort @peterbuga worked perfect for quite a long time!

hi,
how to install it just to replace all the files at the sonoff folder (under the cutom component) ?
because the sensor.py file is missing

Hey @peterbuga just thought I would let you know that your integration works with my Wemeter energy monitor here WEMeter 3 phase energy monitor as this device uses Ewelink.
So I guess you can add it to your device list. Heres what i am getting out of it at the moment.


Thanks for such a great integration. If I could see the three phases that it reads that would just be the icing on the cake!