def __init__(self, thing, data): Event.__init__(self, thing, 'proximity', data=data) if self.data is True: GPIO.output(24, GPIO.HIGH) thing.properties['led'].value.last_value = True elif self.data is False: GPIO.output(24, GPIO.LOW) thing.properties['led'].value.last_value = False
def __init__(self, thing, data): Event.__init__(self, thing, 'overheated', data=data)
output = StreamOutput() self.picam.start_recording(output, format='mjpeg') except: syslog.syslog('Error setting up recording!') while not self.terminated: self.picam.wait_recording(2) self.picam.stop_recording() output.close() global _loop, new_frame if __name__ == '__main__': _loop = get_event_loop() new_frame = Event() picamera_web_thing = PiCameraThing() server = WebThingServer(SingleThing(picamera_web_thing), port=8900, additional_routes=[ (r'/media/stream', StreamHandler), (r'/media/snapshot', SnapshotHandler) ]) try: syslog.syslog('Starting the Webthing server on: ' + str(server.hosts)) server.start() except KeyboardInterrupt: picamera_web_thing.terminated = True picamera_web_thing.cam_thr.join() finally:
def __init__(self, thing, data): logging.debug("Overheated event") Event.__init__(self, thing, 'overheated', data=data)
def __init__(self, thing, data=None): Event.__init__(self, thing, name='alarm', data=data) logging.debug("Alarm event")
def __init__(self, thing, data): Event.__init__(self, thing, 'proximity', data=data)
def __init__(self, thing, data): """Initialize the event.""" Event.__init__(self, thing, 'playlistUpdated', data=data)
def __init__(self, thing, data): Event.__init__(self, thing, "overheated", data=data)