Configurar via API

Habilitar Modo Online via API 1º

Para habilitar o Modo Online via API deverá ser realizado primeiramente a request apontando o servidor de envio de eventos e após realizado a requisição para configuração dos parametros de keep alive (Habilitar Modo Online via API 2º).

Requisição - GET

http://192.168.1.201/cgi-bin/configManager.cgi?action=setConfig&PictureHttpUpload.Enable=true&PictureHttpUpload.UploadServerList[0].Address=192.168.1.200&PictureHttpUpload.UploadServerList[0].Port=3000&PictureHttpUpload.UploadServerList[0].Uploadpath=/notification

paramtypedescription
setConfig *StringComando para cadastrar configuração
Enable *NumberHabilita/Desabilita o servidor de envio
Address *NumberEndereço do Servidor
Port *NumberPorta do Servidor
Uploadpath *NumberPath do Servidor, exemplo "/notification"
🚨

Importante: Verifique sempre as configurações de rede do seu produto, como Endereço de IP e Gateway, para garantir que o mesmo esteja acessível na rede.

Exemplo de Retorno - text/plain

OK

Exemplos

 def config_online_mode(self, enable, server_address, port, path_event, device_mode, enable_keepalive, interval_keepalive, path_keepalive, timeout_keepalive, timeout_response) -> bool:
       try:
 
           url_server_config = "http://{}/cgi-bin/configManager.cgi?action=setConfig&PictureHttpUpload.Enable={}&PictureHttpUpload.UploadServerList[0].Address={}&PictureHttpUpload.UploadServerList[0].Port={}&PictureHttpUpload.UploadServerList[0].Uploadpath={}".format(
                                       str(self.ip),
                                       str(enable),
                                       str(server_address),
                                       str(port),
                                       str(path_event),
                                   )
 
           url_keepalive_config = "http://{}/cgi-bin/configManager.cgi?action=setConfig&Intelbras_ModeCfg.DeviceMode={}&Intelbras_ModeCfg.KeepAlive.Enable={}&Intelbras_ModeCfg.KeepAlive.Interval={}&Intelbras_ModeCfg.KeepAlive.Path={}&Intelbras_ModeCfg.KeepAlive.TimeOut={}&Intelbras_ModeCfg.RemoteCheckTimeout={}".format(
                                       str(self.ip),
                                       str(device_mode),
                                       str(enable_keepalive),
                                       str(interval_keepalive),
                                       str(path_keepalive),
                                       str(timeout_keepalive),
                                       str(timeout_response),
                                   )
               
           rval_events = requests.get(url_server_config, auth=self.digest_auth, stream=True, timeout=20, verify=False)  # noqa
 
           rval_keepalive = requests.get(url_keepalive_config, auth=self.digest_auth, stream=True, timeout=20, verify=False)  # noqa
 
           if rval_events.status_code != 200 or rval_keepalive.status_code != 200:
               raise Exception()
           return str(rval.text)
       except Exception:
           raise Exception("ERROR - During Set Online Mode - ")

Habilitar Modo Online via API 2º

Requisição - GET

http://192.168.1.201/cgi-bin/configManager.cgi?action=setConfig&Intelbras_ModeCfg.DeviceMode=2&Intelbras_ModeCfg.KeepAlive.Enable=true&Intelbras_ModeCfg.KeepAlive.Interval=120&Intelbras_ModeCfg.KeepAlive.Path=/keepalive&Intelbras_ModeCfg.KeepAlive.TimeOut=2000&Intelbras_ModeCfg.RemoteCheckTimeout=5

paramtypedescription
setConfig *StringComando para cadastrar configuração
DeviceMode *NumberModo de operação, padrão 2 para Modo Online
Enable *NumberHabilita/Desabilitar o KeepAlive, por padrão deverá sempre ser habilitado.
Interval *NumberIntervalo de requisições do Keep Alive, medido em Segundos. Recomenda-se o valor 10
Path *NumberPath do Servidor, exemplo "/notification"
TimeOut *StringTempo limite para o servidor responder o keep alive, recomendado 2000

Exemplo de Retorno - text/plain

OK

Exemplos

 def config_online_mode(self, enable, server_address, port, path_event, device_mode, enable_keepalive, interval_keepalive, path_keepalive, timeout_keepalive, timeout_response) -> bool:
       try:
 
           url_server_config = "http://{}/cgi-bin/configManager.cgi?action=setConfig&PictureHttpUpload.Enable={}&PictureHttpUpload.UploadServerList[0].Address={}&PictureHttpUpload.UploadServerList[0].Port={}&PictureHttpUpload.UploadServerList[0].Uploadpath={}".format(
                                       str(self.ip),
                                       str(enable),
                                       str(server_address),
                                       str(port),
                                       str(path_event),
                                   )
 
           url_keepalive_config = "http://{}/cgi-bin/configManager.cgi?action=setConfig&Intelbras_ModeCfg.DeviceMode={}&Intelbras_ModeCfg.KeepAlive.Enable={}&Intelbras_ModeCfg.KeepAlive.Interval={}&Intelbras_ModeCfg.KeepAlive.Path={}&Intelbras_ModeCfg.KeepAlive.TimeOut={}&Intelbras_ModeCfg.RemoteCheckTimeout={}".format(
                                       str(self.ip),
                                       str(device_mode),
                                       str(enable_keepalive),
                                       str(interval_keepalive),
                                       str(path_keepalive),
                                       str(timeout_keepalive),
                                       str(timeout_response),
                                   )
               
           rval_events = requests.get(url_server_config, auth=self.digest_auth, stream=True, timeout=20, verify=False)  # noqa
 
           rval_keepalive = requests.get(url_keepalive_config, auth=self.digest_auth, stream=True, timeout=20, verify=False)  # noqa
 
           if rval_events.status_code != 200 or rval_keepalive.status_code != 200:
               raise Exception()
           return str(rval.text)
       except Exception:
           raise Exception("ERROR - During Set Online Mode - ")