HomeJs
A framework for all things home automation and Internet-of-Things. Built using NodeJS, Angular 2, Mosquitto and MongoDB
Development server
ng serve
to run development, if hosting a server locally,otherwise npm start
points to production server
Build
Run ng build
to build the project. The build artifacts will be stored in the dist/
directory. Use the -prod
flag for a production build.
Environment Decisions
There are many ways to go about solving the problem of home automation, here I will discuss some of the alternatives and the reasons using the chosen technologies
Microcontrollers
- Hardware
- Espressif ESP8266 esp-12x
- Cheap as dirt
- Well support
- built-in-wifi (FCC certified)
- Espressif ESP8266 esp-12x
- Cheap as dirt
- Firmware
- NodeMCU
- Pros
- Lua based firmware
- Well supported
- High-level (javascript-ish)
- Reasonably fast
- Cons
- Takes up more memory (combat this by building custom firmware with only needed modules)
- Pros
- Arduino (not used)
- Pros
- familiar to anyone who knows arduino
- Over-the-air updates
- VERY well supported
- Fast
- Cons
- Low-level (bad for networking)
- Pros
- NodeMCU
Device-server Communication
- Network Protocol
- MQTT (Message Queue Transport Telemetry) (Mosquitto as broker)
- Light-weight
- Built with intermittent connectivity in mind (Will, QoS, etc)
- Publish/Subscribe
- HTTP (not used)
- Well known, robust
- More overhead
- Does not fit this projects requirments as well as MQTT
- MQTT (Message Queue Transport Telemetry) (Mosquitto as broker)
Server
- NodeJS/Express
- Non-blocking IO, (which there is a great deal of with so much connectivity)
- Familiar to developer
- Shared language on front-end and back-end
Database
- MongoDB