mattius
Posts: 87
Joined: Thu Jun 14, 2012 9:55 am

Raspi Nest: My raspbery pi learning thermostat

Sun Jan 04, 2015 10:47 am

Thought id share my latest project.

I basically wanted a nest which i could hack about with, since nest locked down their API i instantly vetoed it and decided to make my own.

So heres what i used:

Raspberry PI Model B+ (Could use an A+ i just had a B+ lying around)
Adafruit TFT Touch Sheild
WIFI Adapter
DHT22 Temperature/Humidity Sensor
PIR Sensor
Slice of Relay board

Its all written in python and with the display in pygame.

The backbone is SQL (i use an MS SQL Server), a stored procedure runs every night and calculates when the heating should come on and off by checking past movement readings (its a bit cleverer than that but i won't go into it now).

The raspberry PI checks this overnight and then decides based on these timings and the temperature whether to turn the heating on or off. If the temperature is not less that the desired temp + a configurable margin it will not turn on. Also it will only turn the heating on for 30mins, if there has been no movement in that time the heating will turn off. If movement is then sensed still within the times and the temperature is low it will turn it back on.

I also have a web interface to it so i can control it remotely and check out some funky trends and usage statistics.

Still working on the touchscreen ui, not happy with swipe (think thats mostly due to being used to capacitive touchscreens and this is resistive) but once i have that working i will fire up the code for all to have a go.

Heres my wee video of it so far

https://www.youtube.com/watch?v=zFBi23w33uc

mattius
Posts: 87
Joined: Thu Jun 14, 2012 9:55 am

Re: Raspi Nest: My raspbery pi learning thermostat

Sun Jan 04, 2015 11:16 am

In fact it will probably take me a while to finish the code, so here is the current source for you to abuse.

Apologies for the lack of comments, i will try and add them in the future, i would get sacked for issuing code like this :P

Warning it is 700 lines of code...

Code: Select all

# -*- coding: utf-8 -*-

##################################################################################
#                                                                                #
#                Raspi Nest :- Raspberry PI Learning Thermostat                     #
#                Written by : Matt Inglis                                                                #
#                Version : 0.1 Pre Release                                       #
#                                                                                #
#                This code is issued for personal use only, no commercial use of this code is allowed without prior conset      #
##################################################################################
#																				 #
#    This program is free software: you can redistribute it and/or modify        #
#    it under the terms of the GNU General Public License as published by        #
#    the Free Software Foundation, either version 3 of the License, or           #
#    (at your option) any later version.                                         #
#                                                                                #
#    This program is distributed in the hope that it will be useful,             #
#    but WITHOUT ANY WARRANTY; without even the implied warranty of              #
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               #
#    GNU General Public License for more details.                                #
#                                                                                #
#    You should have received a copy of the GNU General Public License           #
#   along with this program.  If not, see <http://www.gnu.org/licenses/>         #
#                                                                                #
##################################################################################

from __future__ import division
import pygame
import time
import math 
import os
import datetime as DT
from datetime import datetime 
from pygame.locals import *
import Adafruit_DHT
import sys
import subprocess 
from time import sleep
import RPi.GPIO as GPIO
import pyodbc
from threading import Thread
from os.path import exists

interface = "wlan0"
os.putenv('SDL_VIDEODRIVER','fbcon') 
os.putenv('SDL_FBDEV','/dev/fb1')
os.putenv('SDL_MOUSEDRV','TSLIB') 
os.putenv('SDL_MOUSEDEV','/dev/input/touchscreen')
class pitft :
    screen = None;
    colourBlack = (0, 0, 0)
 
    def __init__(self):
        "Ininitializes a new pygame screen using the framebuffer"
        # Based on "Python GUI in Linux frame buffer" 
        # http://www.karoltomala.com/blog/?p=679
        disp_no = os.getenv("DISPLAY")
        if disp_no:
            print "I'm running under X display = {0}".format(disp_no)
 
        os.putenv('SDL_FBDEV', '/dev/fb1')
 
        # Select frame buffer driver Make sure that SDL_VIDEODRIVER is 
        # set
        driver = 'fbcon'
        if not os.getenv('SDL_VIDEODRIVER'):
            os.putenv('SDL_VIDEODRIVER', driver)
        try:
            pygame.display.init()
        except pygame.error:
            print 'Driver: {0} failed.'.format(driver)
            exit(0)
 
        size = (pygame.display.Info().current_w, pygame.display.Info().current_h)
        self.screen = pygame.display.set_mode(size, pygame.FULLSCREEN)
        # Clear the screen to start
        self.screen.fill((0, 0, 0))
        # Initialise font support
        pygame.font.init()
        # Render the screen
        pygame.display.update()
 
    def __del__(self):
        "Destructor to make sure pygame shuts down, etc."

def setupBacklight():
	backlightpath = "/sys/class/gpio/gpio252"
	if not exists(backlightpath):
		try:
			with open("/sys/class/gpio/export","w") as bfile:
				bfile.write("252")
		except:
			return False
	try:
		with open("/sys/class/gpio/gpio252/direction","w") as bfile:
			bfile.write("out")
	except:
		return False
	return True

def Backlight(light):
	try:
		with open("/sys/class/gpio/gpio252/value","w") as bfile:
			bfile.write("%d" % (bool(light)))
	except:
		pass

 
# Create an instance of the PyScope class
mytft = pitft()
class ScreenMode: Home, Control, HomeChange = range(3)
 
screen = pygame.display.set_mode((320,240),pygame.FULLSCREEN)
background = pygame.Surface(screen.get_size())
background = background.convert() 
background.fill(pygame.Color("black"))
screen.blit(background, (0,0)) 
pygame.display.flip()
MaxTemp = 30
MinTemp = 0
CurrentTemp = 0 
DesiredTemp = 30
CurrentHumid = 0
CurrentWIFI = 0
HeatingOn = False 
HotWaterOn = False
LastMovement = datetime.now()
LastCheck = datetime.now() - DT.timedelta(days=2)
LastChange = datetime.now()
CurrentScreen = ScreenMode.Home
running = True
MorningOn = DT.time(0,0)
MorningOff = DT.time(0,0)
AfternoonOn = DT.time(0,0)
AfternoonOff = DT.time(0,0)
WeekendOn = DT.time(0,0)
WeekendOff = DT.time(0,0)
WeekendAftOn = DT.time(0,0)
WeekendAftOff = DT.time(0,0)
HeatingChangeTime = DT.time(0,0)
HeatingAdvanceTime = DT.time(0,0)
HeatingAlwaysOn = False
TempVariance = 0.5
HeatingAdvance = False
TempDesiredManual = False

def DrawGauge(Change):
	global MaxTemp
	global MinTemp
	global CurrentTemp
	global DesiredTemp
	global CurrentHumid
	global CurrentWIFI
	global LastMovement
	temp_range = MaxTemp - MinTemp
	if(DesiredTemp > MaxTemp):
		DesiredTemp = MaxTemp
	if(DesiredTemp < MinTemp):
		DesiredTemp = MinTemp
	#print "Temp : "+`Temp`
	temp_perc = CurrentTemp / MaxTemp
	#print "Temp : "+`Temp`+" MaxTemp : "+`MaxTemp` print "Temp Per 
	#: "+`temp_perc`
	gauge_move = 270 * temp_perc
	#print "Gauge Move : "+`gauge_move`
	surface = pygame.Surface((300,200))
	pygame.draw.arc(surface,(94,94,94),(0,0,200,200),math.radians(0),math.radians(270),5)
	if(DesiredTemp == CurrentTemp):
		pygame.draw.arc(surface,(209,255,214),(0,0,200,200),math.radians(0),math.radians(gauge_move),5)
	else:
		des_temp_perc = DesiredTemp / MaxTemp
		des_gauge_move = 270 * des_temp_perc
		pygame.draw.arc(surface,(250,160,160),(0,0,200,200),math.radians(0),math.radians(des_gauge_move),5)
		pygame.draw.arc(surface,(255,244,244),(0,0,200,200),math.radians(0),math.radians(gauge_move),5)
	surface = pygame.transform.rotate(surface,-42)
	surface = pygame.transform.flip(surface,True,False)
	
	smallerfont = pygame.font.Font(None,25)
	
	if not Change:
		MovementDelta = LastMovement + DT.timedelta(0,60)
		if(datetime.now() < MovementDelta):
			pygame.draw.circle(surface,(255,255,255),(70,55),12,0)
			lettertext = smallerfont.render("M",1,(0,0,0))
		else:
			pygame.draw.circle(surface,(255,255,255),(70,55),12,1)
			lettertext = smallerfont.render("M",1,(255,255,255))
		surface.blit(lettertext,(63,47))
		if(HeatingOn):
			pygame.draw.circle(surface,(255,255,255),(70,200),12,0)
			lettertext = smallerfont.render("H",1,(0,0,0))
		else:
			pygame.draw.circle(surface,(255,255,255),(70,200),12,1)
			lettertext = smallerfont.render("H",1,(255,255,255))
		surface.blit(lettertext,(64,192))
		if(HotWaterOn):
			pygame.draw.circle(surface,(255,255,255),(70,240),12,0)
			lettertext = smallerfont.render("W",1,(0,0,0))
		else:
			pygame.draw.circle(surface,(255,255,255),(70,240),12,1)
			lettertext = smallerfont.render("W",1,(255,255,255))
		surface.blit(lettertext,(62,232))
		if(CurrentWIFI > 0):
			FirstColor = (255,255,255)
		else:
			FirstColor = (117,117,117)
		pygame.draw.line(surface, FirstColor, (55,140), (55, 135), 3)
		if(CurrentWIFI > 25):
			FirstColor = (255,255,255)
		else:
			FirstColor = (117,117,117)
		pygame.draw.line(surface, FirstColor, (62,140), (62, 130), 3)
		if(CurrentWIFI > 50):
			FirstColor = (255,255,255)
		else:
			FirstColor = (117,117,117)
		pygame.draw.line(surface, FirstColor, (69,140), (69, 125), 3)
		if(CurrentWIFI > 75):
			FirstColor = (255,255,255)
		else:
			FirstColor = (117,117,117)
		pygame.draw.line(surface, FirstColor, (76,140), (76, 120), 3)
	
	else:
		smallerfont = pygame.font.Font(None,45)
		pygame.draw.circle(surface,(255,255,255),(70,125),12,0)
		lettertext = smallerfont.render("-",1,(0,0,0))
		surface.blit(lettertext,(65,110))
		pygame.draw.circle(surface,(255,255,255),(340,125),12,0)
		lettertext = smallerfont.render("+",1,(0,0,0))
		surface.blit(lettertext,(332,109))
		smallerfont = pygame.font.Font(None,30)
		ChangedText = smallerfont.render("Desired",1,(255,0,0))
		surface.blit(ChangedText,(174,80))
	largefont = pygame.font.Font(None, 75)
	Spacer = ""
	if(DesiredTemp < 10):
		Spacer = " "
	else:
		Spacer = ""
	if(DesiredTemp == CurrentTemp):
		if(Change):
			TempTmp = DesiredTemp
			PrintColor = (255,0,0)
		else:
			TempTmp = CurrentTemp
			PrintColor = (255,255,255)
		if(TempTmp < 0):
			largetext = largefont.render("-- °",1,PrintColor)
		else: 
			largetext = largefont.render(Spacer+`int(TempTmp)`+"°",1,PrintColor)
	else:
		if(Change):
			TempTmp = DesiredTemp
			PrintColor = (255,0,0)
		else:
			TempTmp = CurrentTemp
			PrintColor = (255,255,255)
		if(TempTmp < 1):
			largetext = largefont.render("-- °",1,PrintColor)
		else:
			largetext =largefont.render(Spacer+`int(TempTmp)`+"°",1,PrintColor)
	surface.blit(largetext,(180,110))
	d = datetime.now()
	datestring = d.strftime("%d/%m/%Y")
	timestring = d.strftime("%I:%M %p")
	smallerfont = pygame.font.Font(None,25)
	if(CurrentHumid < 10):
		Spacer = " "
	else:
		Spacer = ""
	SmallerText = smallerfont.render(Spacer+`int(CurrentHumid)`+" %",1,(255,255,255))
	surface.blit(SmallerText,(195,170))
	SmallerText = smallerfont.render(datestring,1,(255,255,255))
	surface.blit(SmallerText,(170,200))
	SmallerText = smallerfont.render(timestring,1,(255,255,255))
	surface.blit(SmallerText,(175,220))
	return surface 


def DrawScreen(JustChanged):
	global background
	global CurrentScreen
	global CurrentTemp
	global DesiredTemp
	global ScreenMode
	global screen
	global HeatingAlwaysOn
	mainsurface = pygame.Surface((650,650))
	smallfont = pygame.font.Font(None, 50)
	#print "Current : "+`CurrentScreen`
	if(CurrentScreen == ScreenMode.Home):
		SmallMessage = "Home"
		SmallText = smallfont.render(SmallMessage,1, (255,0,0))
		#background.blit(SmallText,(10,445))
		screen.blit(background, (0,0))
		mainsurface.blit(DrawGauge(False),(-40,-20))
		mainsurface.blit(SmallText,(355,395))
	if(CurrentScreen == ScreenMode.HomeChange):
		mainsurface.blit(DrawGauge(True),(-40,-20))
	elif(CurrentScreen == ScreenMode.Control):
		SmallMessage = "Advance"
		SmallText = smallfont.render(SmallMessage,1, (255,255,255))
		mainsurface.blit(SmallText,(90,5))
		if(HeatingOn):
			pygame.draw.circle(mainsurface,(255,255,255),(60,95),20,0)
			lettertext = smallfont.render("H",1,(0,0,0))
			mainsurface.blit(lettertext,(48,80))
			lettertext = smallfont.render("HEATING",1,(255,255,255))
			mainsurface.blit(lettertext,(90,80))
		else:
			pygame.draw.circle(mainsurface,(255,255,255),(60,95),20,2)
			lettertext = smallfont.render("H",1,(255,255,255))
			mainsurface.blit(lettertext,(48,80))
			lettertext = smallfont.render("HEATING",1,(255,255,255))
			mainsurface.blit(lettertext,(90,80))
		if(HotWaterOn):
			pygame.draw.circle(mainsurface,(255,255,255),(60,165),20,0)
			lettertext = smallfont.render("W",1,(0,0,0))
			mainsurface.blit(lettertext,(45,150))
			lettertext = smallfont.render("HOT WATER",1,(255,255,255))
			mainsurface.blit(lettertext,(90,150))
		else:
			pygame.draw.circle(mainsurface,(255,255,255),(60,165),20,2)
			lettertext = smallfont.render("W",1,(255,255,255))
			mainsurface.blit(lettertext,(45,150))
			lettertext = smallfont.render("HOT WATER",1,(255,255,255))
			mainsurface.blit(lettertext,(90,150))
	
	#background.fill(pygame.Color("black")) smallerfont = 
	#pygame.font.Font(None,30) SmallerText = 
	#smallerfont.render("Heating Hot Water",1,(255,0,0)) 
	#mainsurface.blit(SmallerText,(305,435))
	screen.blit(mainsurface,(0,0))
	pygame.display.flip()
	JustChanged = False
	
def Sensor(threadname, *args):
	global running
	global GPIO
	global LastMovement
	global CurrentTemp
	global CurrentHumid
	global CurrentWIFI
	global MorningOn
	global MorningOff
	global AfternoonOn
	global AfternoonOff
	global WeekendOn
	global WeekendOff
	global WeekendAftOn
	global WeekendAftOff
	global HeatingOn
	global TempVariance
	global HeatingChangeTime
	global HeatingAdvanceTime
	global HeatingAlwaysOn
	global HeatingAdvance

	counter = 0
	
	GPIO.setmode(GPIO.BCM)
	GPIO.setup(17, GPIO.IN)
	DHT_TYPE = Adafruit_DHT.DHT22
	while running:

		if(counter > 30):
			try:
				humidity, temp = Adafruit_DHT.read(DHT_TYPE, 23)
			except:
				print "SENSOR READ ERROR!"
			if humidity is not None or temp is not None:
				CurrentTemp = temp - 1.0
				CurrentHumid = humidity
				#print 'Temperature : {0:0.1f} C'.format(temp)
				#print 'Humidity : {0:0.1f} %'.format(humidity)
		if GPIO.input(17):
			#print ("Movement")
			LastMovement = datetime.now()
		if(counter>60):
			try:
				proc = subprocess.Popen(["iwlist", interface, "scan"],stdout=subprocess.PIPE, universal_newlines=True)
				out, err = proc.communicate()
				WIFI = 0
				for line in out.split("\n"):
					if("Quality=" in line):
						line = line.replace("Quality=","")
						quality = line.split()[0].split('/')
						WIFI = int(round(float(quality[0]) / float(quality[1]) * 100))
						CurrentWIFI = WIFI
						#print "WIFI : "+`WIFI`+" %"
			except:
				print "WIFI READOUT ERROR!"
		if(counter>60):
			counter = 0
		else:
			counter = counter+1
		
		#
		if(CurrentTemp > 0):
			try:
			#if(CurrentTemp > 1):
				CurrentTime = DT.datetime.now()
				MorningOnTime = CurrentTime.replace(hour=MorningOn.hour,minute=MorningOn.minute,second=MorningOn.second)
				MorningOffTime = CurrentTime.replace(hour=MorningOff.hour,minute=MorningOff.minute,second=MorningOff.second)
				AfternoonOnTime = CurrentTime.replace(hour=AfternoonOn.hour, minute=AfternoonOn.minute, second=AfternoonOn.second)
				AfternoonOffTime = CurrentTime.replace(hour=AfternoonOff.hour, minute=AfternoonOff.minute, second=AfternoonOff.second)		
				WeekendOnTime = CurrentTime.replace(hour=WeekendOn.hour, minute=WeekendOn.minute, second=WeekendOn.second)
				WeekendOffTime = CurrentTime.replace(hour=WeekendOff.hour, minute =WeekendOff.minute, second=WeekendOff.second)
				WeekendAftOnTime = CurrentTime.replace(hour=WeekendAftOn.hour, minute=WeekendAftOn.minute, second=WeekendAftOn.second)
				WeekendAftOffTime = CurrentTime.replace(hour=WeekendAftOff.hour, minute=WeekendAftOff.minute, second=WeekendAftOff.second)

				MovementDelta = LastMovement + DT.timedelta(0,1800)
				#OnChangeDelta = HeatingChangeTime + DT.timedelta(0,3600)
				if(CurrentTime.isoweekday() in range(1,6)):
					#print "Weekday loop"
					if(CurrentTime > MorningOnTime and CurrentTime < MorningOffTime):
						#
						MorningOnDelta = MorningOnTime + DT.timedelta(0,3600)
						if(CurrentTime < MorningOnDelta):
							if(CurrentTemp + TempVariance < DesiredTemp):
								if(HeatingOn == False):
									HeatingOn = True
							elif(int(CurrentTemp) >= int(DesiredTemp)):
								if(HeatingOn == True):
									HeatingOn = False
						elif(CurrentTime > MovementDelta):
							if(HeatingOn == True):
								HeatingOn = False
						else:
							if(CurrentTemp + TempVariance  < DesiredTemp):
								if(HeatingOn == False):
									HeatingOn = True
							elif(int(CurrentTemp) >= int(DesiredTemp)):
								if(HeatingOn == True):
									HeatingOn = False
						#
					elif(CurrentTime > AfternoonOnTime and CurrentTime < AfternoonOffTime):
						#
						#print "Afternoon loop"
						AfternoonOnDelta = AfternoonOnTime + DT.timedelta(0,3600)
						if(CurrentTime < AfternoonOnDelta):
							if(CurrentTemp + TempVariance < DesiredTemp):
								if(HeatingOn == False):
									HeatingOn = True
							elif(int(CurrentTemp) >= int(DesiredTemp)):
								if(HeatingOn == True):
									HeatingOn = False
						elif(CurrentTime > MovementDelta):
							#print "Movement Loop"
							if(HeatingOn == True):
								HeatingOn = False
						else:
							#print "No Movement"
							if(CurrentTemp + TempVariance < DesiredTemp):
								if(HeatingOn == False):
									HeatingOn = True
							elif(int(CurrentTemp) >= int(DesiredTemp)):
								if(HeatingOn == True):
									HeatingOn = False
					else:
						if(HeatingOn == True):
							HeatingOn = False
				#Else its the weekend
				else:
					if(CurrentTime > WeekendOnTime and CurrentTime < WeekendOffTime):
						#
						WeekendDelta = WeekendOnTime + DT.timedelta(0,3600)
						if(CurrentTime < WeekendDelta):
							if(CurrentTemp + TempVariance < DesiredTemp):
								if(HeatingOn == False):
									HeatingOn = True
							elif(int(CurrentTemp) >= int(DesiredTemp)):
								if(HeatingOn == True):
									HeatingOn = False
						elif(CurrentTime > MovementDelta):
							if(HeatingOn == True):
								HeatingOn = False
						else:
							if(CurrentTemp+TempVariance < DesiredTemp):
								if(HeatingOn == False):
									HeatingOn = True
							elif(int(CurrentTemp) >= int(DesiredTemp)):
								if(HeatingOn == True):
									HeatingOn = False
					elif(CurrentTime > WeekendAftOnTime and CurrentTime < WeekendAftOffTime):
					#	#
						WeekendAftDelta = WeekendAftOnTime + DT.timedelta(0,3600)
						if(CurrentTime < WeekendAftDelta):
							if(CurrentTemp + TempVariance < DesiredTemp):
								if(HeatingOn == False):
									HeatingOn = True
							elif(int(CurrentTemp) >= int(DesiredTemp)):
								if(HeatingOn == True):
									HeatingOn = False
						elif(CurrentTime > MovementDelta):
							if(HeatingOn == True):
								HeatingOn = False
						else:
							if(CurrentTemp + TempVariance < DesiredTemp):
								if(HeatingOn == False):
									HeatingOn = True
							elif(int(CurrentTemp) >= int(DesiredTemp)):
								if(HeatingOn == True):
									HeatingOn = False
					else:
						if(HeatingOn == True):
							HeatingOn = False
			except:
				print "Time Calcs Error!" 
		

		if(HeatingAdvance):
			HeatingAdvanceDelta = HeatingAdvanceTime + DT.timedelta(0,1800)
			if(CurrentTime > HeatingAdvanceDelta):
				HeatingAdvance = False
			else:
				HeatingOn = True
		if(HeatingAlwaysOn):
			HeatingOn = True
		
		#	
		time.sleep(1)
	GPIO.cleanup()

def SQLSender(threadname, *args):
	global running
	global CurrentTemp
	global CurrentWIFI
	global CurrentHumid
	global DesiredTemp
	global HeatingOn
	global HotWaterOn
	global LastTemps
	global LastHumids
	global LastHeatings
	global LastCheck
	global MorningOn
	global MorningOff
	global AfternoonOn
	global AfternoonOff
	global TempVariance
	global WeekendOn
	global WeekendOff
	global WeekendAftOn
	global WeekendAftOff
	global HeatingAdvanceTime
	global HeatingAlwaysOn
	global HeatingAdvance
	global HeatingDesiredManual

	firstrun = True
	Heating = 0

	while(running):
		try:
			if(CurrentWIFI > 0):
				dsn = 'sqlserverdatasource'
				user = 'user'
				password = 'password'
				database = 'TDB'
				con_string = 'DSN=%s;UID=%s;PWD=%s;DATABASE=%s;' % (dsn,user,password,database)
        			print "SQL Trying to connect"
				cnxn = pyodbc.connect(con_string)
				cnxn.timeout = 120
				print "SQL Connected"
				cursor = cnxn.cursor()		
				
				if(firstrun):
					firstrun = False
					parameters = []
					parameters.append(datetime.now())
					cursor.execute("UPDATE CONFIGTABLE SET varData=? WHERE varName='LASTBOOT'",parameters)
					cnxn.commit()
				
				cursor.execute("SELECT varData FROM CONFIGTABLE WHERE varName='HEATINGADVANCE'")
				row = cursor.fetchone()
				if row:
					if(int(row[0]) > 0):
						if(HeatingAdvance == False):
							HeatingAdvance = True
							HeatingAdvanceTime = DT.datetime.now()
					else:
						HeatingAdvance = False
				cursor.execute("SELECT varData FROM CONFIGTABLE WHERE varName='HEATINGALWAYSON'")
				row = cursor.fetchone()
				if row:
					if(int(row[0]) > 0):
						HeatingAlwaysOn = True
					else:
						HeatingAlwaysOn = False
				LastCheckDelta = LastCheck + DT.timedelta(hours=2)
				if(datetime.now() > LastCheckDelta):
					if(TempDesiredManual == False):
						cursor.execute("SELECT varData FROM CONFIGTABLE WHERE varName='DESIREDTEMP'")
						row = cursor.fetchone()
						if row:
							DesiredTemp = int(row[0])
					else:
						HeatingDesiredManual = False
						parameters = []
						parameters.append(DesiredTemp)						
						cursor.execute("UPDATE CONFIGTABLE SET varData = ? WHERE varName='DESIREDTEMP'",parameters)
						cnxn.commit()
					cursor.execute("EXEC calcTimes")
					row = cursor.fetchone()
					if row:
						MorningOn = row[0]
						MorningOff = row[1]
						AfternoonOn = row[2]
						AfternoonOff = row[3]
						WeekendOn = row[4]
						WeekendOff = row[5]
						WeekendAftOn = row[6]
						WeekendAftOff = row[7]
						LastCheck = datetime.now()
						#print MorningOn
					cursor.execute("SELECT varData FROM CONFIGTABLE WHERE varName='TEMPVARIANCE'")
					row = cursor.fetchone()
					if row:
						TempVariance = float(row[0])
			
				parameters = []
				parameters.append(datetime.now())
				parameters.append(CurrentWIFI)
				parameters.append(CurrentTemp)
				parameters.append(CurrentHumid)
				MovementDelta = LastMovement + DT.timedelta(0,300)
				if(datetime.now() > MovementDelta):
					parameters.append(0)
				else:
					parameters.append(1)
				parameters.append(DesiredTemp)
				parameters.append(HeatingOn)
				parameters.append(HotWaterOn)
				if(CurrentTemp > 0):
					print "Inserting"
					cursor.execute("INSERT INTO DATATABLE VALUES(?, ?, ?, ?,?,?,?,?)",parameters)
					cnxn.commit()
					print "Complete"

				cursor.execute("SELECT varData FROM CONFIGTABLE WHERE varName = 'REBOOTDEVICE'")
				if row:
					row = cursor.fetchone()
					SQLReboot = int(row[0])
					if(SQLReboot > 0):
						cursor.execute("UPDATE CONFIGTABLE SET varData='0' WHERE varName='REBOOTDEVICE'")
						cnxn.commit()
						comand = "/usr/bin/sudo /sbin/reboot"
						process = subprocess.Popen(comand.split(), stdout=subprocess.PIPE)
						output = process.communicate()[0]

				cursor.close()
				cnxn.close()
			
		except:
			print "SQL THREAD ERROR"
		time.sleep((60*5))
	
	
def main(threadname, *args):
	global running
	global CurrentScreen
	global pygame
	global CurrentTemp
	global DesiredTemp
	global CurrentWIFI
	global LastMovement
	global CurrentScreen
	setupBacklight()
	Backlight(False)
	mousedown = False
	DrawScreen(True)
	while running:
		try:
			DrawScreen(False)
			sx,sy=screen.get_size()
			x,y=pygame.mouse.get_pos()
			b=pygame.mouse.get_pressed()
			for evnt in pygame.event.get():
				if evnt.type == pygame.QUIT:
					running = False
				if evnt.type == pygame.KEYDOWN:
					if evnt.key == pygame.K_Q:
						running = False
				if evnt.type == MOUSEBUTTONDOWN:
					timedown = datetime.now()
					pygame.mouse.get_rel()
				#if(mousedown == False):
				#	initial_x = x
				#	initial_y = y
				#	mousedown = True
				if evnt.type == MOUSEBUTTONUP:
					#if(mousedown):
					#	mousedown = False
					MouseDelta = timedown + DT.timedelta(0,0.5)
				
					swipex, swipey = pygame.mouse.get_rel()
				
					if(abs(swipex) > 150):
						print "swipex : "+`swipex`
						if(swipex > 150):
							print "swiped left"
							if(CurrentScreen == 0):
								CurrentScreen = 2
							else:
								CurrentScreen = CurrentScreen - 1
							DrawScreen(True)
							continue
						if(swipex < -150):
							print "swiped right"
							if(CurrentScreen == 2):
								CurrentScreen = 0
							else:
								CurrentScreen = CurrentScreen + 1
							DrawScreen(True)
							continue
					else:
						if(CurrentScreen == ScreenMode.HomeChange):
							if(x<150):
								DesiredTemp = DesiredTemp - 2
							if(x > (sx-150)):
								DesiredTemp = DesiredTemp+2
 							DrawScreen(True)
			MovementDelta = LastMovement + DT.timedelta(0,300)
			if(datetime.now() > MovementDelta):
				Backlight(False)
				#print "Backlight Off"
			else:
				Backlight(True)
				#print "Backlight On"
		except:
			print "MAIN THREAD ERROR!"
		time.sleep(0.2)
	Backlight(True)
	time.sleep(10)
	
		
Thread(target=main, args=('Main',1)).start()
#launch the pulse thread
Thread(target=Sensor, args=('Sensor',1)).start()

Thread(target=SQLSender, args=('SQL',1)).start()

Please note this code is provided for personal use only, i do not consent to any use of this code by any business without prior consent.
Last edited by mattius on Thu Jan 08, 2015 9:59 pm, edited 1 time in total.

ondrej1024
Posts: 144
Joined: Thu Dec 05, 2013 3:09 pm
Contact: Website

Re: Raspi Nest: My raspbery pi learning thermostat

Thu Jan 08, 2015 1:20 pm

Hi,

interesting post. Thanks for sharing. Here we are working on a very similar smart thermostat project. So far we have a working prototype. It will be mounted shortly in our office and tested in the "real world". This is a picture of the wall mountable device.
smart-thermostat.jpg
smart-thermostat.jpg (29.64 KiB) Viewed 73062 times
What's in the box:
  • RaspberryPi B
  • Watterott RPi Touch Display
  • Wifi Adapter
The DS2818B20 1-wire temperature sensor and the relay board are in a seperate box. There is currently no humidity or motion sensor.

The RPi works completely autonomously and the touch screen can be used to change the desired room temperature. But when connected to the WLAN it can also be controlled via an Android app which provides exactly the same UI.
Furthermore we have a web server which provides an HTTP API and a mySql DB so the RPi can send the temperature measurements to it (when Internet connection is available). On the Web Site you can display the temperature charts like this:
thermostat-chart.jpg
thermostat-chart.jpg (29.52 KiB) Viewed 73062 times
The WebSite UI also permits to program a weekly schedule which will be sent to the RPi so it can use it also when it's offline.

In the moment there is no auto- learning (as your projects seems to have) yet, but this is planned to add once the basic functionality works reliably.

It would be great if we could share some of our experience.

Ondrej
The Telegea.org project: https://www.telegea.org

mattius
Posts: 87
Joined: Thu Jun 14, 2012 9:55 am

Re: Raspi Nest: My raspbery pi learning thermostat

Thu Jan 08, 2015 9:42 pm

Looks like your ahead of me on the packaging :P

I've been trying to get stability before doing anything else at the moment, i think i have finally achieved that but am doing some soak testing at the moment.

The learning functionality has been the biggest nightmare so far, there are so many factors to take into account and work out what is actually needed.

I've seen a few internet based thermostats on here, yours looks one of the neatest, i wanted a learning one thought.

I've attached a few more trends which show how the system is tuning itself over the last week of being back at work.

When you say we and in our office, is this a product you are developing for market? Care to share your code?
Screen1.png
Screen1.png (32.77 KiB) Viewed 73010 times
Screen2.png
Screen2.png (22.46 KiB) Viewed 73010 times

ondrej1024
Posts: 144
Joined: Thu Dec 05, 2013 3:09 pm
Contact: Website

Re: Raspi Nest: My raspbery pi learning thermostat

Fri Jan 09, 2015 10:56 am

I agree with you that the learning functionality is a very important point. It actually gives the added value over a traditional programmable thermostat (the "smart" part). I have seen similar approaches (which differ slightly) in the commercial smart thermostat products from Nest, Tado and Netatmo.

In a first step, our learning algorithm will be based on the temperature settings from the user during the first week (like Nest). Based on these settings, a schedule will be created which will be repeated every week once it's completed. Later changes to the desired temperature at a certain time by the user will automatically modify the active schedule. That's the basic idea, but as you said, there are many things to take into consideration. The goal is to have a device which is intuitive to use and requires as little user intervention as possible. Ultimately it should help save energy (and money) while feeling still comfortable.

As to "us", we are a small company based in Italy, working both in the electronics and the geothermal business. Throwing together our competence in these two areas we have developed a remote monitoring system for geothermal heating plants. Now we want to expand the system with the controlling functionality which will be done with the thermostat.

The whole system is based on open source software and off the shelf hardware components. I will publish the projects code asap on GitHub. Just need to fix up some things and get the documentation in a better shape. We are hoping to build up a small developer community contributing to the project.

Ondrej
The Telegea.org project: https://www.telegea.org

r0binFR
Posts: 8
Joined: Wed Jan 21, 2015 4:31 pm

Re: Raspi Nest: My raspbery pi learning thermostat

Tue Jan 27, 2015 8:41 pm

Guys, your two projects are amazing, great job! ;)

