Control Sonoff Devices with eWeLink (original) firmware over LAN and/or Cloud

I’m having issues with the SONOFF B02-F Smart Wi-Fi LED Filament Bulb|SONOFF Official)

This is what I get in HA:

manufacturer: SONOFF
model: B02
sw_version: WTW-SNL-02 v1.3.2
cloud: online
local: ‘E#COS’
friendly_name: Landing Light
supported_features: 0

using this config.yaml entry:

devices:
1000fcdbb4:
device_class: light
name: Landing Light

I can turn them on and off but no way to control temp and brightness that I can see.

Any pointers greatly appreciated.

Did you look to see if it is in sensor.sonoff_randomnumbers ?

Point is simple. Read component docs :slight_smile:

When I look in the developer tool I can see switch.sonoff_nnnnnnnnnn, and it has several values in the attribute column. And it is these values I would like to read out. But I am to stupid to understand how! I have red and watched YT, but it doesn’t fall to place for me! Sorry! I’ll keep turning bulbs on and off…

For you it’s simple, for me it’s not. I keep on reading, and some day…

There is no stupid questions here, we have all been where you are! Without help from others I wouldn’t have been able to get where I am today. That being did I have ALOT to learn still!

Ok, for my Sonoff sensors temperature if I go to
Developer Tools > States > in the Sensor.whatever_your_sonoff_is_called you should see a value for temperature there (near the bottom of the list.

Here’s mine, but note that I have changed the name of it so I can remember it easier!

After that you can use that sensor to monitor the temp changes in that room.

If you are still unsure feel free to keep asking questions until you better understand it!

I’ll do what I can to help get you there!

I think he don’t has this sensor because he don’t enable it as it said in component docs:

I have a Sonoff POW R2. I don’t think there are temperature in this hw.
My configuration looks like this:

# Sonoff/LAN
sonoff:
  username: !secret ewelink_uid
  password: !secret ewelink_pw
  mode: local
  force_update: [power, current, voltage]
  scan_interval: "00:00:05" # (optional) default 5 minutes
  sensors: [power, current, voltage]

And the only sensor i see is “switch.sonoff_nnnnnnnnnn”, no other…

However, after som YT I found a way using template sensors (which I didn’t know the first thing of before)!

- platform: template
  sensors:
    dishwasher_power:
      friendly_name: "Dishwasher power"
      unit_of_measurement: "W"
      value_template: "{{ state_attr('switch.sonoff_nnnnnnnnnn', 'power') }}"

With this I get the Power reading from the Sonoff POW, actually…
But still I see no other sensors direct out of the Sonoff integration

You may leave only username, password and sensors lines. All should works better than your config.

Because auto mode works better than only local mode. And with cloud connection you don’t need force update for POW devices.

2 Likes

Ok, thanks! I will test that!

Has the component stopped working or am I doing something incorrectly? Can’t get the .json to generate, and it doesn’t sync the devices using cloud.

I’m thinking it’s the yaml layout that is incorrect, as even the debugger doesn’t show up.

Here is my setup:

configuration.yaml:
switch: !include_dir_merge_list switch/

sonoff.yaml:

sonoff:
  username: !secret sonoff_user
  password: !secret sonoff_pass
  debug: True 

I’ve even tried manually added the device id, but the entity doesn’t show up no matter what.

sonoff:
  devices:
    1000102187:
      devicekey: key-placeholder-goes-here-ok
      device_class: light
      name: Light

Any help would be appreciated, thanks

If some one have issues with login, passwords start with 0 (zero) dont work

2 Likes

If your password all with numbers - you need to use quotes.

2 Likes

Numbers and letters if start with 0 zero dont work maybe work with quotes, my password only have Numbers and i do not need quotes

Thanks for creating this but couldn’t find instructions to set it up.
I already installed it by manually copying the sonoff folder into custom components folders. (HACs was installed but it doesn’t show up in HA)

After installing the documentation talks about different config examples, but where do I enter those configurations?
I tried entering it in the services.yaml file on sonoff folder and configuration.yaml in the config folder, but it didn’t work.
After configuring it do I have to do anything else or I should see it in my home page of HA?
Hope someone can point in the right direction.

Thanks very much

I have problem not seeing file /config/.sonoff.json too (checked via SSH plugin).
I do not have mesh WiFi.

I can help with HACS not visible: do not forget to clear browser cache (in Chrome I have selected cookies and files and pictures in cache, not ony files and pictures). It looks like it was my solution. Now I can see HACS well in HA.

Related to “config examples”:
I was able to catch debug. In my case it is password issue:

2021-02-21 05:55:13  DEBUG    main          SysInfo: {'version': '2021.2.3', 'dev': False, 'hassio': True, 'virtualenv': False, 'python_version': '3.8.7', 'docker': True, 'arch': 'aarch64', 'os_name': 'Linux', 'os_version': '5.4.83-v8', 'supervisor': '2021.02.11', 'host_os': 'Home Assistant OS 5.11', 'docker_version': '19.03.13', 'chassis': 'embedded'}
2021-02-21 05:55:13  DEBUG    main          CLOUD mode start
2021-02-21 05:55:17  ERROR    sonoff_cloud  Login error: {'error': 401, 'msg': 'pwd err'}
2021-02-21 05:55:17  WARNING  main          Can't connect to eWeLink Cloud

Update:
is seems to be there are some limitations in HA / HACS / SonOffLAN chain.
I just tried the same password in Android mobile app and it works well.

Update:
changing password to that with same length (16 chars) and with letters and numbers did the trick.
That is actually very sad. :frowning:

Thank you but I deleted my cookies and cache but it didn’t work. I still can’t see HACS but I can see files installed in the custom components folder… So I don’t know what is going on.
To make sure I opened HA with Chrome for the first time and I still can’t see it.

At the documentation I read that I have to use this configuration to use it both on the cloud and locally, but the question is where should I write the config? As I said I tried in services.yaml file on sonoff folder and configuration.yaml in the config folder but still not working
I added this to the yaml file:

sonoff:
username: +910123456789
password: mypassword
mode: local
reload: always

I am not sure if you should be solving “SonOff” stuff if you do not have yet working HACS.

You do see already something like this in your HA?