Hello!
Welcome to the project that, in the beginning, was not bee in my bonnet, but after a light bulb moment, it crystallized.
Today I would like to show you the expansion of the previous Project: Smart Bulb Cop Car, which will imitate TV as a simple line of defense against thieves and burglars. During summertime,e we tend to travel,l and if there is a simple way to increase home security – we should at least give it a try.
For the full context, please refer to the previous project description, where you can find the complete equipment I’m going to use, as well as the setup and configuration description.
To fulfill my need for this project, I need Raspberry Pi and 2 Smart Light Bulbs – Bluetooth Speaker is not mandatory. Without further ado, let’s explain the basic concept!
Concept
The idea of the project straightforward are. While online shopping, I’ve been interested in some devices in the ‘Home Security’ category, small devices -‘ burglar and intruders deterrent or ‘fake tv simulator.’ So what is the purpose?
As we can read on Alarms4Life – Best Fake TV Light Simulator:
It doesn’t cost very much and can instantly put off an impulsive burglar. Getting a dummy TV light box is a surprisingly good security add-on.
So, the primary thought is to imitate real TV switched on (implicitly – being watched) by changing color, brightness,s, and flickering. It has to trick burglars that there are people at home.
The basic idea is to set a timer or perform a few hours of ‘lightning’ after dusk (discovered by the light sensor).
Also, it should not consume a lot of power (be cheaper than left TV switched on) and be powered by an external power source.
Reviews on Alarms4Life pointed as unfavorable, e.g.:
- Light issues – “might appear that’s fake“, “looks more like decorative lightning“;
- Dusk detector issues – “light sensor to sensitive“, “doesn’t always turn on and needs to be manually switched on instead“
I think with a simple RPi computer and smart lightbulbs,s we can fix all those issues and build DIY Fake TV simulator for private purposes to look like I’m at home while being away for holidays!😉