i'm looking after implementing a similar project, more or less, and i struggle a bit on the GUI part.
i would like to monitor 3 temperature sensors with a live chart and gauge, and to display it on the screen connected to the Pi (usb screen, mimo 720s) with a refresh rate of 500 milliseconds!
i tried to do it with javascript which was very promising (HighCharts, Google charts libs etc), unfortunately it is too slow to have a refresh rate less than a second (on my Raspbery pi at least).
i had a look at Qt embedded but it looks like a very complex environment.

so i looked around and found your project, mattius, running on Pygame, with a very nice display.
thank you so much for the source code:
I am currently playing with it, i hope i'll manage to do something 8-)

ondrej1024, can i ask you what graphical library /what language do you use?

thanks :D

ondrej1024
Posts: 144
Joined: Thu Dec 05, 2013 3:09 pm
Contact: Website

Re: Raspi Nest: My raspbery pi learning thermostat

Wed Jan 28, 2015 10:06 am

Hi r0binFR,

our touch screen interface is actually a web page (just html and java-script code). The Pi runs the Midori browser in fullscreen mode on the framebuffer device provided by the fbtft display driver. This approach seemed a lot easier than using QT. Haven't really looked into Pygame yet.

The charts are not displayed on the touch screen. At least at this stage it didn't seem something we needed. They can be displayed only on the server Web GUI. It uses AmCharts Javascript chart library, which is free for non commercial use. But HighCharts should be very similar.

I was wondering why you would want the display to refresh every 500ms? The temperatures you are going to show will rather change in the minute time range at most. Also classic thermostats take a measurement once every minute.

Ondrej
The Telegea.org project: https://www.telegea.org

r0binFR
Posts: 8
Joined: Wed Jan 21, 2015 4:31 pm

Re: Raspi Nest: My raspbery pi learning thermostat

Wed Jan 28, 2015 10:22 am

thanks for your answer!
indeed this AmChart lib is very nice, i wish i could use it.
sadly when i load the demo in full screen, my CPU goes 100% and it doesnt sounds very lightweight for my usage (the screen size 800x480 plus the X server plus the usb plus chromium makes it slower)

reason why i want a 500ms refresh rate is that i want to watch and control a coffee machine very accurately (PID control) so i want to have very accurate temp readings and be reactive.
i can already have them in text mode, now i only have to plot them on screen but it sounds like i will have to write my own plot GUI function :lol:

i will probably make a web page with fancy graphs but later, and it wont be real time

ondrej1024
Posts: 144
Joined: Thu Dec 05, 2013 3:09 pm
Contact: Website

Re: Raspi Nest: My raspbery pi learning thermostat

Wed Jan 28, 2015 11:03 am

r0binFR wrote:reason why i want a 500ms refresh rate is that i want to watch and control a coffee machine very accurately (PID control) so i want to have very accurate temp readings and be reactive.
Well, the PID control should probably be seperated from the GUI. You can have the PID algorithm run as fast as you want but update the chart at a lower pace. But then again, what temperature sensor is fast enough to read temperatures reliably at a 500ms rate?
The Telegea.org project: https://www.telegea.org

