Calaos, Home Automation Forum
WebInput en HTTPS ne marche pas ? - Printable Version

+- Calaos, Home Automation Forum (https://calaos.fr/forum)
+-- Forum: Utilisation - Installation - Configuration (https://calaos.fr/forum/forumdisplay.php?fid=4)
+--- Forum: Calaos Installer (https://calaos.fr/forum/forumdisplay.php?fid=6)
+--- Thread: WebInput en HTTPS ne marche pas ? (/showthread.php?tid=730)

Pages: 1 2


WebInput en HTTPS ne marche pas ? - mifrey - 08-06-2017

Salut a tous,

Depuis longtemps j'utilise les WebInput sans probleme, par exemple en accedant au JSON d'OpenWeatherMap avec une url HTTP comme decrit sur le wiki.

Aujourd'hui j'essaie pour la premiere fois d'acceder a un JSON dont l'url est en HTTPS au lieu d'HTTP et ca ne semble pas marcher, j'ai une valeur zero qui est retournee a chaque fois. Comme OpenWeatherMap est aussi accessible en HTTPS, j'ai essaye et j'ai le meme probleme, ca ne marche pas en HTTPS mais ca marche en HTTP.  Est-ce normal ?


Voici les logs dans le cas ou ca marche en HTTP (input_64 est correct) :

Code:
Aug 07 15:57:48 raspberrypi calaos_server[452]: [INF] input (InputTemp.cpp:120) input_64: 23 °C
Aug 07 15:57:48 raspberrypi calaos_server[452]: [INF] server (CalaosConfig.cpp:276) State cache file written successfully (/home/root/.cache/calaos/iostates.cache)
Aug 07 15:57:31 raspberrypi calaos_server[452]: [ERR] websocket (WebSocket.cpp:508) Can't send data, websocket is not connected
Aug 07 15:57:31 raspberrypi calaos_server[452]: [ERR] websocket (WebSocket.cpp:508) Can't send data, websocket is not connected
Aug 07 15:57:31 raspberrypi calaos_server[452]: [ERR] websocket (WebSocket.cpp:508) Can't send data, websocket is not connected
Aug 07 15:57:31 raspberrypi calaos_server[452]: [ERR] websocket (WebSocket.cpp:508) Can't send data, websocket is not connected
Aug 07 15:57:31 raspberrypi calaos_server[452]: [ERR] websocket (WebSocket.cpp:508) Can't send data, websocket is not connected
Aug 07 15:57:31 raspberrypi calaos_server[452]: [ERR] websocket (WebSocket.cpp:508) Can't send data, websocket is not connected
Aug 07 15:57:31 raspberrypi calaos_server[452]: [ERR] websocket (WebSocket.cpp:508) Can't send data, websocket is not connected
Aug 07 15:57:31 raspberrypi calaos_server[452]: [ERR] websocket (WebSocket.cpp:508) Can't send data, websocket is not connected
Aug 07 15:57:31 raspberrypi calaos_server[452]: [ERR] websocket (WebSocket.cpp:508) Can't send data, websocket is not connected
Aug 07 15:57:31 raspberrypi calaos_server[452]: [ERR] websocket (WebSocket.cpp:508) Can't send data, websocket is not connected
Aug 07 15:57:31 raspberrypi calaos_server[452]: [ERR] websocket (WebSocket.cpp:508) Can't send data, websocket is not connected
Aug 07 15:57:31 raspberrypi calaos_server[452]: [ERR] websocket (WebSocket.cpp:508) Can't send data, websocket is not connected
Aug 07 15:57:31 raspberrypi calaos_server[452]: [INF] input (InputAnalog.cpp:115) input_70: 0
Aug 07 15:57:31 raspberrypi calaos_server[452]: [INF] input (InputAnalog.cpp:115) input_68: 70
Aug 07 15:57:31 raspberrypi calaos_server[452]: [INF] input (InputAnalog.cpp:115) input_67: 1.5
Aug 07 15:57:31 raspberrypi calaos_server[452]: [INF] input (InputAnalog.cpp:115) input_66: 1018
Aug 07 15:57:31 raspberrypi calaos_server[452]: [INF] input (InputAnalog.cpp:115) input_65: 43
Aug 07 15:57:31 raspberrypi calaos_server[452]: [WRN] rule.condition.standard (ConditionStd.cpp:147) get_value(int) not int !
Aug 07 15:57:31 raspberrypi calaos_server[452]: [INF] input (InputTemp.cpp:120) input_64: 23 °C
Aug 07 15:56:48 raspberrypi calaos_server[452]: [ERR] websocket (WebSocket.cpp:508) Can't send data, websocket is not connected
Aug 07 15:56:48 raspberrypi calaos_server[452]: [ERR] websocket (WebSocket.cpp:508) Can't send data, websocket is not connected
Aug 07 15:56:48 raspberrypi calaos_server[452]: [ERR] websocket (WebSocket.cpp:508) Can't send data, websocket is not connected


Voici les logs dans le cas ou ca marche pas en HTTPS (input_64=0) :

Code:
Aug 07 16:08:40 raspberrypi calaos_server[1947]: [INF] input (InputTemp.cpp:120) input_64: 0 °C
Aug 07 16:08:40 raspberrypi calaos_server[1947]: [INF] server (CalaosConfig.cpp:276) State cache file written successfully (/home/root/.cache/calaos/iostates.cache)
Aug 07 16:08:30 raspberrypi calaos_server[1947]: [INF] websocket (WebSocket.cpp:443) Received a PONG back in 00:00.0003
Aug 07 16:08:26 raspberrypi calaos_server[1947]: [INF] input (InputTemp.cpp:120) input_93: 22.75 °C
Aug 07 16:08:15 raspberrypi calaos_server[1947]: [INF] websocket (WebSocket.cpp:443) Received a PONG back in 00:00.0002
Aug 07 16:08:00 raspberrypi calaos_server[1947]: [INF] websocket (WebSocket.cpp:443) Received a PONG back in 00:00.0003
Aug 07 16:07:45 raspberrypi calaos_server[1947]: [INF] websocket (WebSocket.cpp:443) Received a PONG back in 00:00.0003
Aug 07 16:07:41 raspberrypi calaos_server[1947]: [INF] input (InputTemp.cpp:120) input_92: 23.75 °C
Aug 07 16:07:40 raspberrypi calaos_server[1947]: [INF] input (InputAnalog.cpp:115) input_70: 0
Aug 07 16:07:40 raspberrypi calaos_server[1947]: [INF] input (InputAnalog.cpp:115) input_68: 100
Aug 07 16:07:40 raspberrypi calaos_server[1947]: [INF] input (InputAnalog.cpp:115) input_67: 2.6
Aug 07 16:07:40 raspberrypi calaos_server[1947]: [INF] input (InputAnalog.cpp:115) input_66: 1018
Aug 07 16:07:40 raspberrypi calaos_server[1947]: [INF] input (InputAnalog.cpp:115) input_65: 41
Aug 07 16:07:40 raspberrypi calaos_server[1947]: [WRN] rule.condition.standard (ConditionStd.cpp:147) get_value(int) not int !
Aug 07 16:07:40 raspberrypi calaos_server[1947]: [INF] input (InputTemp.cpp:120) input_64: 0 °C
Aug 07 16:07:40 raspberrypi calaos_server[1947]: [INF] input (InputAnalog.cpp:115) input_70: 0
Aug 07 16:07:40 raspberrypi calaos_server[1947]: [INF] input (WebInputString.cpp:84) Read string value : ciel dégagé
Aug 07 16:07:40 raspberrypi calaos_server[1947]: [INF] input (InputAnalog.cpp:115) input_68: 100
Aug 07 16:07:40 raspberrypi calaos_server[1947]: [INF] input (InputAnalog.cpp:115) input_67: 2.6
Aug 07 16:07:40 raspberrypi calaos_server[1947]: [INF] input (InputAnalog.cpp:115) input_66: 1018
Aug 07 16:07:40 raspberrypi calaos_server[1947]: [INF] input (InputAnalog.cpp:115) input_65: 41
Aug 07 16:07:40 raspberrypi calaos_server[1947]: [WRN] rule.condition.standard (ConditionStd.cpp:147) get_value(int) not int !
Aug 07 16:07:40 raspberrypi calaos_server[1947]: [INF] input (InputTemp.cpp:120) input_64: 0 °C
Aug 07 16:07:40 raspberrypi calaos_server[1947]: [INF] server (CalaosConfig.cpp:276) State cache file written successfully (/home/root/.cache/calaos/iostates.cache)
Aug 07 16:07:30 raspberrypi calaos_server[1947]: [INF] websocket (WebSocket.cpp:443) Received a PONG back in 00:00.0002



RE: WebInput en HTTPS ne marche pas ? - raoulh - 08-07-2017

Hmm, non c'est pas normal... Je vais tester ca.


RE: WebInput en HTTPS ne marche pas ? - mifrey - 08-14-2017

Tu as deja eu l'occasion de tester Raoul ?

J'ai ajoute les logs dans mon 1er post si ca peut aider. La seule chose que je remarque ce sont les "Received a PONG back" dans le cas ou ca marche pas.


RE: WebInput en HTTPS ne marche pas ? - raoulh - 08-14-2017

Sous quelle version tu es sur ton rpi?


RE: WebInput en HTTPS ne marche pas ? - mifrey - 08-14-2017

Derniere version : calaos-os-raspberrypi-v3.0-alpha4-0-g4625f1b-2017-04-01


RE: WebInput en HTTPS ne marche pas ? - raoulh - 08-14-2017

hmmm... en fait il faut l'alpha5, mais j'ai pas encore fait de build...
Je vais voir ca.


RE: WebInput en HTTPS ne marche pas ? - raoulh - 08-15-2017

J'ai fait une alpha5 pour raspberry pi, tu peux tester?


RE: WebInput en HTTPS ne marche pas ? - mifrey - 08-16-2017

Voila j'ai essaye avec l'alpha5 mais ca marche pas.

Si tu veux tester, voici un input de io.xml.  Avec l'url en HTTP ca marche  mais si on met HTTPS dans l'url ca marche pas (ca renvoie une string vide).

Code:
<calaos:input enabled="true" file_type="json" frequency="60000" gui_type="string_in" id="input_1000" io_type="input" name="Test json" path="total" type="WebInputString" url="https://data.public.lu/api/1/datasets/" visible="true" />

A noter que le site redirige l'url HTTP vers HTTPS donc je suis encore plus etonne que ca marche en mettant l'url HTTP et pas HTTPS.

Log avec HTTPS (journalctl -ru calaos-server):

Code:
Aug 15 23:52:44 raspberrypi calaos_server[592]: [INF] server (IOFactory.cpp:51) webinputstring: Ok
Aug 15 23:52:44 raspberrypi calaos_server[592]: [INF] input (WebInputString.cpp:72) Frequency : 60000
Aug 15 23:52:44 raspberrypi calaos_server[592]: [INF] input (WebInputString.cpp:84) Read string value :
Aug 15 23:52:44 raspberrypi calaos_server[592]: [INF] input (WebInputString.cpp:63) WebInputString::WebInputString()
Aug 15 23:52:44 raspberrypi calaos_server[592]: [INF] input (InputString.cpp:35) input_1000: Ok
Aug 15 23:52:44 raspberrypi calaos_server[592]: [INF] server (IOFactory.cpp:51) wodigital: Ok
Aug 15 23:52:44 raspberrypi calaos_server[592]: [INF] server (IOFactory.cpp:51) wodigital: Ok



RE: WebInput en HTTPS ne marche pas ? - raoulh - 08-16-2017

C'est bizarre.

calaos_server utilise curl pour faire le download. Essaye de le lancer en ligne de commande pour voir:

curl -v --insecure --location https://data.public.lu/api/1/datasets/

Ca devrait te retourner le json


RE: WebInput en HTTPS ne marche pas ? - mifrey - 08-16-2017

Sur mon Pi la commande curl retourne bien le meme json en HTTP et HTTPS.