Hi, I'm pretty new to Domoticz and scripting there so I hope someone can shine a light on this.
In LUA I tried;
1. commandArray['OpenURL']='http://127.0.0.1:8080/json.htm?type=com ... ge=MESSAGE'
2. os.execute('curl -s "http://username:[email protected] ... ge=MESSAGE" &')
I found them as examples but both don't work. Not when created in the event system in the GUI nor placed in the scripts/lua directory.
when I try;
curl -s "http://username:[email protected] ... ge=MESSAGE"
on the command line again no success, without username and password I get a reply unauthorized, so the command is doing something.
only executing
http://192.168.100.150:8080/json.htm?ty ... ge=MESSAGE
in a browser works
does anyone have an idea?
No JSON from script, only from browser
Moderator: leecollings
- lonebaggie
- Posts: 86
- Joined: Tuesday 31 January 2017 13:21
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Location: England
- Contact:
Re: No JSON from script, only from browser
I Use Json call in my scripts without issue . See the enigma script
https://www.domoticz.com/forum/viewtopi ... 38&t=16866
Cannot see anything wrong do you use username and password in Domoticz settings ?
https://www.domoticz.com/forum/viewtopi ... 38&t=16866
Cannot see anything wrong do you use username and password in Domoticz settings ?
- lonebaggie
- Posts: 86
- Joined: Tuesday 31 January 2017 13:21
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Location: England
- Contact:
Re: No JSON from script, only from browser
Just went through my notes again . I also had issues with Json commands. Are you suffering from this
https://www.domoticz.com/forum/viewtopic.php?t=13906
LUa seems to produce an illegal character when sending some Json calls . I had to reorder the call in order to make it work
check your output for a command¶m
https://www.domoticz.com/forum/viewtopic.php?t=13906
LUa seems to produce an illegal character when sending some Json calls . I had to reorder the call in order to make it work
check your output for a command¶m
- Westcott
- Posts: 423
- Joined: Tuesday 09 December 2014 17:04
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: UK - Glos
- Contact:
Re: No JSON from script, only from browser
It's the browser replacing ¶ with a paragraph character.
Zwave - Sigma Z+ stick, Fibaro, Horstmann, Neo Coolcam, EUROtronic
RFlink - IR detectors and temperatures
Wifi - YeeLights, ESP32s, Anoop sockets
Zigbee - lots with zigbee2mqtt and ZbBridge
RFlink - IR detectors and temperatures
Wifi - YeeLights, ESP32s, Anoop sockets
Zigbee - lots with zigbee2mqtt and ZbBridge
-
- Posts: 5
- Joined: Thursday 30 March 2017 0:35
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: No JSON from script, only from browser
Smart trick with the print(cmd) didn't think about that. it's indeed this problem. Do you know the trick to work around this or do I need to wait for a bugfix?lonebaggie wrote:Just went through my notes again . I also had issues with Json commands. Are you suffering from this<br abp="338"><br abp="339">https://www.domoticz.com/forum/viewtopic.php?t=13906<br abp="340"><br abp="341">LUa seems to produce an illegal character when sending some Json calls . I had to reorder the call in order to make it work<br abp="342"><br abp="343">check your output for a command¶m
- lonebaggie
- Posts: 86
- Joined: Tuesday 31 January 2017 13:21
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Location: England
- Contact:
Re: No JSON from script, only from browser
Looking at the forum the bug been there a while .
I'm sure I found the fix in the forum but I cannot find it. What you need to do is reorder the Json command in my case I wanted to update a user variable.
The documented command is this :-
json.htm?type=command¶m=updateuservariable&vname=USERVARIABLENAME&vtype=USERVARIABLETYPE&vvalue=USERVARIABLEVALUE
The command¶m causes the bug , no idea why , but if you reorder the Json command to this :-
json.htm?param=updateuservariable&type=command&vname=USERVARIABLENAME&vtype=USERVARIABLETYPE&vvalue=USERVARIABLEVALUE
It works barmy
I'm sure I found the fix in the forum but I cannot find it. What you need to do is reorder the Json command in my case I wanted to update a user variable.
The documented command is this :-
json.htm?type=command¶m=updateuservariable&vname=USERVARIABLENAME&vtype=USERVARIABLETYPE&vvalue=USERVARIABLEVALUE
The command¶m causes the bug , no idea why , but if you reorder the Json command to this :-
json.htm?param=updateuservariable&type=command&vname=USERVARIABLENAME&vtype=USERVARIABLETYPE&vvalue=USERVARIABLEVALUE
It works barmy

-
- Posts: 5
- Joined: Thursday 30 March 2017 0:35
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: No JSON from script, only from browser
reordering indeed fixed that part of the problem, funny thing is that still the json command is not executed but when I copy the string from the log and enter it in a browser it works like a charm. any other ideas?
- lonebaggie
- Posts: 86
- Joined: Tuesday 31 January 2017 13:21
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Location: England
- Contact:
Re: No JSON from script, only from browser
I had some timeout errors until I added &" at the end of the curl command.
Try something simple to prove the OS is working OK. Cut and paste everyone else code until something sticks ! No idea, if the output works in a browser
must be something in the interaction with the command line ?
Try something simple to prove the OS is working OK. Cut and paste everyone else code until something sticks ! No idea, if the output works in a browser
must be something in the interaction with the command line ?
-
- Posts: 5
- Joined: Thursday 30 March 2017 0:35
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: No JSON from script, only from browser
@lonebaggie, you were totally right, I kept trying and funny enough for me the solution was removing the &.
Don't have a clue why this is not working with the commandArray['OpenURL'] but I'm happy this works with curl now.
thanks for your support
Don't have a clue why this is not working with the commandArray['OpenURL'] but I'm happy this works with curl now.
thanks for your support
Who is online
Users browsing this forum: No registered users and 1 guest