r0binFR
Posts: 8
Joined: Wed Jan 21, 2015 4:31 pm

Re: Raspi Nest: My raspbery pi learning thermostat

Wed Jan 28, 2015 2:03 pm

i agree PID doesn't need that fast reading, it's more for my personnal information and learning of the heating system, for fine-tuning and experimentation. (espresso is an art)

I use the MAX31850K from Maxim (Adafruit board) with K type thermocouple.
https://www.adafruit.com/product/1727
http://datasheets.maximintegrated.com/e ... X31851.pdf
it has a 100ms response time, quite good stuff!

UrosRaspberry
Posts: 40
Joined: Thu Mar 27, 2014 6:36 pm

Re: Raspi Nest: My raspbery pi learning thermostat

Wed Jan 28, 2015 8:41 pm

Hey guys !
I think what you are doing is awesome ! Keep up the good work! I have been thinking about getting a DHT 22 for my pi but didn't really have a use for it . Now i have ! Could you maybe post a tutorial on how to set it up (with hdmi output since i don't have a screen ) ? Thanks!
P.S. I think it would be better if it auto-cycles from showing the current temperature and showing a graph of the last weeks temperature and humidity.

mattius
Posts: 87
Joined: Thu Jun 14, 2012 9:55 am

Re: Raspi Nest: My raspbery pi learning thermostat

