HTTP JSON error

Please use template to report bugs and problems. Post here your questions when not sure where else to post
Only for bugs in the Domoticz application! other problems go in different subforums!
Forum rules
Before posting here, make sure you are on the latest Beta or Stable version.
If you have problems related to the web gui, clear your browser cache + appcache first.

Use the following template when posting here:

Version: xxxx
Platform: xxxx
Plugin/Hardware: xxxx
Description:
.....

If you are having problems with scripts/blockly, always post the script (in a spoiler or code tag) or screenshots of your blockly

If you are replying, please do not quote images/code from the first post
Post Reply
donk7413
Posts: 9
Joined: Tuesday 25 July 2017 15:01
Target OS: Raspberry Pi
Domoticz version:
Contact:

HTTP JSON error

Post by donk7413 » Thursday 07 September 2017 15:11

Hello,
I have try to make the disco mode on Milight Lamp ( tuto : http://domo-attitude.fr/milight-domotic ... es-discos/ ) (and play more). I made a switch selector with a url liek the example but unfortunately I have some error when domoticz run it:

Code: Select all

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

Version: Domoticz V3.8153
Platform: Rasbian Jessie
Plugin/Hardware: Raspberry pi 3

This is my URL

Code: Select all

https://127.0.0.1:443/json.htm?param=switchlight&type=command&idx=25&switchcmd=Off
I have to say that the url work (with local ip (192.168.1.91) and extra IP (with ports redirection)) on a browser (Chrome) and return OK

But on domoticz or on the RPi shell with curl, it doesn't work;

Shell with curl :

Code: Select all

[email protected]:~/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
[email protected]:~/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; [email protected]
*        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; [email protected]
*        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>

My domoticz is on HTTPS Only

Some tips ?

User avatar
jannl
Posts: 902
Joined: Thursday 02 October 2014 6:36
Target OS: Raspberry Pi
Domoticz version: Beta
Location: Geleen
Contact:

Re: HTTP JSON error

Post by jannl » Thursday 07 September 2017 15:37

You get an unauthorized, is the local host (127.0.0.1) allowed to make a connection?

donk7413
Posts: 9
Joined: Tuesday 25 July 2017 15:01
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: HTTP JSON error

Post by donk7413 » Thursday 07 September 2017 15:57

with this

Code: Select all

sudo curl -k "https://192.168.1.91:443/json.htm?type=command&param=setcolbrightnessvalue&idx=25&hue=256&brightness=100&iswhite=false"
{
   "status" : "OK",
   "title" : "SetColBrightnessValue"
}
it's work but domoticz don't have root access, so it's not working i think.
another issue : in the log, domoticz say

Code: Select all

Error: Error opening url: https://192.168.1.91:443/json.htm?type=command¶m=setcolbrightnessvalue&idx=25&hue=256&brightness=100&iswhite=false
Please look after "command", there is a ¶m and not &param
I think there is some encode issue, right ?

farhanito
Posts: 32
Joined: Friday 19 August 2016 5:39
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: HTTP JSON error

Post by farhanito » Thursday 07 September 2017 18:14

exactly same issue. Random though..
V3.8153
Spoiler: show
Screenshot_2017-09-07-23-11-52-794_com.android.chrome.png
Screenshot_2017-09-07-23-11-52-794_com.android.chrome.png (219.98 KiB) Viewed 739 times

DvD
Posts: 25
Joined: Wednesday 22 January 2014 14:29
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: HTTP JSON error

Post by DvD » Thursday 07 September 2017 23:01

Same here...
I have a switch with a action set with:
http://192.168.0.6:8080/json.htm?type=c ... 61&state=4

and in the log it appears like this :

Error: Error opening url: http://192.168.0.6:8080/json.htm?type=c ... 61&state=4

wimL
Posts: 8
Joined: Saturday 08 July 2017 14:43
Target OS: Linux
Domoticz version: Beta
Location: Bruges Belgium
Contact:

Re: HTTP JSON error

Post by wimL » Saturday 09 September 2017 11:23

Same problem with a script I was trying to write,

The problem seems to be that "&para" in HTML is read as "¶"
No idea if this bug even can be solved?


https://en.wikipedia.org/wiki/Pilcrow
Running on Odroid C2
Domoticz Beta - RfLink+nrf24L01 - Aeotec gen5
4x 3 groups Milight e27/gu10 rgbw - 3x cheap 433Mhz outlet - Aeotec Multisensor 6

wimL
Posts: 8
Joined: Saturday 08 July 2017 14:43
Target OS: Linux
Domoticz version: Beta
Location: Bruges Belgium
Contact:

HTTP JSON error solution

Post by wimL » Saturday 09 September 2017 12:07

for the ¶ problem, replace &param with &dparam

Code: Select all

os.execute('curl "http://x.x.x.x:pppp/json.htm?type=command&dparam=setcolbrightnessvalue&idx='..eachidx..'&hue=254&brightness='..LightLevel..'&iswhite=true"')
easy workaround <3
Running on Odroid C2
Domoticz Beta - RfLink+nrf24L01 - Aeotec gen5
4x 3 groups Milight e27/gu10 rgbw - 3x cheap 433Mhz outlet - Aeotec Multisensor 6

User avatar
Westcott
Posts: 547
Joined: Tuesday 09 December 2014 18:04
Target OS: Raspberry Pi
Domoticz version: Beta
Location: UK - Glos
Contact:

Re: HTTP JSON error

Post by Westcott » Saturday 09 September 2017 14:53

Gosh, that's so neat!
Thanks.
Zwave - Sigma Z+ stick, Fibaro 2x FGSD002, FGMS001
Horstmann - 2x HRT4, 2x C-stat-11, 4x ASR-ZW, TKB 2x TZ56, 2x TZ68E
Max-EQ Cube, Valve, Neo 2x door
RFXtrx433E, RFlink - 1byone driveway, doorbell, Oregon and BangGood temp
Wifi - YeeLight RGB, 3x ESP8266

User avatar
lonebaggie
Posts: 101
Joined: Tuesday 31 January 2017 14:21
Target OS: Raspberry Pi
Domoticz version: beta
Location: England
Contact:

Re: HTTP JSON error

Post by lonebaggie » Saturday 09 September 2017 15:27

Brilliant much easier than my workaround

viewtopic.php?f=61&t=16912

wimL
Posts: 8
Joined: Saturday 08 July 2017 14:43
Target OS: Linux
Domoticz version: Beta
Location: Bruges Belgium
Contact:

Re: HTTP JSON error

Post by wimL » Sunday 10 September 2017 13:54

Damn,
been poking around the forums for a fix, but didn't see that one (or think of reordering ^^)
Ah well, as long as the next guy with this issue finds a quick fix :)
Running on Odroid C2
Domoticz Beta - RfLink+nrf24L01 - Aeotec gen5
4x 3 groups Milight e27/gu10 rgbw - 3x cheap 433Mhz outlet - Aeotec Multisensor 6

GiantBrain
Posts: 11
Joined: Friday 07 October 2016 13:40
Target OS: NAS (Synology & others)
Domoticz version: 3.8153
Location: Germany
Contact:

Re: HTTP JSON error

Post by GiantBrain » Saturday 28 October 2017 20:25

Can please someone confirm there is a bug in using "open url" in blocky!?

I am tried last stable 3.8153 and i tried last beta 3.8650 both end up in error if i try this:

192.168.178.5:8084/json.htm?type=command&dparam=setcolbrightnessvalue&idx=275&hue=274&brightness=40&iswhite=false

Using this in browser works fine.

Thanks
Domoticz V3.4834 @ DS213+ DSM6

Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests