Giter Site home page Giter Site logo

hass-sonoff-ewelink's Introduction

Home Assistant component for original firmware Sonoff / eWeLink switches

Simple Home Assistant component to add/control Sonoff/eWeLink smart switches using the stock firmware and cloud capabilities.


WARNING: completely deactivate the sonoff component from HA while doing a firmware update, due to auto-relogin function you might be kicked out of the app before the process is completed. I would not be held liable for any problems occuring if not following this steps!


CHECK COMPATIBILITY LIST BELOW! IF IT DOESN'T WORK FOR YOUR DEVICE DON'T COMPLAIN AND OPEN A PROPER ISSUE

Setup

To setup add to your configuration.yaml:

sonoff:
  username: [email or phone number]
  password: [password]
  scan_interval: 60 (optional)
  grace_period: 600 (optional)
  api_region: 'eu' (optional)

And copy the *.py files in custom_components folder using the same structure like defined here:

 custom_components
    ├── sonoff.py
    └── switch
        └── sonoff.py

email [Deprecated] only for compatibility, may be eliminated in future.

username the username that you registered for ewelink account be it an email or a phone number (the phone number should lead with region number, '+8612345678901' for example).

scan_interval you can define how fast the state of devices is refreshed (by default every 60sec). for example if you change the switch from an external source like Alexa or Google Home the change will show up in HA in maximum less than specified period, while changing it using HA interface/actions/etc it's instantly

grace_period eWeLink app allows only one active session at a time, therefore this will temporarily block HA refreshes for the specified amount (in seconds) to allow (or better said after) you to login in the app and do required changes to your devices. following that sonoff component does an internal re-login invalidating the mobile session and the process restarts. (as a workaround for this, you can create a 2nd account and share the devices from main one, therefore one will be used in HA another one in mobile app)

api_region this component tries to find, login & connect to the proper region assigned to you. specifying a proper region will help the component to load faster and reconnect after the expired grace period explained above, possible values: eu (default), us and cn

This is just a proof of concept because I searched for it and there was no implementation to use Sonoff/eWeLink devices without flashing them. (althought I know how to do it, I don't have a real extensive usage for now and I prefer to keep them on stock firmware).

Compatibility list

Model Supported Fw 1.6 Fw 1.8.1 Fw 2.6 Remarks
Sonoff Basic yes yes yes yes
Sonoff 4CH Pro (R2) yes yes
Sonoff S20 yes yes
3 Gang Generic Wall Switch yes yes Manfufacturer: pro-sw, Model: PS-15-ES (according to ewelink app)
1 Gang Generic Wall Switch yes yes Manfufacturer: KingART, Model: KING-N1 (according to ewelink app), Chip: PSF-B85 (ESP8285)
WHDTS WiFi Momentary Inching Relay yes displayed as a switch button
Sonoff S26 yes yes Version: Euro

yes = confirmed version, [empty] = unknown for sure

Updates

  • 2018.12.5
    • mandarin phone number login support
    • removed entity_name option, the entities will have a fixed structure from now on
  • 2018.12.01
    • ability to control devices with multiple switches
    • added mobile app specified device-name as default to be listed in HA entity, added entity_name option and removed the default sonoff_ prefix
    • fixed bug that will show device as unavailable in the grace period
  • 2018.11.29
    • shared devices from another account can be used also
  • 2018.11.28
    • mobile app-like login to the closest region
    • added scan_interval option
    • added grace_period option

Requests / Bugs

Feel free to properly ask support for new devices using these guidelines / report bugs / request features / fork (& pull request) and I'll try to see what I can do.

Credits

hass-sonoff-ewelink's People

Contributors

2016for avatar peterbuga avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.