Sonoff /eWeLink component for original firmware

Do you find any use full information in the system log?

I am only using 32bit because it was recommended on the download page. Dont know if that can have something to do with this problem. Maybe you have a spare SD card and can try the 32bit version?

I have the same folder structure

/config/custom_components/sonoff/
–init–.py (double underscores)
sensor.py
switch.py

and the cache folder

out of curiosity i’ve just tried on my test env 0.94.5 and for me it (still) works just fine with basic tests ¯\_(ツ)_/¯ , if someone can point a reproducible problem there ain’t much to fix
for those with automation problems take a look here

(side note: unless you always read the release notes and you really need every update possible from there stop updating HA on every iteration)

The problem resolved , uninstalled 64bit version … installed from the beginning the 32bit version and finally everything is ok !

I did not expect that the version of HassOS it was so important !! i wasted so much time for this…crazy !

conclusion : NEVER INSTALL 64 BIT VERSION OF HassOS !!!

Thanks @plonkis , @peterbuga for your help !

1 Like

yes. it is something like turn off the light when im leaving the house. can u post ur sample automation?

yay! the man is back! welcome back sir!

Here you have an exampel of the script that the automation executes.
(you need to adjust the code formating)

deley_example_on:
sequence:
- service: switch.turn_on
data:
entity_id: switch.sonoff_100063c8a8

  - delay: '00:00:01'
  - service: switch.turn_on
    data:
      entity_id: switch.sonoff_100063c21e

  - delay: '00:00:01'
  - service: switch.turn_on
    data:
      entity_id: switch.sonoff_100063d09b

  - delay: '00:00:01'
  - service: switch.turn_on
    data:
      entity_id: switch.sonoff_100063eb4f

In the automation you use the “script.turn_on” command under Actions to execute the script and under service data

{
“entity_id”: “script. deley_example_on”
}

i just start homeassistant from scratch.
sonoff plug in keep telling me that the credential is wrong.
i tried log in using the app, and it works.
is there anything wrong in my config?

sonoff:
  username: +628972664396
  password: 123456
  scan_interval: 60
  grace_period: 600
  api_region: 'as'
  entity_prefix: True
  debug: False
2019-07-03 09:52:05 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 do experience issues with Home Assistant.
2019-07-03 09:52:17 ERROR (MainThread) [custom_components.sonoff] Couldn't authenticate using the provided credentials!

this is the log i got

use single quotes

silly me. thanks alot. update on the automation. i use delay, and it works okay now!

1 Like

Hello!

First of all, sorry about my english (ain’t my native language).
I bought a generic (aliexpress) dimmer switch. It works perfectly on ewelink app.

On HA (hassio), just shows on off (switch) without dimmer, at least I couldn’t find these entities. In “services” just appear the switch’s entity (switch.sonoff_xxxxxxxxx).

Did you find any advanced user to follow you up on this question (I’m a newbie one)? How can I make my self useful to this task? I promiss that I’ll respond ASAP.

Running:
RPI 3B
Hassio HassOS 1.13
HA 0.94.4

log:

2019-07-04 20:52:59 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 do experience issues with Home Assistant.
2019-07-04 20:53:08 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 365, in _async_add_entity
    await entity.async_update_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 225, in async_update_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 248, in _async_write_ha_state
    state = self.state
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 454, in state
    return STATE_ON if self.is_on else STATE_OFF
  File "/config/custom_components/sonoff/switch.py", line 75, in is_on
    self._state = self.get_state()
  File "/config/custom_components/sonoff/__init__.py", line 648, in get_state
    return device['params']['switch'] == 'on' if device else False
KeyError: 'switch'
2019-07-04 20:53:13 ERROR (stream_worker) [libav.tcp] Connection to tcp://192.168.15.10:554?timeout=5000000 failed: Host is unreachable

Thanks in advance!

@Fernando_Donan try dumping some basic debug data with 1 switch in different values on / off / 10% / 80% or the improved debug and post the results here

After posted here, I tried several other stuffs and I realized somehow I messed up something (hardware part, because I tried to flash too, probably soldering). I already ordered another pieces from different sites to keep trying this project.
Arrive estimated on 07/28.
As soon they arrive, I’ll try to do this debug.

Sonoff 4CH Pro R2 new firmware 3.1.0 tested and working with this component .

1 Like

Hi there,

first, sorry for my english:hot_face:

i’ve a nas qnap where i installed HA through the container service.
I think (hope) i followed all your guide lines for the installation and configuration, but at the end when i launch the ha website i receive this error:

The following components and platforms could not be set up:

  • sonoff

Please check your config.

If i go to check configuration i receive this:

Configurazione non valida
Testing configuration at /config
Failed config
General Errors:
- Component not found: sonoff

Successful config (partial)

these are my configurations:

Please help me to understand where i wrong

do you use single quotes for your username and password?

hi! thank you for your reply, what do you mean for quotes? these? " ,no I typed password and username only without quotes…I’m wrong in this?

u need to use single quotes ‘username’ ‘password’

I just tried it but does not work…the strange thing is the error what does means “Component not found: sonoff”
if you or someone have some ideas please help me :stuck_out_tongue:

Sound like HA can´t find the sonoff component, have you created your custom_component folder in the right place? On a raspberry pi the path is /config/custom_components/sonoff

Hi Plonkis,thank you for your help, today I recreated the ha installation and configuration,changed the /config path , but nothing same problem, I think ha recognise the folder because it created a folder (inside sonoff folder)named pycache, inside there is a file named _init_cpython-36.pyc,it seems to be a log file below is the screenshot.(the log is very long if you need I can copy and past it in a new reply)

Thank you all for the support…:innocent:!

15630220224641394370852249660670|666x500