New custom component: Sonoff LAN Mode (local, with stock firmware)

No metter which server you use (need) you could try with one of two mentioned (us / eu). Then in Charles when eWeLink is started you will se on left side all the available connection. So maybe your sever will be displayed and then you can enter this URL to PROXY configuration if needed. I think that even this isn’t mandatory to get the apikey but I can’t try myself.

1 Like

You could just use the script available at https://github.com/Philiptpp/sonoff_registered_devices to get your apikey and all registered deviceIDs.

1 Like

Nice script… but for this custom component you need api key which is unique to each device. With this from your script (global) this custom component won’t work and all your devices will be unavailable. I have just tried…

I modified script to print device API keys - https://github.com/Philiptpp/sonoff_registered_devices/pull/3

1 Like

The modified script works well. It’s much easier to use that, compared to any other way described before.

1 Like

Hi. My component get all apikey automatically and also work in LAN Mode:

Does SONOFF L1 work with this?

So, I have this working with a US S31 and can turn it on and off just fine, but I am having trouble getting voltage and current data.

I have created the following sensors:

- platform: template
  sensors:
    voltage_s31-3:
      friendly_name: Voltage
      device_class: voltage
      value_template: "{{ state_attr('switch.sonoff_10003cc38d', 'voltage') }}"
    current_s31-3:
      friendly_name: Current
      device_class: current
      value_template: "{{ state_attr('switch.sonoff_10003cc38d', 'current') }}"

I expected to end up with a sensor.current_s31-3 and I did not. If I paste this into the template tester:

    voltage_s31-3:
      friendly_name: Voltage
      device_class: voltage
      value_template: "{{ state_attr('switch.sonoff_10003cc38d', 'voltage') }}"

It results in this output:

voltage_s31-3:
      friendly_name: Voltage
      device_class: voltage
      value_template: "122.32"

But, I do not have a sensor.voltage_s31-3 listed in my developer tools/states. How do I see the raw output from the device to see what data points are available?

What am I doing wrong?

Hey @mattsaxon - thanks for your great work here!

I got my API keys, etc, but am having trouble connecting to the device (it’s a Sonoff SV).

Debug log is saying:

2020-03-26 17:29:19 DEBUG (MainThread) [custom_components.sonoff_lan_mode_r3.switch] HassSonoffSwitch returning _available: False

Any tips/pointers on how to debug?

Please post an issue in the GitHub repo and we can work on this there. However that is not a full debig log. Please also post a snippet of your config file

will do thanks!

Hi all,

I’ve installed the Sonoff integration in Hassio and have obtained all the device ID’s and inputted them into the configuration.yaml. But when I removed a device from eWelink, it’s no longer available in Hassio. What gives? I thought it should not longer be dependent on the cloud.

Thanks!

the component doesn’t need the cloud to operate, but when you remove them from eWeLink, it must change the state of the device in some way. I personally use eWeLink in tandem so don’t have this issue. My suggestion is to block the devices from the internet (router config) before removing them from eWeLink. That way the devices won’t know they are unregistered.

Hi to all ,

I have installed this component Sonoff LAN using HACS … All installed correctly …
But i get this error when loading the module …

ERROR (MainThread) [homeassistant.setup] Setup failed for sonoff: Unable to import component: No module named ‘Crypto’

I have installed with command pip3 install pycrypto with no luck …
It could be a dependence problem?
I am using armbian with cubietrack system …

Thanks

I answered to myself …

I am using python in a virtual environment … so i have openned two terminals one it is with the virtualpython and the other one i use it is a normal one for adding python extensions… so i do not install the module in the correct python parts… so …

Now solved … Thanks and sorry … :wink:

I found out this integration stop work with version 0.109.0 of HASS (standalone installation in Armbian native environment).
Switches (S26, T4EU) are correctly reported states to HA, but I cant control it from HA interface.
After downgrade to 0.108.9 it return to normal situation.
IMHO it can be incompatibility with new version of Criptography 2.9 which coming with 0.109.0.

Hi,

It has stopped working for me on a plane vanilla RaspBerry Pi install

I suspect of the Async changes happened in 109.

Thanks

Fixed in latest version 1.1.4.1

1 Like

I suspect that the component you are using above is not mine, looks like it may be peterbuga’s or Alexxit?

I have move the Sonoff S26 to a vLAn and seem lost connection. How can I make it work on a separate vLAN