Home AMX User Forum AMX Technical Discussion

Connexion to a Zumtobel Litecom Lighting server

Hi all,

I'm trying to control lights by a customer throught HTTPS on a Zumtobel Litecom.

We've tried our request with Postman, which runs fine.

I use tls_client_open on port 443 to connect to the light server :

tls_client_open(dvIP_Litecom.port, adresseIPLiteCom, 443, 1)

When a data_event online is thrown, I send this request :

define_call 'Lumiere 100%'
{
    clear_buffer httpRequest

    httpRequest = "'PUT /rest/v1/zones/', idZone[zone],'/services/lighting HTTP/1.1 ',13,10"
    httpRequest = "httpRequest, 'Host: ', adresseIPLiteCom, 13,10"
    httpRequest = "httpRequest, 'accept:  application/json', 13,10"
    httpRequest = "httpRequest, 'Authorization:  Bearer ', token, 13,10"
    httpRequest = "httpRequest, 'Content-Type:  application/json', 13,10"
    httpRequest = "httpRequest, 'Content-Length: ', itoa(length_array(Lumiere100)), 13,10,13,10"
    httpRequest = "httpRequest, Lumiere100, 13,10"
}

But the only response I get from the server is HTTP is :

HTTP/1.1 400 Bad Request 
Content-Type: text/plain; charset=utf-8 
Connection: close 

400 Bad Request 

When I compare the request sent by postman and the request in the httpRequest buffer through debug, everything seems to match byte to byte (compared with notepad++ plugin).

Any idea would be usefull

Many thanks

Comments

  • [Deleted User][Deleted User] Harman Integrated Technologies Group (ITG) Posts: 0

    What firmware do you have? My suggestion would be to upgrade to the current hotfix and gain enhanced crypto libraries with more current cypher keys.

    https://help.harmanpro.com/nx-master

  • Latests firmwares on master and device. Controler is a NX1200.

    Thank you for help, will try it soon.

  • Latests firmwares on master and device. Controler is a NX1200.

    Latest but not the hotfix, sorry. Will try it.

  • So,

    I've tried with the hotfix firmware. No change, I always get the 400 error.

    So I updated my code from :

    tls_client_open(dvIP_Litecom.port, adresseIPLiteCom, 443, TLS_IGNORE_CERTIFICATE_ERRORS)

    to :
    tls_client_open(dvIP_Litecom.port, adresseIPLiteCom, 443, TLS_VALIDATE_CERTIFICATE)

    and I get this :

    (0000523482) TLS/SSL_connect SSL_ERROR_SSL Results Error: certificate verify failed
    (0000523483) IPSocketManConnectTask - SSL Connect error: 336134278:certificate verify failed
    (0000523486) Failed to get socket descriptor for local port 81

    Any idea would be helpfull.

  • @Vincentprems said:

    tls_client_open(dvIP_Litecom.port, adresseIPLiteCom, 443, TLS_VALIDATE_CERTIFICATE)

    and I get this :

    (0000523482) TLS/SSL_connect SSL_ERROR_SSL Results Error: certificate verify failed
    (0000523483) IPSocketManConnectTask - SSL Connect error: 336134278:certificate verify failed
    (0000523486) Failed to get socket descriptor for local port 81

    Any idea would be helpfull.

    The error indicates that the certificate hosted on the device is most likely not trusted. You could download that certificate (https://letmegooglethat.com/?q=how+to+download+certificate+from+website) and then upload it to the controller through the Certificate Manager.
    Or go back to the previous IGNORE_ERROR option - the connection was being established, issue appeared to be with the formatting of the data being sent. David Vine's amx-util-library (https://github.com/DavidVine/amx-util-library) is an excellent resource for HTML

Sign In or Register to comment.