# TV simulator with blinkstick square

**URL:** <https://forums.blinkstick.com/t/tv-simulator-with-blinkstick-square/328>\
**Category:** Uncategorized\
**Created:** [December 1, 2015, 9:37pm UTC](https://forums.blinkstick.com/t/tv-simulator-with-blinkstick-square/328 "2015-12-01T21:37:10Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![ddjazz](https://forums.blinkstick.com/letter_avatar_proxy/v4/letter/d/b3f665/32.png) [@ddjazz](https://forums.blinkstick.com/u/ddjazz)\
**Post date:** [December 1, 2015, 9:37pm UTC](https://forums.blinkstick.com/t/tv-simulator-with-blinkstick-square/328/1 "2015-12-01T21:37:10Z")

</div>

There are some gadgets for sale with leds that simulate  
a working TV to pretend someone is home watching TV  
to discourage burglars.

I think the Square would be perfect to try this.  
Did anyone else try this and has some sample code?

---

<div class="post-metadata">

**Author:** ![p0ke](https://forums.blinkstick.com/user_avatar/forums.blinkstick.com/p0ke/32/14_2.png) [@p0ke](https://forums.blinkstick.com/u/p0ke)\
**Post date:** [December 1, 2015, 9:51pm UTC](https://forums.blinkstick.com/t/tv-simulator-with-blinkstick-square/328/2 "2015-12-01T21:51:46Z")

</div>

It is a great idea! Already got this idea but haven´t started yet.  
Look at this link, it is a DIY FakeTV. Maybe you can get your example out of the Arduino code (in the first post under the building instructions).

> **[PhoneyTV for Vera is Here!](https://forum.mysensors.org/topic/85/phoneytv-for-vera-is-here)**

---

<div class="post-metadata">

**Author:** ![ddjazz](https://forums.blinkstick.com/letter_avatar_proxy/v4/letter/d/b3f665/32.png) [@ddjazz](https://forums.blinkstick.com/u/ddjazz)\
**Post date:** [December 1, 2015, 9:52pm UTC](https://forums.blinkstick.com/t/tv-simulator-with-blinkstick-square/328/3 "2015-12-01T21:52:22Z")

</div>

will check it out thank you 😃

---

<div class="post-metadata">

**Author:** ![ddjazz](https://forums.blinkstick.com/letter_avatar_proxy/v4/letter/d/b3f665/32.png) [@ddjazz](https://forums.blinkstick.com/u/ddjazz)\
**Post date:** [December 12, 2015, 8:46pm UTC](https://forums.blinkstick.com/t/tv-simulator-with-blinkstick-square/328/4 "2015-12-12T20:46:57Z")

</div>

I have a first basic implementation for a fakeTV on a BS Square

```
# Import blinkstick module Compatible with square
# Displays 8 random colors emulating a television set
import time
from blinkstick import blinkstick
from random import randint,uniform
print "Requires mode 2"

bstick = blinkstick.find_first()
time.sleep(0.2)
print "Current mode={0}".format(bstick.get_mode())
time.sleep(0.2)
print "Start Time : ",time.strftime('%X')

tbl=["#FF0000","#00FF00","#0000FF","#FFFF00","#00FFFF","#FFFFFF","#000000"]

while(1):
    bstick.set_color(0, index=randint(0,7),hex=tbl[randint(0,6)])
    slice=uniform(0,1)
    time.sleep(slice)
```

---

<div class="post-metadata">

**Author:** ![p0ke](https://forums.blinkstick.com/user_avatar/forums.blinkstick.com/p0ke/32/14_2.png) [@p0ke](https://forums.blinkstick.com/u/p0ke)\
**Post date:** [December 13, 2015, 4:20pm UTC](https://forums.blinkstick.com/t/tv-simulator-with-blinkstick-square/328/5 "2015-12-13T16:20:41Z")

</div>

This is my experiment (note: I´m not very familiar with python).

```
#Import blinkstick module
from blinkstick import blinkstick
from random import randint
from time import sleep
#Find the first BlinkStick
bstick = blinkstick.find_first()

try:
    while True:
	red = randint(40,100)
	green = randint(40,100)
	blue = randint(40,100)
	white = randint(40,100)
	delay = randint(1,10)
	bstick.set_color(0, 1, white, white, white) #white
	bstick.set_color(0, 2, red, 0, 0) #red
	bstick.set_color(0, 3, 0, 0, blue) #blue
	bstick.set_color(0, 4, 0, 0, blue) #blue
	bstick.set_color(0, 5, 0, green, 0) #green
	bstick.set_color(0, 6, white, white, white) #white
	sleep(3 / delay)  	
except KeyboardInterrupt:
    pass
```

---

<div class="post-metadata">

**Author:** ![arvydas](https://forums.blinkstick.com/user_avatar/forums.blinkstick.com/arvydas/32/242_2.png) [@arvydas](https://forums.blinkstick.com/u/arvydas)\
**Post date:** [December 13, 2015, 10:11pm UTC](https://forums.blinkstick.com/t/tv-simulator-with-blinkstick-square/328/6 "2015-12-13T22:11:41Z")

</div>

Love this idea. Will add it as a pattern to the client application 😃

---

<div class="post-metadata">

**Author:** ![kirk\_bowe\_blinkstick](https://forums.blinkstick.com/letter_avatar_proxy/v4/letter/k/9de053/32.png) [@kirk\_bowe\_blinkstick](https://forums.blinkstick.com/u/kirk_bowe_blinkstick)\
**Post date:** [May 25, 2017, 10:16am UTC](https://forums.blinkstick.com/t/tv-simulator-with-blinkstick-square/328/7 "2017-05-25T10:16:45Z")

</div>

If anyone is interested in simulating TV, I just modified the above to include a range of key colours from over the course of an actual film, I guess like how an ambilight system would take average colours, and had a look at creating a selection of delays that might more closely mirror shot changes in a film. Just an idea and might make the light look more realistic from outside a window. I’ve avoided very red / orange colours for obvious reasons…

```
from time import sleep         
from blinkstick import blinkstick
from random import randint,choice

bstick = blinkstick.find_first()
hextbl=["#996666",
        "#8c7765",
        "#84634c",
        "#b19072",
        "#4e3726",
        "#8b818b",
        "#998d8c",
        "#4f2e21",
        "#4a4040",
        "#564a4b",
        "#8a7e71",
        "#7e6c58",
        "#665039",
        "#e2c79c",
        "#e4c99e",
        "#cdb8a1",
        "#8b786b",
        "#af9465",
        "#555c8e",
        "#4b4e70",
        "#52555f",
        "#bcb29f",
        "#8c5043",
        "#a68874",
        "#6c5e6f",
        "#289f88",
        "#b488a4",
        "#996d6c",
        "#3c7882",
        "#7f8175",
        "#52486e",
        "#cdc1b4",
        "#4a5051",
        "#6c797d"]

while(1):
    bstick.set_color(0, hex=hextbl[randint(0,6)])
    sleep(choice([0, 0.5, 1, 1, 2, 2, 3, 4, 4, 5, 6]))

```

Note that the above is specifically for blinkstick 1.1, as that’s what I have… To make it work for the Square you would just need to change the set\_color call to include the `index` parameter I think, and set the mode, as per the original code.
