npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

homebridge-sonoff-basic-espeasy-quickfix

v0.0.1

Published

Sonoff basic plugin for Homebridge.

Downloads

3

Readme

homebridge-sonoff-basic-espeasy

This is Sonoff basic plugin for Homebridge. You will need some soldering works to gain access to flash ESPEasy firmware.

Sonoff Basic

Features

  • Switch on / off.

    You can now ask Siri to turn on / off any device!

  • Pulse to on / off the device after X seconds.

Preparation

Required Hardware

| | | | | :--------------------------------------: | :--------------------------------------: | :--------------------------------------: | | Sonoff Basic | Soldering Iron Pen | Header Pins |

| | | | | :--------------------------------------: | :--------------------------------------: | :--------------------------------------: | | Tin Lead Rosin Core (<0.5mm) | Female-to-female Dupont Wire Cables | TTL to USB Adaptor |

Notes: You can easily get these hardware from eBay at cheap price.

Instructions
  1. Open the case of Sonoff and take out the board.

  2. Lay it on the table and solder 5 header pins as show in the picture below. WARNING: Please make sure the switch is not connected to live socket.

  3. Plug in the four dupoint wires.

  4. Connect the wires to TTL to USB adaptor.

    The correct position is as following:

    • Red: 3v3
    • Green: TXD
    • Yellow: RXD
    • Blue: GND

    **Notes: ** Some TTL to USB adaptor may not working in this way. If the device is not connected correctly, swap the position of Green (TXD) and Yellow (RXD) wire.

  5. Download ESPEasy R148 firmware from here. This is the version that works perfectly with Sonoff basic. I was facing serious connection issue when I flashed with R120 firmware as recommended in the official website.

  6. Unzip the downloaded package.

  7. Press and hold the button on Sonoff basic, plug the TTL to USB adaptor to PC. Release the button once plugged.

  8. Press WIN + R on keyboard and type devmgmt.msc to open device manager. Check under Ports (COM & LPT) section to find out the COM port used by the adaptor.

  9. Press WIN + R on keyboard and type cmd to open command line.

  10. Go the folder where ESPEasy located.

  11. Execute the flash to start flashing the firmware into Sonoff.

  12. Enter following details when prompted.

    **Notes: ** Comport is the port you got from Step 8.

  13. Wait around 3~5 minutes. You should see following output when firmware is successfully flashed.

  14. Unplug the USB and plug in again to let Sonoff reboot.

  15. Wait about 3~5 minutes and Sonoff will creates a new Wi-Fi access point called ESP_0.

  16. Connect your PC to the network with password configesp.

  17. Open web browser and go to http://192.168.4.1.

  18. Go through the setup to connect Sonoff to your Wi-Fi network.

  19. [Optional] The design of ESPEasy web interface is really hurting my eyes. I have customized a style sheet here. Go to Tools > Settings > Load, upload the esp.css to change the interface.

  20. Now, go to HARDWARE section, select GPIO-13 (D7) for Wifi Status Led to enable the green LED light on Sonoff. Submit the changes.

  21. Go to DEVICES section, edit Task #1. Insert the values as the picture below and submit.

  22. Edit Task #2, insert values as picture below and submit.

  23. We have enabled the hardware GPIO to work, now we need to configure the rules for HTTP request.

  24. Go to RULES section, insert the following codes and submit.

    On PowerOn Do
    	gpio,12,1
    EndOn
    
    On PowerOff Do
    	gpio,12,0
    EndOn
    
    On Button#State Do
    	If [Button#State] = 0
    		gpio,12,0
    		gpio,13,1
    	Else
    		gpio,12,1
    		gpio,13,0
    	EndIf
    EndOn

    The codes above contains 3 sections. The PowerOn part is to turn on the switch, PowerOff part is to turn of the switch. Button#State is the part to handle the physical button on Sonoff, so you can toogle the button to turn on/off the switch.

  25. Finally, the Sonoff basic switch is fully customized. Connect it to a live socket.

Installation

  1. Install required packages.

    npm install -g homebridge-sonoff-basic-espeasy request

  2. Add following lines to config.json.

      "accessories": [
        {
          "accessory": "SonoffBasicESPEasy",
          "name": "Living Room Switch",
          "type": "switch",
          "ip": "IP_ADDRESS_OF_THE_SONOFF_BASIC"
        },
        {
          "accessory": "SonoffBasicESPEasy",
          "name": "Living Room Switch Pulse Off",
          "type": "switch",
          "ip": "IP_ADDRESS_OF_THE_SONOFF_BASIC",
          "pulse" true,
          "action": "off",
          "duration": 60
        }
      ]

    Type supported:

    • switch

    • outlet

    Pulse is false by default . Set it true to use pulse, then set the action to on or off. Duration is counted in seconds.

  3. Restart Homebridge, and your Sonoff basic a will be added to Home app.

License

See the LICENSE file for license rights and limitations (MIT).