#NEWLINE# def call_service( api , domain , service , service_data = None ) : #NEWLINE# #INDENT# 'Call a service at the remote API.' #NEWLINE# try : #NEWLINE# #INDENT# req = api ( METHOD_POST , URL_API_SERVICES_SERVICE . format ( domain , service ) , service_data ) #NEWLINE# if ( req . status_code != 200 ) : #NEWLINE# #INDENT# _LOGGER . error ( 'Error calling service: %d - %s' , req . status_code , req . text ) #NEWLINE# #UNINDENT# #UNINDENT# except HomeAssistantError : #NEWLINE# #INDENT# _LOGGER . exception ( 'Error calling service' )