Google Home/Alexa/Internet Access solved

Sunlite Touch Sensitive Intelligent Control Keypad

Moderators: simonB, nick, florent, Ben

Post Reply
Posts: 2
Joined: Thu Dec 27, 2018 11:10 am

Google Home/Alexa/Internet Access solved

Post by alaistair » Thu Apr 18, 2019 2:57 pm

Folks - I know a few folk have wanted to integrate their DE3 to Google Home, etc.
As this isn't currently supported - I looked into alternate ways of doing this.
So my solution was to have a small raspberry pi pc on my network - this would then run a small python script
The python script would create a mini webserver and listen on a web port for incoming requests.
I formatted the url so that you could have pagenumber and scene.
This would then send a TCP string to the DE3 to selec the desired scene.

I then configured my router to allow the resberry pi to receive incoming requests from the internet....

The using the service IFTTT I created triggers that would call the webhooks service to call my lights to change them.

Python code is below....
Feel free to reach out to me at for more info/help

If I get enough interest, I can write up a fuller set of instructions....

# Python Script To Control stick Lights

# Load libraries
import time
import socket
from bottle import route, run, template

#IP Address of StickDE3
TCP_IP = ''
#Port Number for Commands to StickDE3
TCP_PORT = 2431
#See Programmers guide for message format. Should be preamble + scene (page*50+scene number) + postamble
BASEMESSAGE = "Stick_3Am\00\00\00\00\01\00\00\00\00\00\00\00\00\00\00"

# Handle http requests to the root address
def index():
return 'Go away.'

# Handle http requests to /stick
def stick(page=0,scene=0):
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
#Connect to Stick Controller
s.connect((TCP_IP, TCP_PORT))
#Create command string based on page*50 + scene
lightingcommand = bytearray(BASEMESSAGE,'ascii')
#insert the scene into bytes 10 and 11
print (lightingcommand)
#Send command to lighting controller
#Receive lighting controller response
#First clear last message received
data = s.recv(BUFFER_SIZE).decode()
#Wait for new scene to fire
#Read current scene
data = s.recv(BUFFER_SIZE).decode()
#Console debug
#break up response to current zone and scene
print (zonename, scenename)

#send response back to web service
return template("page {{page}}, scene {{scene}} selected\n{{zonename}} {{scenename}}", page=page, scene=scene, zonename=zonename, scenename=scenename)

#Listen to port 8000 for incoming requests
run(host='', port=8000)

Post Reply