Issue: Firmware Source is written to fail when the rest of the network if offline.
What happens: Konnected Reboots every 5 minutes if either of the following occur:
NTP does not connect to hard coded internet URLs. failsafe: reboot after 5 minutes in case of extended wifi outage With the Current Configuration, this leads disable the entire Konnected Ecosystem under the following conditions:
Loss of Internet Access (cannot resolve NTP to time.google.com or pool.ntp.org results to reboot) Loss of DNS (cannot resolve the NTP urls to IP, results in reboot) Deatuh attack on wifi. (cannot connect to Wifi, results in reboot) Power Outage (cannot connect to Network, DNS, NTP, resulting in reboot DHCP offline (calls DHCP every few minutes, even if the lease is set to 30 days or adjusted down to 7) File: konnected-security/src/lfs/wifi.lua
Lines 15-18: -- failsafe: reboot after 5 minutes in case of extended wifi outage failsafeTimer = tmr.create() failsafeTimer:register(300000, tmr.ALARM_SINGLE, function() node.restart() end)
Line 64: sntp.sync({gw, 'time.google.com', 'pool.ntp.org'},
I block all NTP requests leaving the network to stop replay attacks. Once I created DNS records to point to my NTP Server, the connection stayed online.
Also there is this AWS file that if it cannot connect to AWS it starts the reboot. This file is being modified 1st.
Konnected integrates wired alarm system sensors and sirens to SmartThings, Home Assistant, OpenHAB, or Hubitat using a NodeMCU based ESP8266 development board and (optional) relay. This project consists of a few components:
- NodeMCU based firmware for an ESP8266 development board in
firmware
- Lua and HTML source code for the NodeMCU in
src
. All these files are built into a SPIFFS file system which runs on NodeMCU - SmartThings platform code in
smartapps
anddevicetypes
Buy a Konnected Alarm Panel, our commercial product that was the inspiration of this open-source library. Buying from us is great way to support the developers who have worked hard on this project.
- Flash the device with the latest firmware and filesystem firmware/releases using the instructions in the Konnected Security Support Documentation
- Connect to the WiFi network
konnected-security_XXXXXX
to set up WiFi - Follow wiring instructions and application setup instructions in the Konnected Security Documentation
Windows and Mac users will need to download drivers so your computer can talk to the ESP8266 chip over USB. Depending on which board you have, there are different drivers:
WeMos CH340 drivers for boards that:
- have the name LoLin on the back or front
- the small rectangular component on the board near the USB port is engraved with CH340G
- Mac OS X Sierra users: use this driver
Silicon Labs USB to UART drivers for boards that:
- have the name Amica on the back
- the small component on the board near the USB port is engraved with SiLABS CP2102
Konnected leverages the NodeMCU codebase and Docker builder to create a base nodeMCU firmware image and a filesystem containing the Konnected application. Building only requires a few steps.
-
Download and install Docker
-
Clone the Konnected and nodeMCU repos to the same level in your working directory
git clone https://github.com/konnected-io/konnected-security.git git clone https://github.com/nodemcu/nodemcu-firmware.git
-
Check out the 2.2.1 release of nodemcu
pushd nodemcu-firmware && git checkout 2.2.1-master_20190405 && popd
-
Use the build-firmware script to kick off the build - providing a semantic version command line argument as shown below. The build script will automatically pull down the nodeMCU docker builder, build the base firmware, create an LFS image, and build a SPIFFS file system containing the entire Konnected application.
cd konnected-security ./scripts/build-firmware 2-2-99
-
Once the build completes a folder will be created in
firmware/builds
named after the version specified in the previous step. This folder will contain two files also reflecting the version.- konnected-filesystem-0x100000-2-2-99.img
- konnected-firmware-2-2-99.bin
Note: Each time you build it will remove any prior build outputs corresponding to the same version.
Note: Versions in this project should always be formatted <major>-<minor>-<patch>
.
Flashing a build is simple with the Konnected Flashing Tool.
Mac and Linux users can also easily flash from the command line using scripts/flash.
-
You must have Python installed with
pip
orpip3
.- Mac users: I recommend using Homebrew and
brew install python
- Mac users: I recommend using Homebrew and
-
Open up a terminal and install
esptool
packages:pip3 install esptool
-
Run the script in
scripts/flash
to flash the firmware and software to the device. You must pass in version and serial port args. The flash script will always attempt to flash a matching version infirmware/builds
before falling back tofirmware/releases
./scripts/flash 2-2-99 /dev/ttyS3
Note: You may also need to make the script executable by running chmod 755 scripts/flash
.
We work hard on this project because we're passionate about making home automation accessible to everybody. Millions of homes in North America and worldwide are already wired with sensors and have the potential to become smart homes. We want to make this a reality.
If you've used Konnected Security and it's improved your life and your home security, please consider donating to help us achieve that goal.
Thank you for your support,
Nate Clark @heythisisnate