import os
import time

from threading import Thread


COMMAND_LIGTH_ON = 'LIGTH_ON'
COMMAND_LIGTH_OFF = 'LIGTH_OFF'
COMMAND_STOP = 'STOP'


pipe_name = '/tmp/heimdall'


class Controller(object):

    _light_status = 0
    _red_light_status = 0
    _running = False

    def start(self):
        thread_commands = Thread(target=self._listen_to_commands)
        thread_onrunning = Thread(target=self._on_running)
        self._running = True
        thread_commands.start()
        thread_onrunning.start()

    def _listen_to_commands(self):
        if not os.path.exists(pipe_name):
            os.mkfifo(pipe_name)
        with open(pipe_name) as f:
            while self._running:
                command = f.read()
                if command:
                    command = command.rstrip('\r\n')
                    print ('Received: {0}'.format(command))
                    self.execute(command)
            os.remove(pipe_name)

    def _on_running(self):
        while self._running:
            print ("RUN")
            time.sleep(2)

    def light_on(self):
        self._light_status = 1
        self._red_light_status = 0

    def light_off(self):
        self._running = False

    def stop(self):
        self._running = False

    def execute(self, command):
        if command == COMMAND_LIGTH_ON:
            self.light_on()
        elif command == COMMAND_LIGTH_OFF:
            self.light_off()
        elif command == COMMAND_STOP:
            self.stop()

@@ -1043,63 +1043,375 @@
 (2)%0A
-%0A    def light_on(self):%0A        self._light_status = 1
+            if not self.is_enlightening:%0A                self.red_light_on()%0A                time.sleep(0.2)%0A                self.red_light_off()%0A%0A    @property%0A    def is_enlightening(self):%0A        return self._light_status%0A%0A    def light_on(self):%0A        self._light_status = 1%0A%0A    def light_off(self):%0A        self._light_status = 0%0A%0A    def red_light_on(self):
 %0A   
@@ -1432,33 +1432,33 @@
 _light_status = 
-0
+1
 %0A%0A    def light_
@@ -1443,32 +1443,36 @@
 us = 1%0A%0A    def 
+red_
 light_off(self):
@@ -1483,38 +1483,43 @@
      self._r
-unning = False
+ed_light_status = 0
 %0A%0A    def st
@@ -1651,32 +1651,65 @@
 self.light_on()%0A
+            self.red_light_off()%0A
         elif com
@@ -1776,37 +1776,131 @@
     
-elif command == COMMAND_STOP:
+    self.red_light_on()%0A        elif command == COMMAND_STOP:%0A            self.light_off()%0A            self.red_light_off()
 %0A   

Add some properties