Skip to content

Commit

Permalink
Merge pull request #35 from konnected-io/add-busted-specs
Browse files Browse the repository at this point in the history
adds first busted spec; adds manifest.json
  • Loading branch information
heythisisnate authored Aug 9, 2017
2 parents d9584eb + 9d1240f commit e0168c2
Show file tree
Hide file tree
Showing 29 changed files with 64 additions and 5 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
board and (optional) relay. This project consists of a few components:

1. [NodeMCU](http://nodemcu.com/index_en.html) firmware for an ESP8266 development board in `firmware`
1. Lua and HTML source code for the NodeMCU in `source-code`. All these files should be uploaded to the NodeMCU's
1. Lua and HTML source code for the NodeMCU in `src`. All these files should be uploaded to the NodeMCU's
internal file system
1. [SmartThings](https://www.smartthings.com/) platform code in `smartapps` and `devicetypes`

Expand All @@ -24,7 +24,7 @@ the developers who have worked hard on this project.

1. Install device drivers for your NodeMCU device.
1. Flash the device with the included firmware [firmware/konnected-security-2-0.bin](firmware/konnected-security-2-0.bin)
1. Upload all the code in `source-code` to the device and reboot the device.
1. Upload all the code in `src` to the device and reboot the device.
1. Connect to the WiFi network `konnected-security_XXXXXX` to set up WiFi
1. Follow wiring instructions and SmartThings application setup instructions in the [Konnected Security Documentation](http://docs.konnected.io/security-alarm-system)

Expand Down Expand Up @@ -61,7 +61,7 @@ on which board you have, there are different drivers:

1. Download and install the [NodeMCU PyFlasher tool](https://github.com/marcelstoer/nodemcu-pyflasher)
1. Using PyFlasher, flash the latest firmware in the `firmware` directory of this repo at 115200 baud using flash mode `dio`.
1. Now you need to upload all the files in the `source-code` directory of this repo on to the device. If you're comfortable
1. Now you need to upload all the files in the `src` directory of this repo on to the device. If you're comfortable
using Python, I recommend `nodemcu-uploader`. The command would look something like this:

`C:\Python27\python.exe nodemcu-uploader --port=COM3 upload * --verify=raw`
Expand Down
11 changes: 11 additions & 0 deletions scripts/build-manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

FILE=src/manifest.json
echo "{" > ${FILE}

for file in src/*
do
echo " \"${file}\":\"$(git ls-files -s ${file} | awk '{print $2}')\"," >> ${FILE}
done
echo " \"updated_at\":\"$(date -u +%Y-%m-%d:%H:%M:%S)\"" >> ${FILE}
echo "}" >> ${FILE}
2 changes: 1 addition & 1 deletion scripts/flash
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ PORT=/dev/cu.wchusbserial1410

esptool.py --port=${PORT} write_flash --flash_mode dio 0x00000 firmware/${IMAGE_NAME}.bin

cd source-code
cd src

while true; do
sleep 2
Expand Down
14 changes: 14 additions & 0 deletions spec/device_spec.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
describe("device", function()
local device

setup(function()
device = require("device")
end)

it("has expected properties", function()
assert.equal(device.swVersion, "2.0.2")
assert.equal(device.hwVersion, "2.0.0")
assert.equal(device.name, "Security")
end)

end)
7 changes: 7 additions & 0 deletions spec/nodemcu_stubs.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
_G.node = {
heap = function() return(0) end
}

_G.file = {

}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion source-code/init.lua → src/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ print("Heap: ", node.heap(), "Connecting to Wifi..")
local startCountDown = 0

wifi.eventmon.register(wifi.eventmon.STA_DISCONNECTED, function(T)
print("Heap: ", node.heap(), "Cannot connect to WiFi")
print("Heap: ", node.heap(), "Cannot connect to WiFi:", T.SSID, T.BSSID, T.reason)
enduser_setup.manual(false)
enduser_setup.start()
wifi.eventmon.unregister(wifi.eventmon.STA_DISCONNECTED)
Expand Down
File renamed without changes.
27 changes: 27 additions & 0 deletions src/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"src/actuators.lua":"47a1a50c0c8cfb547554ded22a8134eaed76c0a3",
"src/application.lua":"19861db05c155e56fb5ae5676f5ba807847304d2",
"src/device.lua":"e64c4ea6dd1a98042a579069f381f06c70482cad",
"src/enduser_setup.html.gz":"fbf730b33c309ceab15e88f162f43c232593f7da",
"src/http_favicon.ico.gz":"483f371c590b0407c380d019bcc6938cf1d62f0a",
"src/http_index.html.gz":"e1149f19e459500c32273dbdacbcfa978db16364",
"src/httpd_req.lua":"80053674f20f087e58e1cfd490fc71e6cdd92acf",
"src/httpd_res.lua":"7226f19699168e171970cda73b953a49450b7aa8",
"src/init.lua":"885845a1021082ac1c2421e7221696e46b45a2cf",
"src/led_flip.lua":"590e7be1afe686f4213d097d0e9dba9e7a3910a0",
"src/manifest.json":"2dfbfeb917d06f146035c6269b78f945f2c05f31",
"src/sensors.lua":"d0d94fa73f713dcf2c517da9262f59f306b81d2b",
"src/server.lua":"636843d3464b5aaba720b6eabe265b53580ed780",
"src/server_device.lua":"dca5e6501b4836d120cadc20538999387c9c54d1",
"src/server_settings.lua":"f9a36134d95269ef3681db1f6f0dbe5040650716",
"src/server_status.lua":"beedf485b06a69902bd60591f5ae313de69cff73",
"src/smartthings.lua":"ae11130360416aec5c2505c06850c5a4cd0449da",
"src/ssdp.lua":"99a61a59475095eec8b4ab4ad5b34c9a5fc3b0ba",
"src/start.lua":"af90c766d9afa65c6cbcddacb7ab91124b3598c6",
"src/update.lua":"b7274646098895b2a95c1ac0530c0c08780681a7",
"src/update_manifest.lua":"8edd53f6cee34bfe4e42e9d51e7bea60c32a895f",
"src/update_process.lua":"ed66480f96c6b7631c93279b7a8a7dd0429d5a56",
"src/variables_build.lua":"0029cb028698822ee981c35bcf84710c19e21486",
"src/variables_set.lua":"2c2d9c13c8acb577d80f40e4b513c7cd23ffdd1f",
"updated_at":"2017-08-09:06:50:14"
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit e0168c2

Please sign in to comment.