Requete JSON HTTP

Posez ici vos questions d'utilisation, de configuration de DomoticZ, de bugs, de conseils sur le logiciel lui même dans son utilisation et son paramétrage.
Des forums spécifiques sont ouverts ci-dessous pour regrouper les différents sujets.
donk7413
Messages : 6
Inscription : 07 sept. 2017, 13:49

Requete JSON HTTP

Message par donk7413 »

Bonjour,
j’ai essayé de reproduire la fonction disco (http://domo-attitude.fr/milight-domotic ... es-discos/) (en jouant un peu plus) malheuresement j’ai une erreur domoticz a l’execution :

Code : Tout sélectionner

Error: Error opening url: http://127.0.0.1/json.htm?param=switchlight&type=command&idx=25&switchcmd=Off
Voici mon URL

Code : Tout sélectionner

https://127.0.0.1:443/json.htm?param=switchlight&type=command&idx=25&switchcmd=Off
Je précise que l’url marche (en mettant l’ip de mon RPI (192.168.1.91) depuis un navigateur et retourne OK

mais depuis domoticz ou depuis le shell avec curl, ca ne marche pas;

Shell avec curl :

Code : Tout sélectionner

pi@raspberrypi:~/domoticz $ curl -k -vvv https://127.0.0.1:443/json.htm?param=switchlight&type=command&idx=25&switchcmd=Off
[1] 11719
[2] 11720
[3] 11721
[2]-  Done                    type=command
pi@raspberrypi:~/domoticz $ * Hostname was NOT found in DNS cache
*   Trying 127.0.0.1...
* Connected to 127.0.0.1 (127.0.0.1) port 443 (#0)
* successfully set certificate verify locations:
*   CAfile: none
  CApath: /etc/ssl/certs
* SSLv3, TLS handshake, Client hello (1):
* SSLv3, TLS handshake, Server hello (2):
* SSLv3, TLS handshake, CERT (11):
* SSLv3, TLS handshake, Server key exchange (12):
* SSLv3, TLS handshake, Server finished (14):
* SSLv3, TLS handshake, Client key exchange (16):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
* Server certificate:
*        subject: C=NL; ST=MyState; O=Domoticz; L=Domoticz; CN=*.domoticz.com; OU=Unit51; emailAddress=your@email.com
*        start date: 2015-05-23 06:49:02 GMT
*        expire date: 2025-05-20 06:49:02 GMT
*        issuer: C=NL; ST=MyState; O=Domoticz; L=Domoticz; CN=*.domoticz.com; OU=Unit51; emailAddress=your@email.com
*        SSL certificate verify result: self signed certificate (18), continuing anyway.
> GET /json.htm?param=switchlight HTTP/1.1
> User-Agent: curl/7.38.0
> Host: 127.0.0.1
> Accept: */*
>
< HTTP/1.1 401 Unauthorized
< Content-Length: 91
< Content-Type: text/html
< Set-Cookie: SID=none; HttpOnly; path=/; Expires=Thu, 01 Jan 1970 00:00:00 GMT
<
* Connection #0 to host 127.0.0.1 left intact
<html><head><title>Unauthorized</title></head><body><h1>401 Unauthorized</h1></body></html>
Mon domoticz est en HTTPS Only

Avez-vous une idée ?
Raspberry Pi 3 + Domoticz Beta
Mi Home Suite , Mi Home Cube Controller, MiLight RGBWW & RGBCW E27, Milight iBox v6, Jarvis
jackslayter
Messages : 1040
Inscription : 30 sept. 2014, 14:40
Localisation : Isère (38)

Re: Requete JSON HTTP

Message par jackslayter »

laissez l'adresse "192.168.1.91" au lieu "127.0.0.1" dans le script
Raspberry Pi + RFLink + Domoticz Beta
Oregon - 3x Thgr122Nx / Chacon - micromodule 200w, télécommande 3b et 16b, 2x module 1000w, détecteur de fumée, contact de porte, 2x prise 3500w / OWL - CM180 / TRC02 v2 RGB 3M / Cheap - PIR, contact de porte
donk7413
Messages : 6
Inscription : 07 sept. 2017, 13:49

Re: Requete JSON HTTP

Message par donk7413 »

J'ai malheureusement déjà essayé, ça ne change rien.

De plus j'ai certains appels qui passe avec IFTTT et google assistant, et ils fonctionnent depuis l'adresse externe.
On dirait que le raspberry pi ne veut pas exécuter de requête lui même.
Raspberry Pi 3 + Domoticz Beta
Mi Home Suite , Mi Home Cube Controller, MiLight RGBWW & RGBCW E27, Milight iBox v6, Jarvis
jackslayter
Messages : 1040
Inscription : 30 sept. 2014, 14:40
Localisation : Isère (38)

Re: Requete JSON HTTP

Message par jackslayter »

il faut mettre des "

Code : Tout sélectionner

curl -k -vvv "https://127.0.0.1:443/json.htm?param=switchlight&type=command&idx=25&switchcmd=Off"
Raspberry Pi + RFLink + Domoticz Beta
Oregon - 3x Thgr122Nx / Chacon - micromodule 200w, télécommande 3b et 16b, 2x module 1000w, détecteur de fumée, contact de porte, 2x prise 3500w / OWL - CM180 / TRC02 v2 RGB 3M / Cheap - PIR, contact de porte
donk7413
Messages : 6
Inscription : 07 sept. 2017, 13:49

Re: Requete JSON HTTP

Message par donk7413 »

Deja essayer aussi, j'ai mis des " pour encapsuler l'URL, j'ai aussi essayer en remplacant l'IP par 192.168.1.91 (avec et sans le port)
Raspberry Pi 3 + Domoticz Beta
Mi Home Suite , Mi Home Cube Controller, MiLight RGBWW & RGBCW E27, Milight iBox v6, Jarvis
jackslayter
Messages : 1040
Inscription : 30 sept. 2014, 14:40
Localisation : Isère (38)

Re: Requete JSON HTTP

Message par jackslayter »

bizarre cela marche chez moi
Raspberry Pi + RFLink + Domoticz Beta
Oregon - 3x Thgr122Nx / Chacon - micromodule 200w, télécommande 3b et 16b, 2x module 1000w, détecteur de fumée, contact de porte, 2x prise 3500w / OWL - CM180 / TRC02 v2 RGB 3M / Cheap - PIR, contact de porte
donk7413
Messages : 6
Inscription : 07 sept. 2017, 13:49

Re: Requete JSON HTTP

Message par donk7413 »

j'ai aussi essayer avec mon mot de passe et mon login : login:mdp@ip . comme sur mes requetes externes (pour IFTTT j'ai fait comme ca), rien n'y fait, cest comme si le raspberry pi refuse de se lancer lui même les url, curl www.google.fr marche bien pourtant et le raspberry pi va sur internet
Raspberry Pi 3 + Domoticz Beta
Mi Home Suite , Mi Home Cube Controller, MiLight RGBWW & RGBCW E27, Milight iBox v6, Jarvis
jackslayter
Messages : 1040
Inscription : 30 sept. 2014, 14:40
Localisation : Isère (38)

Re: Requete JSON HTTP

Message par jackslayter »

avec un sudo ?
Raspberry Pi + RFLink + Domoticz Beta
Oregon - 3x Thgr122Nx / Chacon - micromodule 200w, télécommande 3b et 16b, 2x module 1000w, détecteur de fumée, contact de porte, 2x prise 3500w / OWL - CM180 / TRC02 v2 RGB 3M / Cheap - PIR, contact de porte
donk7413
Messages : 6
Inscription : 07 sept. 2017, 13:49

Re: Requete JSON HTTP

Message par donk7413 »

Avec sudo et sans,
Je pense avoir essayé une bonne vingtaine de combinaison.
Cela pourrait venir de la config de mon domoticz ou mon rpi ?
Raspberry Pi 3 + Domoticz Beta
Mi Home Suite , Mi Home Cube Controller, MiLight RGBWW & RGBCW E27, Milight iBox v6, Jarvis
jackslayter
Messages : 1040
Inscription : 30 sept. 2014, 14:40
Localisation : Isère (38)

Re: Requete JSON HTTP

Message par jackslayter »

faudrait essayer en HTTP simple pour voir si cela viens du SSL, après je pense pas que le pi soit en cause
Raspberry Pi + RFLink + Domoticz Beta
Oregon - 3x Thgr122Nx / Chacon - micromodule 200w, télécommande 3b et 16b, 2x module 1000w, détecteur de fumée, contact de porte, 2x prise 3500w / OWL - CM180 / TRC02 v2 RGB 3M / Cheap - PIR, contact de porte
Répondre