• 10 dec 2017: forum version update. In case of issues use this topic.
  • 30 nov 2017: pilight moved servers. In case of issues use this topic.
Hello There, Guest! Login Register


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
api doesn't report failed
#1
When i used the stable version i saw a message :failed when i made a typo

now it say {"message":"success"} even if i use a non existing device name

As you can see in the example below i put a 1 in the middle of the device name
if i am right the application should tell me i am wrong

Code:
http://172.16.20.134:5001/send?{%22message%22:%22send%22,%22code%22:{%22id%22:%22106%22,%22values%22:{%22label%22:%20%22Testje%22,%22color%22:%22black%22}}}

http://172.16.20.134:5001/send?{%22message%22:%22send%22,%22code%22:{%22device%22:%22WindDirection%22,%22values%22:{%22label%22:%20%22Testje%22,%22color%22:%22black%22}}}

http://172.16.20.134:5001/send?{%22message%22:%22send%22,%22code%22:{%22device%22:%22Wind1Direction%22,%22values%22:{%22label%22:%20%22Testje%22,%22color%22:%22black%22}}}

Code:
[Apr 20 17:16:49:629125] pilight-daemon: DEBUG: socket recv: {"message":"send","code":{"id":"106","values":{"label": "Testje","color":"black"}}}
[Apr 20 17:16:49:631304] pilight-daemon: DEBUG: socket write succeeded: {"message":"send","code":{"id":"106","values":{"label": "Testje","color":"black"}}}

[Apr 20 17:17:21:557773] pilight-daemon: DEBUG: socket recv: {"message":"send","code":{"device":"WindDirection","values":{"label": "Testje","color":"black"}}}
[Apr 20 17:17:21:559922] pilight-daemon: DEBUG: socket write succeeded: {"message":"send","code":{"device":"WindDirection","values":{"label": "Testje","color":"black"}}}

[Apr 20 17:19:51:423378] pilight-daemon: DEBUG: socket recv: {"message":"send","code":{"device":"Wind1Direction","values":{"label": "Testje","color":"black"}}}
[Apr 20 17:19:51:425623] pilight-daemon: DEBUG: socket write succeeded: {"message":"send","code":{"device":"Wind1Direction","values":{"label": "Testje","color":"black"}}}
 
Reply
#2
The API just returns if the API succesfully got the message, not if the message was correct. To properly communicate with pilight, you should use the regular socket API.
 
Reply
#3
(04-20-2015, 08:12 PM)curlymo Wrote: The API just returns if the API succesfully got the message, not if the message was correct.
so sucsess doesn't mean the action is sucsessfull but more the format of the message is correct. ( i think it should be more usefull when it tells you if the action was sucsessfull )


(04-20-2015, 08:12 PM)curlymo Wrote: To properly communicate with pilight, you should use the regular socket API.
what do you mean? when i change it to one of my lights the same url works fine.
 
Reply
#4
I mean, if you want full status reports (if messages fail or not) you should use the socket API. That api tells you if it succeeded with sending.
 
Reply
#5
Okay

And now is the question....
What is wrong with the url and how could I figure that out for upcoming protocols?

Can you give an example for the gereic_lable protecol?
 
Reply
#6
What happens if you remove all %20 or spaces?
 
Reply
#7
You are right the last test had a space
but it didn't make any difference when i remove it

Code:
/send?{"message":"send","code":{"device":"WindDirection","label":"Testje","color":"black"}}

/send?{"message":"send","code":{"device":"WindDirection","v​alues":{"label":"Testje","color":"black"}}}
when i copy past in chrome it changed to something more readable
 
Reply
#8
First the question I asked before? Why don't you use the socket API?
 
Reply
#9
Let's explain what I currently have
I use a arduino to generate values from various sensors

The arduino calls a http link and the generic switch on pilight switch on/off

Will this be easier to accomplish with sockets?
 
Reply
#10
Certainly will be because the communication is far more direct. All pilight clients also use direct socket communication. The webserver and event library also connect to the main daemon through sockets internally.
 
Reply
  


Possibly Related Threads...
Thread Author Replies Views Last Post
  pilight-send seems successful but doesn't actually send RF signal ayeyebrazov 37 1,104 03-31-2020, 01:02 PM
Last Post: curlymo
  ERROR: failed to read config. stack: 2 Stefan 6 268 02-03-2020, 09:37 PM
Last Post: curlymo
  failed to run command zlin50 4 259 01-03-2020, 10:32 PM
Last Post: zlin50
Question [Solved] Openweathermap with pilight 7.0-40 doesn't work Seebueb 2 266 01-01-2020, 06:45 PM
Last Post: Seebueb
  [solved] kwmobile: repeating the remote signal doesn't work dawncrow 9 1,351 10-25-2018, 03:46 PM
Last Post: dawncrow
  WebSocket connection failed: One or more reserved bits gregnau 8 2,844 02-16-2018, 10:02 PM
Last Post: curlymo
  pilight webGUI doesn't work - pilight not on a Pi carlos4018 11 2,381 01-23-2018, 10:18 PM
Last Post: morph027
  Upgrade to jessie+pilight+kernel failed witty 10 2,460 01-04-2018, 12:27 PM
Last Post: witty
  pilight service doesn't start jjlf 4 4,576 01-23-2017, 12:43 AM
Last Post: jjlf
  pilight-send doesn't seem to work - maybe wrong codes? beko 2 2,345 02-01-2016, 11:04 PM
Last Post: beko

Forum Jump:


Browsing: 1 Guest(s)