Home automation

Few would argue that having lights turned on in a room without occupant is a waste of electricity. Ideally, lights and other appliances like air conditioners would only be turned on when someone is around. This project is a Node.js application that gathers data about the occupancy of an apartment and manages appliances accordingly.

Over the years, I modified all the lights, air conditioners and heaters of my apartment so as to control them via MQTT. In the process, I also deployed multiple sensors among which are PIR motion sensors. This node app is subscribed to the MQTT topics of all motion sensors and determines in which room I am based on which sensor was triggered last. To detect if I left the apartment, my smartphone is set to make an API call to the Node.js app whenever it no longer finds my Wi-Fi to connect to. Thus, the app can publish MQTT messages to the appliances according to where it has established that I am.

Source code available on GitHub