Shubham Ghodake
Published © GPL3+

Home Automation with google Assistant

The Home automation project which controls light and monitors room temperature and sends emergency msg in case of high temperature.

BeginnerFull instructions provided2 hours248
Home Automation with google Assistant

Things used in this project

Hardware components

Bolt WiFi Module
Bolt IoT Bolt WiFi Module
×1
LED (generic)
LED (generic)
×1
Buzzer
Buzzer
×1
Temperature Sensor
Temperature Sensor
×1
Breadboard (generic)
Breadboard (generic)
×1

Software apps and online services

ubuntu
ifttt
wayScript
twilio
google assistant

Story

Read more

Schematics

Circuit Connection

Circuit Connection with boltiot

Code

wayScript code

Python
it is code that is written on the wayScript python IDE
from boltiot import Bolt
import json, time

API_KEY = "XXXX"
DEVICE_ID = "XXXX"

mybolt = Bolt(API_KEY, DEVICE_ID)
response = mybolt.analogRead("A0")
data = json.loads(response)
if int(data["success"]) != 1:
    outputs['message'] = 'Device not Responding or Device is offline'

else:
    sensor_value = int(data['value'])
    temp =  (100*sensor_value)/1024
    outputs[ 'message' ] = 'The Room temperature is ' + str("{:.1f}".format(temp)) + u"\N{DEGREE SIGN} Celsius"

Ubuntu code

Python
this is the code which is run after 30 second of interval on ubuntu server
import json, time
from config import *
from boltiot import Bolt, Sms

max = 40
myBolt = Bolt(API_KEY, DEVICE_ID)
sms = Sms(SID, AUTH_TOKEN, TO_NUMBER, FROM_NUMBER)

while True:
    print("Reading Sensor value")
    response = myBolt.analogRead('A0')
    data = json.loads(response)
    print("Sensor value is ",data['value'])

    try:
        temp = int(data['value'])/10.24
        print("Temp is ",temp)
        if temp > max:
            myBolt.digitalWrite('1', 'HIGH')
            response = sms.send_sms("The current temperature sensor value is ",+str(temp)+' It looks like something unexcepted happen')
            print("Response recevied from Twilio is ",str(response))
            print("Status of SMS at Twilio is: ",str(response.status))
            time.sleep(1800)
    except Exception as e:
        print("Error occured")
        print(e)
    myBolt.digitalWrite('1', 'LOW')
    time.sleep(30)

Credits

Shubham Ghodake
1 project • 0 followers
Contact

Comments

Please log in or sign up to comment.