Professional Documents
Culture Documents
IoT Lab Task-2
IoT Lab Task-2
Lab Task – 2
Name: Suhas Siriprole Reg.No: 18BEC0327 Slot: L15+L16
Question:
Design an IoT application that controls the lights, household appliances present
in a home. The application should control and decide the course of relevant
action across the following rooms:
a. Level of illumination (Energy Efficient Lighting - EEL) in Kitchen,
Living and Bedrooms.
b. Airflow in kitchen and rest rooms
c. Humidity and temperature-based operation of Air Conditioners (AC) in
the aforesaid rooms. Also, manual or automatic mode of AC operation.
d. Also, the Television set present in living room must be monitored.
The above functionality must be realized in IoTiFY platform with the template
(Smart Home) coded in C language.
Solution:
Codes are written is JavaScript
Initialize:
{
state.rooms = {
living: { id: 1, name: "Living Room", occupancy: true, temperature:
55, lights: true, tv: true, aircondition: true},
bedroom: { id: 2, name: "Bed Room", occupancy: false, temperature: 60,
lights: false, aircondition: false},
kitchen: { id: 3, name: "Kitchen", occupancy: false, temperature: 58,
lights: false, airflow: false},
restroom: { id: 4, name:"Restroom", occupancy: false, lights: false,
airflow: false}
};
}
Message Generator:
{
// Generate Random Hour of the Day in 24Hr Format
let currentHour = chance.integer({min: 0, max: 23});
console.log("The Hour of the Day is: " + currentHour);
// Restroom is OFF
state.rooms.restroom.occupancy = false;
state.rooms.restroom.lights = false;
state.rooms.restroom.airflow = false;
Response Handler:
{
try {
let cmd = JSON.parse(response);
if (cmd)
{
state = Object.assign(state, cmd);
}
}
catch(e){
console.log(e.message)
}
}
Simulation:
Simulation is done with –
• Number of Clients: 5
• Repeat Message: 1
• Rest as Default
Simulation State Results: CSV
Result:
Successfully designed an IoT application that controls the lights,
household appliances present in a home with given specifications. Functionality
has been realized in IoTify Platform with template (Smart Home) coded in
JavaScript Language.
----------------------------------------------X------------------------------------------------