Git Product home page Git Product logo

wifiswitch's Introduction

WIFI controlled mains switch.

WIFI controlled mains switch using ESP8266.

Features.

  • Built in web server.
  • RESTful (I think) interface.
  • Enters AP mode and serves a WIFI configuration page, when there is no AP connection at start up.
  • Captive portal in configuration mode.
  • Multifunctional one button interface. :-D

Warning.

The communication is not encrypted! Without insecurities this would not be a real IoT device, though spying has yet to be implemented. Seriously though, do not put this thing on the internet in its current state.

Credits.

Peter Scargill (http://tech.scargill.net/)

Last piece in the puzzle, that turns of the ESP8266 messages, namely ets_printf still works.

Suggested using a zip file, as file system image, and shared his code

Has a nice tutorial on AJAX and JavaScript.

wifiswitch's People

Contributors

deadbok avatar

Stargazers

 avatar Ray Matos avatar Znak Zorro avatar

Watchers

 avatar James Cloos avatar Tobias Balle-Petersen avatar Christian Frey avatar

wifiswitch's Issues

GET on /rest/fw/version often crashes firmware.

Log output:

TCP received (0x3fff6090).
GET /rest/fw/version HTTP/1.1
Host: 192.168.4.1
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Firefox/38.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-GB,en;q=0.8,en-US;q=0.5,da;q=0.3
Accept-Encoding: gzip, deflate
DNT: 1
Content-Type: application/json
Referer: http://192.168.4.1/index.html
Connection: keep-alive


TCP connection 0x3fff5800 (0x3fff5848) state "ESPCONN_CONNECT".
 Remote address 0.0.0.0:0.
 SDK remote address 192.168.4.2:49837.
TCP connection 0x3fff84c0 (0x3fff7cd0) state "ESPCONN_CLOSE".
 Remote address 192.168.4.2:49835.
TCP connection 0x3fff65e0 (0x3fff64a8) state "ESPCONN_CLOSE".
 Remote address 192.168.4.2:49838.
TCP connection 0x3fff63c8 (0x3fff6090) state "ESPCONN_READ".
 Remote address 192.168.4.2:49837.
 SDK remote address 192.168.4.2:49837.
4 TCP connections.
 Looking for connection for remote 192.168.4.2:49837.
Connection 0x3fff5800 (0x3fff5848) state "ESPCONN_CONNECT".
 Remote address 0.0.0.0:0.
Connection 0x3fff84c0 (0x3fff7cd0) state "ESPCONN_CLOSE".
 Remote address 192.168.4.2:49835.
Connection 0x3fff65e0 (0x3fff64a8) state "ESPCONN_CLOSE".
 Remote address 192.168.4.2:49838.
Connection 0x3fff63c8 (0x3fff6090) state "ESPCONN_READ".
 Remote address 192.168.4.2:49837.
 Connection found 0x3fff63c8.
 Looking for listening connection on port 80.
Connection 0x3fff5800 (0x3fff5848) state "ESPCONN_CONNECT".
 Connection found 0x3fff5800.
 Listener found 0x3fff5800.
HTTP received (0x3fff63c8).
Parsing request line (0x3fff66a8):
Request method 0x20544547.
GET request.
Allocating 17 bytes.
Free heap (malloc): 18848.
Allocated 0x3fff6220 size 17 info: request->uri http_parse_request.
Allocs: 36.
 URI (0x3fff66ac): /rest/fw/version
Allocating 4 bytes.
Free heap (malloc): 18808.
Allocated 0x3fff6248 size 4 info: request->version http_parse_request.
Allocs: 37.
 Version (0x3fff66c2): 1.1
Getting headers (0x3fff66c7) size:
........ Last header.
 Copying 366 bytes of header data.
Allocating 367 bytes.
Free heap (malloc): 18424.
Allocated 0x3fff6848 size 367 info: request->headers http_parse_request.
Allocs: 38.
 Message length: 0.
 Done parsing request.
Finding handler.
 URI: /rest/fw/version.
 8 response handlers.
 Trying handler 1, URI: /rest/fw/mem.
 Using strict matching.
 URI length is not equal.
 Trying handler 2, URI: /rest/fw/version.
 Using strict matching.
 URI handlers for /rest/fw/version at 0x40270b60.
Handle response for request 0x3fff7d40.
 Calling handler at 0x40270b60.
Simple GET PUT handler entering state 0.
Creating version REST response.
Creating JSON member from fw_ver, 0.2.0+debug.
Allocating 23 bytes.
Free heap (malloc): 18352.
Allocated 0x3fff62d8 size 23 info: json_create_member ret.
Allocs: 39.
Adding "fw_ver":"0.2.0+debug" to JSON container <null> (type {}).
 New object.
Allocating 25 bytes.
Free heap (malloc): 18304.
Allocated 0x3fff6410 size 25 info: json_add_to_object ret.
Allocs: 40.
Freeing 0x3fff62d8.
 [0x3fff62d8] size 23 info: json_create_member ret.
Free heap (free): 18376.
Allocs: 39.
Creating JSON member from httpd_ver, 0.0.7.
Allocating 20 bytes.
Free heap (malloc): 18304.
Allocated 0x3fff62d8 size 20 info: json_create_member ret.
Allocs: 40.
Adding "httpd_ver":"0.0.7" to JSON container {"fw_ver":"0.2.0+debug"} (type {}).
Existing object.
Reallocating 44 bytes from 0x3fff6410.
Reallocated 0x3fff6440 size 44 from 0x3fff6410, info: json_add_to_object ret.
Allocs: 40.
Freeing 0x3fff62d8.
 [0x3fff62d8] size 20 info: json_create_member ret.
Free heap (free): 18360.
Allocs: 39.
Creating JSON member from dbffs_ver, 0.1.0.
Allocating 20 bytes.
Free heap (malloc): 18288.
Allocated 0x3fff62d8 size 20 info: json_create_member ret.
Allocs: 40.
Adding "dbffs_ver":"0.1.0" to JSON container {"fw_ver":"0.2.0+debug","httpd_ver":"0.0.7"} (type {}).
Existing object.
Reallocating 64 bytes from 0x3fff6440.
Reallocated 0x3fff69c8 size 64 from 0x3fff6440, info: json_add_to_object ret.
Allocs: 40.
Freeing 0x3fff62d8.
 [0x3fff62d8] size 20 info: json_create_member ret.
Free heap (free): 18344.
Allocs: 39.
Sending status line with status code 200.
Buffering 17 bytes of TCP data (0x3ffec635 using 0x3fff63c8),
 Buffer free 1423.
Sending header (Connection: close).
Buffering 19 bytes of TCP data (0x3ffffc40 using 0x3fff63c8),
 Buffer free 1404.
Sending header (Server: slighttpd).
Buffering 19 bytes of TCP data (0x3ffffc40 using 0x3fff63c8),
 Buffer free 1385.
Sending header (Content-Length: 64).
Buffering 20 bytes of TCP data (0x3ffffc40 using 0x3fff63c8),
 Buffer free 1365.
Sending header (Content-Type: application/json).
Buffering 32 bytes of TCP data (0x3ffffc40 using 0x3fff63c8),
 Buffer free 1333.
Buffering 2 bytes of TCP data (0x3ffeb103 using 0x3fff63c8),
 Buffer free 1331.
Simple GET PUT handler entering state 3.
 Response: {"fw_ver":"0.2.0+debug","httpd_ver":"0.0.7","dbffs_ver":"0.1.0"}.
Buffering 64 bytes of TCP data (0x3fff69c8 using 0x3fff63c8),
 Buffer free 1267.
Simple GET PUT handler leaving state 5.
 Data has been buffered.
Sending buffer 0x3fff7d64 using connection 0x3fff63c8.
Sending 173 bytes of TCP data (0x3fff7d64 using 0x3fff63c8),
 espconn pointer 0x3fff6090.
HTTP/1.1 200 OK
Connection: close
Server: slighttpd
Content-Length: 64
Content-Type: application/json

{"fw_ver":"0.2.0+debug","httpd_ver":"0.0.7","dbffs_ver":"0.1.0"}

Then comes the crash.

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.