Sonoff /eWeLink component for original firmware

hi peter i bought a smart circuit breaker that has also power control but it is not a sonoff but it is used with ewelink app. smart circuit breaker is cnzjsc. producer is WDYK How can i see in home assistant??please help me thank you

@marksev1 i think you could add this lines here. it’s just an idea which i do not recommend it! might work or it might not, just give it a try. (doesn’t matter on what branch you are)
ps: if it doesn’t work please do not post the errors here, do it on github because we might end up spamming the thread with this particular error that might spread into other areas

import ssl
ssl._create_default_https_context = ssl._create_unverified_context

@Hdjweb read the project’s description! if you have get errors post them here or open an issue on github, I cannot help you without providing a real problem :face_with_raised_eyebrow:

Peterbuga solved thank you you can add to compatibility list also cnzjsc smart break circuit

1 Like

yes, I am from EU. I pasted here fake username and password, but I have verified a few times to make sure I have put the right one.

Please run this steps to get a better view what’s happening on your side https://github.com/peterbuga/HASS-sonoff-ewelink/tree/master/sonoff-debug
If this script doesn’t work then the component is not going to work either.

Sorry to hijack the thread but I just got a couple of different SONOFF smart light switches on aliexpress and wanted to connect them to my ha/hass.io. I was pointed to your repo here:

but Im not sure how to “install” the files in my hass.io install. In your readme you talk about adding some code to automation.yaml but then you mention a custom_components folder I cant find.

You “install” the files by copying the files into the folder structure he specifies. If you don’t have the custom_components folder you will have to add it to the config folder.

The file and how to is in the first post.

If any setting you don’t understand please feel free to ask.

Ok i created the folder and copied the files over and added the code to the configuration.yaml.

Thanks!

Many thanks to you @peterbuga !!!
You saved a lot of time for me :slight_smile:

1 Like

Has anyone managed to integrate with the “Sonoff RF”? For me it was the only one that did not work.

@dougbaptista via WIFI or RF? please give more details about your setup

Hello, come on. My “Sonoff RF” is connected via Wifi and I have a “DW1 433Mhz” connected without RF. I’m not at home at the moment, arrived in 5 hours to pass more details. I’m from Brazil and I just configured it as follows:

  sonoff:
    username: !secret sonoff_user
    password: !secret sonoff_senha

My other “sonoffs” connected perfectly. (Basic and T1)

@peterbuga Just realized the state changes if done from ewelink/google home are not reflecting on HA instantly like they used to before. (Didn’t notice this for quite some time)

I think this happened on updating to the latest code that was updated 18 days back or so.

I see this not working with multiple outlet devices, but single outlet devices are working fine.

Reverting to old backup to see if that fixes it.

Error message:

error from callback <bound method Sonoff.on_message of <custom_components.sonoff.Sonoff object at 0x72b44ed0>>: 'switch'

@dougbaptista i must admit, i’m having a hard time figuring out if you talk about the (basic) Sonoff RF or the Sonoff RF Bridge which has a DW1 433Mhz sensor attached to it. please clear this out (post some pics/links of the devices if it’s easier this way)

Surprisingly, getting same error with old code as well.

However the controlling part from HA works instantaneously.
State changes are not reflecting instantaneously for multiple outlet device.
Single outlet devices work fine!

by any chance, did you added new sonoff devices in the meantime?
please use the websocket-debug branch and generate the log, should clear some things out for me :slight_smile:

Doing that as we speak. :stuck_out_tongue:

I did add two devices: Sonoff basic, Sonoff POW R2

1 Like
019-02-08 21:15:32 ERROR (MainThread) [homeassistant.setup] Error during setup of component sonoff
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/homeassistant/setup.py", line 145, in _async_setup_component
    hass, processed_config)
  File "/config/custom_components/sonoff.py", line 55, in async_setup
    hass.data[DOMAIN] = Sonoff(hass, config)
  File "/config/custom_components/sonoff.py", line 97, in __init__
    self.do_login()
  File "/config/custom_components/sonoff.py", line 172, in do_login
    self.update_devices() # to write the devices list
  File "/config/custom_components/sonoff.py", line 342, in update_devices
    self.write_debug(r.text, type='D')
  File "/config/custom_components/sonoff.py", line 492, in write_debug
    data = json.dumps(json.loads(data))
  File "/usr/local/lib/python3.6/json/__init__.py", line 354, in loads
    return _default_decoder.decode(s)
  File "/usr/local/lib/python3.6/json/decoder.py", line 339, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/local/lib/python3.6/json/decoder.py", line 355, in raw_decode
    obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 48 column 33 (char 1376)

The debug branch broke everything. :frowning:

An empty sonoff-debug.log was created though, restarting HA (I think you mentioned this while mentioning websocket-debug branch)