Sun Feb 01, 2015 8:27 pm

Out of interest, why do you need a refresh of 500ms?

By far the best javascript charts engine i have found is flot, you can dynamically update the current trend with ajax, but i don't think the pi will handle the processing involved.

Heres another piece of code i wrote and was going to use on the PI but i never got round to making it perfect, can't remember what state its in, but it will draw you a trend in pygame. in my case using 3 arrays, LastTemps, LastHumids, LastHeatings

Code: Select all

def DrawGraph():
        global MaxTemp
        global LastTemps
        global LastHumids
        global LastHeatings

        surface = pygame.Surface((300,300))
        GraphBottom =220
        GraphRight = 60
        GraphMaxRight = 360
        GraphMaxHeight = 160
        PrevPoint = (60,60)
        PrevHumid = (60,60)
        PrevHeat = (60,60)
        PrevValue = 0
        HumidTopAdjust = (GraphMaxHeight) / 100
        PointLeftAdjust = (GraphMaxRight - GraphRight) / 288
        PointTopAdjust = (GraphMaxHeight) / MaxTemp
        for i in range(0,288):

                if(len(LastTemps) > 0):
                        if(i == 0):
                                #print HERE
                                PrevPoint = (GraphRight +(PointLeftAdjust * i),GraphBottom -(PointTopAdjust* LastTemps[i]))
                        elif(i < len(LastTemps)):
                                #print HERE2
                                pygame.draw.line(surface, (255,0,0), PrevPoint, (GraphRight +(PointLeftAdjust * i),GraphBottom -(PointTopAdjust* LastTemps[i])),1)
                                PrevPoint = (GraphRight +(PointLeftAdjust * i),GraphBottom -(PointTopAdjust* LastTemps[i]))
        for i in range(0,288):
                if(len(LastHumids) > 0):
                        if(i ==0):
                                PrevHumid = (GraphRight + (PointLeftAdjust * i),GraphBottom - (HumidTopAdjust * LastHumids[i]))
                        if(i < len(LastHumids)):
                                pygame.draw.line(surface, (0,0,255), PrevHumid, (GraphRight +(PointLeftAdjust * i),GraphBottom -(HumidTopAdjust* LastHumids[i])),1)
                                PrevHumid = (GraphRight +(PointLeftAdjust * i),GraphBottom -(HumidTopAdjust* LastHumids[i]))
        for i in range(0,288):
                PointValue = 0;
                if(len(LastHeatings) > 0):
					if( i < len(LastHeatings)):
						if(LastHeatings[i] == 0):
							PointValue = 160
						else:
							PointValue = 10
						if(i == 0):
							PrevHeat = (GraphRight, GraphBottom - PointValue)
							PrevValue = PointValue
						else:

								if(PrevValue == PointValue):
										pygame.draw.line(surface, (0,255,0), PrevHeat, (GraphRight + (PointLeftAdjust * i), GraphBottom - PointValue))
										PrevHeat = (GraphRight + (PointLeftAdjust * i), GraphBottom - PointValue)
								else:
										pygame.draw.line(surface, (0,255,0), (GraphRight + (PointLeftAdjust * i), GraphBottom - PointValue), (GraphRight + (PointLeftAdjust *i), GraphBottom - PrevValue))
										PrevHeat = (GraphRight + (PointLeftAdjust * i), GraphBottom - PointValue)
								PrevValue = PointValue
        pygame.draw.line(surface, (255,255,255), (60,60), (60, 220), 1)
        pygame.draw.line(surface, (255,255,255), (60,220), (350,220),1)
        smallfont = pygame.font.Font(None, 15)
        SmallText = smallfont.render(`MaxTemp`,1, (255,0,0))
        surface.blit(SmallText,(45,55))
        SmallText = smallfont.render('100',1, (0,0,255))
        surface.blit(SmallText,(40,65))
        SmallText = smallfont.render(`int(MaxTemp / 2)`,1, (255,0,0))
        surface.blit(SmallText,(45,135))
        SmallText = smallfont.render('50',1, (0,0,255))
        surface.blit(SmallText,(40,145))
        SmallText = smallfont.render('0',1,(255,0,0))
        surface.blit(SmallText,(50,215))
        SmallText = smallfont.render('0',1,(0,0,255))
        surface.blit(SmallText,(47,225))
        SmallText = smallfont.render('0',1,(255,255,255))
        surface.blit(SmallText,(60,225))
        SmallText = smallfont.render('-12Hours',1,(255,255,255))
        surface.blit(SmallText, (145,225))
        SmallText = smallfont.render('-24Hours',1,(255,255,255))
        surface.blit(SmallText, (260,225))
        return surface

