#NEWLINE# def run( self ) : #NEWLINE# #INDENT# 'Run the process to export the data.' #NEWLINE# while True : #NEWLINE# #INDENT# event = self . _queue . get ( ) #NEWLINE# if ( event == self . _quit_object ) : #NEWLINE# #INDENT# _LOGGER . debug ( 'Event processing thread stopped' ) #NEWLINE# self . _queue . task_done ( ) #NEWLINE# return #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( event . event_type == EVENT_STATE_CHANGED ) and event . data . get ( 'new_state' ) ) : #NEWLINE# #INDENT# _LOGGER . debug ( 'Processing STATE_CHANGED event for %s' , event . data [ 'entity_id' ] ) #NEWLINE# try : #NEWLINE# #INDENT# self . _report_attributes ( event . data [ 'entity_id' ] , event . data [ 'new_state' ] ) #NEWLINE# #UNINDENT# except Exception : #NEWLINE# #INDENT# _LOGGER . exception ( 'Failed to process STATE_CHANGED event' ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# _LOGGER . warning ( 'Processing unexpected event type %s' , event . event_type ) #NEWLINE# #UNINDENT# #UNINDENT# self . _queue . task_done ( )