Core Code
There is a predefined Movie mode with Yeelight lightbulb, but I prefer to write it myself to make it more random.
Let’s start with date checking:
import datetime
max_date = datetime.date(2020, 7, 1)
today = datetime.date.today()
print(f"maxdate: {max_date}")
print(f"today:{today}")
print(f"are we before max_date?:{today<max_date}") #is today BEFORE max_date?
We have the correct output:
maxdate: 2020-07-01
today:2020-06-24
are we before max_date?: True
We also need to check whether we are after dusk and before the end hour (dusk_plus).
Let’s imagine we would like to watch tv for 4 hours from 7pm till 11:30:
dusk = datetime.time(19,00)
curr_time = datetime.datetime.now().time()
print(f"dusk: {dusk}")
print(f"curr_time: {curr_time}")
print(f"are we after dusk? {curr_time>dusk}") #are we AFTER DUSK?
dusk_plus = datetime.time(23,30)
print(f"dusk_plus: {dusk_plus}")
print(f"are we between dusk and dusk_plus? {(curr_time>dusk)&(curr_time<dusk_plus)}")
With the correct output:
maxdate: 2020-07-01
today: 2020-06-24
are we before max_date?: True
dusk: 19:00:00
curr_time: 19:31:16.606857
are we after dusk? True
dusk_plus: 23:30:00
are we between dusk and dusk_plus? True
To simplify, let’s create two variables: correct_date and correct_tim,e and build a simple loop scheme:
while(correct_date):
curr_time = datetime.datetime.now().time() #get current_time again
correct_time = (curr_time>dusk)&(curr_time<dusk_plus) #check if we are between
if(correct_time): #do the rest
light_tricks()
correct_date = datetime.date.today()<max_date #check the date range
Now we need to extend the light_tricks().
After the experiment,s I decided to change brightness more often (to avoid ‘disco effect’ instead of ‘TV effect’) and use the SystemRandom function, which is more random than typical randint(min, max).
I was also considering defining some setups, e.g.,. ‘news’ (more blue-like colors), music (less bright, changing colors more often), ‘movies’ (more bright, dynamic changes,) but there is no point. If you are cur interested in this kind of experiment,t feel free 😊
So, my code of the light_tricks() is below:
print(f'correct_time {curr_time}') #just for debug purpose
if(not bulb_turned):
bulbR.turn_on()
bulbL.turn_on()
bulb_turned = True
#I want to change brightness more often
bulbL.set_brightness(sysRandom.randint(0,70))
sleep(0.5)
bulbR.set_brightness(sysRandom.randint(0,70))
sleep(0.5)
sleep(sysRandom.randint(1,3))
bulbL.set_brightness(sysRandom.randint(0,70))
sleep(0.5)
bulbR.set_brightness(sysRandom.randint(0,70))
sleep(0.5)
sleep(sysRandom.randint(1,3))
#once a while new set of colors
bulbL.set_rgb(sysRandom.randint(0,255),sysRandom.randint(0,255),sysRandom.randint(0,255))
bulbR.set_rgb(sysRandom.randint(0,255),sysRandom.randint(0,255),sysRandom.randint(0,255))
sleep(sysRandom.randint(1,5))
bulbL.set_brightness(sysRandom.randint(0,70))
sleep(0.5)
bulbR.set_brightness(sysRandom.randint(0,70))
sleep(0.5)
Costs
After finishing the code, I started to ask myself: is it really worth it?
Simple Fake TV device costs between 10-25 £, so 12.5-31$ or 11-28 €.
Let’s choose one currency for better counting. I’ll go in US dollars.
RPI 4B costs around 45 $, so 1.5-2 times more. But you can buy them in the different sore, or choose RPI 3B which is cheaper – around 30-35$ (the same price as the more expensive FAKE TV)
RPI 4B draws 3.4 watts which is less than typical FAKE TV devices (and we can reduce this level with RPI 3B) – their power consumptions start with 3 watts up to 7 watts.
The most expensive part of the gear is Smart Lightbulbs – I can’t praise them, but one costs around 20$.
To sum up:
RPi 4B | RPi 3B |
---|---|
Device cost: 45$ | Device cost: 30$ |
Lightbulbs: 2x 20$ | Lightbulbs: 2x 20$ |
Total: 85$ | Total: 70$ |
Power consumption: 3.4 Watt | Power consumption: 2.9 Watt |
On the contrary Fake TV costs between 12 and 30 $.
Is it worth it to buy RPI and light bulbs? Definitely – using all this,s you can extend your knowledge, create many DYI projects, and of course,e switch on and off the bulbs remotely. And remember, that I used here 2 bulbs for one TV – you can split them into two rooms and be even more realistic with deterring burglars 😉
Final effect and conclusion
My end result you can enjoy here:
And the final code:
from yeelight import Bulb
from time import sleep
import datetime
import random
max_date = datetime.date(2020, 7, 1)
today = datetime.date.today()
print(f"maxdate: {max_date}")
print(f"today:{today}")
print(f"are we before max_date?:{today<max_date}") #is today BEFORE max_date?
dusk = datetime.time(19,00)
curr_time = datetime.datetime.now().time()
print(f"dusk:{dusk}")
print(f"curr_time:{curr_time}")
print(f"are we after dusk? {curr_time>dusk}") #are we AFTER DUSK?
dusk_plus = datetime.time(23,30)
print(f"dusk_plus:{dusk_plus}")
print(f"are we between dusk and dusk_plus? {(curr_time>dusk)&(curr_time<dusk_plus)}")
correct_date = today<max_date #TRUE
bulbR = Bulb("192.168.0.157")
bulbL = Bulb("192.168.0.45")
bulb_turned = False #simple flag
while(correct_date):
curr_time = datetime.datetime.now().time()
correct_time = (curr_time>dusk)&(curr_time<dusk_plus)
sysRandom = random.SystemRandom()
print('correct date') #heartbeat
if(correct_time):
print(f'correct_time {curr_time}') #just for debug purpose
if(not bulb_turned):
bulbR.turn_on()
bulbL.turn_on()
bulb_turned = True
#I want to change brightness more often
bulbL.set_brightness(sysRandom.randint(0,70))
sleep(0.5)
bulbR.set_brightness(sysRandom.randint(0,70))
sleep(0.5)
sleep(sysRandom.randint(1,3))
bulbL.set_brightness(sysRandom.randint(0,70))
sleep(0.5)
bulbR.set_brightness(sysRandom.randint(0,70))
sleep(0.5)
sleep(sysRandom.randint(1,3))
#once a while new set of colors
bulbL.set_rgb(sysRandom.randint(0,255),sysRandom.randint(0,255),sysRandom.randint(0,255))
bulbR.set_rgb(sysRandom.randint(0,255),sysRandom.randint(0,255),sysRandom.randint(0,255))
sleep(sysRandom.randint(1,5))
bulbL.set_brightness(sysRandom.randint(0,70))
sleep(0.5)
bulbR.set_brightness(sysRandom.randint(0,70))
sleep(0.5)
else:
bulbR.turn_off()
bulbL.turn_off()
bulb_turned = False
sleep(sysRandom.randint(0,5))
correct_date = datetime.date.today()<max_date #check
Source code for this project on my Github: HeadFullOfCiphers/FakeTV
So that’s it for today 😊 I hope you like this little project, and if you have any suggestions or questions, do not hesitate to contact me!
Reference list:
- Raspberry Pi 4: Review, Tom’s Hardware
- Random, Python docs
- Best Fake TV Simulator, Alarms4Life
Wow, that’s a nice one!
I agree that money is not relevant here, the real currency is knowledge you gain and fun you have !
LikeLike