#NEWLINE# def connect_remote_events( from_api , to_api ) : #NEWLINE# #INDENT# 'Setup from_api to forward all events to to_api.' #NEWLINE# data = { #NEWLINE# #INDENT# 'host' : to_api . host , #NEWLINE# 'api_password' : to_api . api_password , #NEWLINE# 'port' : to_api . port , #NEWLINE# #UNINDENT# } #NEWLINE# try : #NEWLINE# #INDENT# req = from_api ( METHOD_POST , URL_API_EVENT_FORWARD , data ) #NEWLINE# if ( req . status_code == 200 ) : #NEWLINE# #INDENT# return True #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# _LOGGER . error ( 'Error setting up event forwarding: %s - %s' , req . status_code , req . text ) #NEWLINE# return False #NEWLINE# #UNINDENT# #UNINDENT# except HomeAssistantError : #NEWLINE# #INDENT# _LOGGER . exception ( 'Error setting up event forwarding' ) #NEWLINE# return False