r0binFR
Posts: 8
Joined: Wed Jan 21, 2015 4:31 pm

Re: Raspi Nest: My raspbery pi learning thermostat

Sun Feb 01, 2015 10:01 pm

thanks for this!
unfortunately i already coded the GUI functions, both gauge and plot:
Image

i have a refresh rate of 500ms with 3 thermocouples at the same time, (but it is a bit too much perhaps, as CPU usage is 40%).
it is running with Pygame above X server. It is fast enough to keep the refresh rate and measurement at the same time (i have multithread asynchronous polling)
in the future i will only need two (one for the PID, one to monitor coffee brew extraction) so it should be just fine.

the only thing that annoys me is that the temperature reading is not stable, it is always changing of 0,25° each 500ms even if the sensor is in the air or in the water. either the power supply is bad, either i need to compute an average temp and lose responsiveness.

for example, this is the kind of measurement i wish to do, but not limited to that:
http://www.home-barista.com/tips/flow-r ... 18861.html

the measurement window is 25-30 seconds (the lenght of a real espresso shot), that's why it is important to have accurate and fast response 8-)

paulv
Posts: 546
Joined: Tue Jan 15, 2013 12:10 pm
Location: Netherlands

Re: Raspi Nest: My raspbery pi learning thermostat

Mon Feb 02, 2015 12:20 am

I average three readings to get a stable value, but that will probably blow your 500Msec response rate.
It will take too long to take consecutive readings with a meaningful interval.
You may have to revert to more sensors in parallel and average those individual readings.

Paulv

harvy
Posts: 90
Joined: Mon Nov 26, 2012 1:49 pm
Location: London - UK

Re: Raspi Nest: My raspbery pi learning thermostat

Mon Feb 23, 2015 2:07 pm

Hi mattius,

I'm looking at doing something similar - in a different way but same aim i suppose!

What i have is as follows:
Pi with DS1820 sensors, a byvac relay board, and a mysql database.
Scripts wise:
1 which takes the readings from the DS1820's and writes them to a database
1 which looks at the target for each sensor(read room!) and checks if it needs to heat up or not.

Logic of what state each sensor/relay is in is based on 4 tables:
heating_off - all sensors which do not need heat
heating_on - all sensors which are requiring and getting heat
need_heating - all sensors which are demanding but not yet getting heat(ie relay not open)
too_hot - all sensors which no longer are demanding heat but are getting it (ie relay open)

Also have an adafruit pyplate to display and allow the target to be changed using up/down and rotate through sensors.

Next part of my project is the scheduler, and how to set it up. I came across your post about it learning the user/users habits and would like to know a bit more about it - could you give me the non code version of the logic that is implemented if possible? Hopefully i can implement something similar as part of my scheduler!

mattius
Posts: 87
Joined: Thu Jun 14, 2012 9:55 am

Re: Raspi Nest: My raspbery pi learning thermostat

Mon Feb 23, 2015 9:45 pm

My logic is relatively simple.

First off i do different calculations for the weekdays or weekend.

I have a base schedule, if any conditions are not met it reverts to the base schedule entry.

So i iterate through each day in a week or day for the weekend.

