• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

seikan/homebridge-sonoff-basic-espeasy: A Sonoff basic plugin for Homebridge. Ba ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

seikan/homebridge-sonoff-basic-espeasy

开源软件地址:

https://github.com/seikan/homebridge-sonoff-basic-espeasy

开源编程语言:

JavaScript 64.7%

开源软件介绍:

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).




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap