ram222
Created January 25, 2018 © GPL3+

Home Warm Home ... Here I come

Tired of having to anticipate WHEN you will be home To SCHEDULE your SAFE space heaters on/off? Connect on the Fly ... BEFORE you arrive!

AdvancedFull instructions provided16 hours107
Home Warm Home ... Here I come

Things used in this project

Story

Read more

Schematics

Project Flow

Code

camera.py

Python
This was the Camera tool to view results during remote testing via TeamViewer Session VNC'd to my Pi
from picamera import PiCamera
from time import sleep

camera = PiCamera()
camera.rotation = 180
camera.start_preview()
sleep(5)
camera.capture('/home/pi/Desktop/image.jpg')
camera.stop_preview()

livroom.lircd.conf

JSON
My LIRC KEY library created during LIRC Configuration.
# Please take the time to finish this file as described in
# https://sourceforge.net/p/lirc-remotes/wiki/Checklist/
# and make it available to others by sending it to
# <lirc@bartelmus.de>
#
# This config file was automatically generated
# using lirc-0.9.4c(default) on Fri Feb  9 18:21:53 2018
# Command line used: -d /dev/lirc0 -f /etc/lirc/own_remote.conf
# Kernel version (uname -r): 4.9.59-v7+
#
# Remote name (as of config file): livroom
# Brand of remote device, the thing you hold in your hand:
# Remote device model nr:
# Remote device info url:
# Does remote device has a bundled capture device e. g., a
#     usb dongle? :
# For bundled USB devices: usb vendor id, product id
#     and device string (use dmesg or lsusb):
# Type of device controlled
#     (TV, VCR, Audio, DVD, Satellite, Cable, HTPC, ...) :
# Device(s) controlled by this remote:

begin remote

  name  livroom
  flags RAW_CODES|CONST_LENGTH
  eps            30
  aeps          100

  gap          106646

      begin raw_codes

          name KEY_UP
             8857    4384     628     489     624     495
              621     494     623     491     625     490
              630     489     622     493     623     511
              625    1686     567    1630     623    1628
              630    1622     626    1686     568    1627
              626    1625     628    1653     620     493
              621    1629     626    1627     626     492
              623     491     626     493     627     542
              568     511     626    1627     627     489
              625     491     626    1624     627    1629
              625    1629     624    1628     626    1642
              627

          name KEY_DOWN
             8861    4378     629     491     625     492
              624     552     564     491     625     496
              620     492     624     494     622     513
              623    1631     628    1624     623    1631
              624    1629     623    1630     624    1630
              624    1628     626    1649     623    1631
              624    1632     620    1630     624    1630
              624    1625     627     495     622     493
              623     513     623     491     624     493
              623     492     624     493     623     492
              625    1629     625    1633     620    1643
              628

          name KEY_POWER
             8863    4380     632     486     629     489
              628     486     630     487     629     487
              627     486     630     487     629     511
              625    1680     573    1621     632    1622
              630    1623     629    1622     632    1623
              630    1623     629    1643     629     487
              634    1618     631     487     630     484
              630    1624     629     489     628     486
              633     506     632    1620     630     486
              629    1622     632    1622     630     488
              630    1626     625    1623     631    1642
              630

          name KEY_H
             8870    4373     631     489     628     490
              626     489     626     490     628     488
              626     487     628     488     629     509
              627    1624     631    1621     631    1625
              629    1624     630    1623     632    1620
              632    1682     571    1644     630     489
              627     488     628    1623     629     489
              628     487     627     489     629     485
              629     508     628    1622     633    1622
              631     486     628    1625     628    1626
              629    1623     632    1621     631    1644
              627

      end raw_codes

end remote

heatpower.sh

Powershell
My SEND command from the LIRC module which in turn was my model for Lambda
irsend SEND_ONCE "livroom" KEY_POWER

index.php

Python
Interface for AWS
<?php
$output  =  shell_exec('irsend SEND_ONCE "livroom" KEY_POWER');
print <<< EOT
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>YAY!!</title>
</head>
<body>
<h1>-$output- Test successful<h1>
<p>Yabba  Dabba  Doooo !</p>
<p>This freakin thing is Working</p>
</body>
</html>
EOT;

?>

Arduino

Python
===================================================================

************************************************************
**************************************

#include "DHT.h"

#define DHTPIN 7 // what digital pin we're connected to

// Uncomment whatever type you're using!

#define DHTTYPE DHT11 // DHT 11

//#define DHTTYPE DHT22 // DHT 22 (AM2302), AM2321

//#define DHTTYPE DHT21 // DHT 21 (AM2301)

// Initialize DHT sensor.

DHT dht(DHTPIN, DHTTYPE);

void setup() {

Serial.begin(9600);

dht.begin();

}

void loop() {

// Wait a few seconds between measurements.

delay(2000);

// Reading temperature or humidity takes about 250 milliseconds!

int h = dht.readHumidity();

// Read temperature as Celsius (the default)

int t = dht.readTemperature();

Serial.print("Humidity: ");

Serial.print(h);

Serial.print("\t"); // for splitting

Serial.print("Temperature: ");

Serial.print(t);

Serial.print("\n"); // for new line

}

======================================================================

************************************************************
*******************************************

read_arduino.py

Python
=====================================================================

************************************************************
*****************************************

import serial

import time

import MySQLdb as mdb

arduino = serial.Serial("/dev/ttyACM0") // make sure you write correct
serial

arduino.baudrate=9600

data = arduino.readline()

time.sleep(2)

data = arduino.readline()

pieces =data.split("\t")

temperature = pieces[0]

humidity = pieces[1]

======================================================================

************************************************************
*******************************************

Credits

ram222

ram222

1 project • 0 followers
just a guy tryin' to make my way in an IoT world

Comments