If its a weekday, and movement not happening between 10:00-14:00 and there was movement between 06:00 and 09:59
It adds that day time to the total. If it doesn't meet the conditions the base schedule is used.

The weekend is similar but times are different.

Once through the week it averages the time across the week. to end up with a base start time, end time and afternoon start and end time.

The PI will only turn the heating on for 30mins without sensing movement so holidays etc are not a problem. It will also only turn on the heating if the temperature is 0.75 degrees less than the target temperature.

Thats the basic logic behind it.

anita2r
Posts: 226
Joined: Sun Dec 23, 2012 6:55 pm
Location: Ottawa, Canada

Re: Raspi Nest: My raspbery pi learning thermostat

Tue Feb 24, 2015 7:22 pm

r0binFR wrote: i have a refresh rate of 500ms with 3 thermocouples at the same time, (but it is a bit too much perhaps, as CPU usage is 40%).
it is running with Pygame above X server. It is fast enough to keep the refresh rate and measurement at the same time (i have multithread asynchronous polling)
If you are using 1-wire temperature sensors such as the DS18B20, you could reduce cpu usage by offloading the management of the 1-wire bus onto a separate device, such as the HA7s from Embedded Systems. The Pi communicates with it using simple text commands over the serial UART.

Regard

anita2R

l.locke
Posts: 1
Joined: Thu Feb 26, 2015 5:52 am

Re: Raspi Nest: My raspbery pi learning thermostat

Thu Feb 26, 2015 6:00 am

Hello,
I know this thread is an old one, but its diskuss what i need.
The projects hear are great.

What I want to know is, if the project of ondrej1024 was successful and if the project is available elsewhere?
Couse i plan to do my own special heat controle based on same hardware and display. And love this simple but good looking gui.

Regards
l.locke

ondrej1024
Posts: 144
Joined: Thu Dec 05, 2013 3:09 pm
Contact: Website

Re: Raspi Nest: My raspbery pi learning thermostat

Fri Feb 27, 2015 11:37 am

Hi l.locke,

the project is progressing, even though slowly. Right now a prototype of the RPi based thermostat is installed in our office and it is controlling a fan coil, currently used for heating. Runs without big issues so far.

To cover most configurations of an HAVC (Heat, Air Ventilation, and Cooling) system, the thermostat is able to control two separate units in both heating and cooling mode. It runs autonomously a pre-configured schedule or controls a fixed temperature set manually on the touch screen. The self learning stuff still needs to be implemented. This should result in building a customised schedule from the manual user temperature settings.

The plan is to publish the project as Open Source. Will report back when it is available.

Ondrej
The Telegea.org project: https://www.telegea.org

gulliverrr
Posts: 34
Joined: Wed Jan 02, 2013 1:38 pm

Re: Raspi Nest: My raspbery pi learning thermostat

Fri Feb 27, 2015 11:58 pm

Congrats guys!!! We have done something similar but with a less pretty LCD :)
Its called HestiaPi and it is also open source and based on a Pi controlling independently heating and hot water. Temperature is read with a DS18B20 and can be connected via WiFi and/or wired to your network or the Internet. Our main focus was personal data and their security so for this reason we store everything inside RasPi without the need of an external web/cloud server, AWS or similar. This made a little more difficult the access to HestiaPi with your phone from outside your home network but its still feasible and easy once you set it up. Learning capability is in our ToDo list.
We have just started selling it on our website http://hestiapi.com/ for 100GBP (complete with nice ABS casing) or 80GBP as a maker kit and ALL code and PCB shield files are on GitHub too. We prefer your feedback over your money :)

k0Re
Posts: 1
Joined: Mon Mar 30, 2015 8:24 pm

Re: Raspi Nest: My raspbery pi learning thermostat

Mon Mar 30, 2015 8:27 pm

Hey mattius and others,

I am very new to RPi, just wounder f they are any more updates. I think this a great idea and may put one in my house. I am wondering what the finished design may look like.

Thanks,
k0re

jenifercolt
Posts: 1
Joined: Wed May 13, 2015 5:28 am

Re: Raspi Nest: My raspbery pi learning thermostat

Wed May 13, 2015 5:48 am

I’ve recently been looking at HTML/javascript charting libraries from a Mobile perspective. For Olympic season, I decided to create an interactive dashboard to explore the results of the last five Winter Olympics. I had three key requirements for my simple Olympic dashboard:
1. Interactive: Support for touch-based interactions and animations.
2. Modern look.
3. Mobile : Uncompromised performance and user experience on mobile devices.

ondrej1024
Posts: 144
Joined: Thu Dec 05, 2013 3:09 pm
Contact: Website

Re: Raspi Nest: My raspbery pi learning thermostat

Tue May 19, 2015 1:39 pm

Hi all,

I know it has been very quiet here lately regarding the RaspberryPi based thermostat but things have been progressing. The thermostat application I presented earlier in this thread is based on the Telegea platform that we have been developing for some time now. We are moving towards a community driven development model and therefore we started by putting up a blog where interested people can get information about the development of the platform. So check out this site for news and pictures, not only about the thermostat.
http://blog.telegea.org

The source code is not yet available to the public since we are still discussing about the proper open source license to use. But I hope that we can sort this out soon and involve more people in the software development.

Ondrej
The Telegea.org project: https://www.telegea.org

pakitorn
Posts: 1
Joined: Wed Jul 08, 2015 3:38 pm

Re: Raspi Nest: My raspbery pi learning thermostat

Wed Jul 08, 2015 4:03 pm

Hi, Ondrej,

What about your smart thermostat project? Is it ready now?

I think it is a great project.

Regards,

ondrej1024
Posts: 144
Joined: Thu Dec 05, 2013 3:09 pm
Contact: Website

Re: Raspi Nest: My raspbery pi learning thermostat

Thu Jul 09, 2015 7:13 am

Hi everyone,

sorry for the long delay. I have promised it a long time ago but we were not able yet to publish the Telegea source code. The license issue is really quite tricky. We are all technician here who know about electronics and software, but when it comes to legal issues we struggle quite a bit with that. We like and support the open source idea as we believe it is a much better way of doing things, but we also have to make sure the company is profitable and can support the development of the project.

That said we are close to a conclusion of our discussions and we will start publishing the projects source code next week on Github.

In the meantime the development of a custom PCB based on the Compute module is progressing. This should make a nice base for a wall mounted thermostat. Furthermore we are also integrating an XRF radio module from Wireless things (former Ciseco) which will allow to connect wireless sensor to the system. All news are on the blog.

Thanks for your interest, Ondrej
The Telegea.org project: https://www.telegea.org

Return to “Automation, sensing and robotics”

Who is online

Users browsing this forum: baetis, Bing [Bot] and 11 guests