-
Hello, I am using a ESP32-C3 here with default firmware. I want to make two simple rules to send a WebQuery on a SSerial Event Rule2 ON SSerialReceived#Message DO WebQuery http://URL POST %value% ENDON and send back a SSerial message, that the WebQuery was delivered. But I cant find any documentation how to parse if WebQuery was successfully delivered. ChatGpt told me to use this: Rule3 ON WebQuery#Status=200 DO SSerialSend "WebQuery sent" ENDON But it seems there is no "Status" at all implemented. I found this example here to use something like this: Rule3 ON WebQuery#Data=Done DO SSerialSend "WebQuery sent" ENDON This gets parsed, but it always is parsed no matter what. There is always a RESULT = {"WebQuery":"Done"} sent, no matter if the message was delivered. You could even do a bogus command like this: WebQuery http://THIS_URL_DOES_NOT_EXIST POST test and you still get a : RESULT = {"WebQuery":"Done"} What is the right way to do this and get a proper HTTP reponse code like 200, or something else to notice the server responded? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 15 replies
-
I already answered about what you can do. #13209 (comment) |
Beta Was this translation helpful? Give feedback.
-
@sfromis Hello, thanks for answering, but like I already said, this doesnt work. Tasmota always sends back {"WebQuery":"Done"} no matter what. if you do a bogus command like WebQuery https://thisurldoesnotexist POST test it also respons with {"WebQuery":"Done"} and not with {"WebQuery":"Connect failed"} There is never a error message sent back. is this a bug? I dont know how to use Berry, the documentation is sadly not really good. If youd like to post a simple Berry example for this if it is just a few lines, I would appreciate that. But I would more like to use Rules because how simple they are for this. |
Beta Was this translation helpful? Give feedback.
Well, there are situations where you can get
{"WebQuery":"Connect failed"}
, that was a copy/paste from a test I did. And editing your question with significant change after getting a response is not a great way to communicate.Still, you are right that you cannot get a reasonable indication of reachability this way. But what I saw as the main question was about getting a status code. This is not available using the
WebQuery
command. No way around that.If you enable the mentioned
USE_WEBSEND_RESPONSE
, a workable approach is to check your server response to validate it to be consistent with what you expected.When it comes to Berry, here's a simple example illustrating getting a 404 status…