trigger icon indicating copy to clipboard operation
trigger copied to clipboard

status URL doesnt help (probably as method is different?)

Open vv01f opened this issue 3 years ago • 4 comments

I use your Trigger App from f-droid with https://github.com/astro/spacemsg/tree/master/schalterd/ and unfortunately the answer for the commands lock and unlock (POST method) are both simply {} with HTTP Status Code 200. But there also is the "Status URL" /door.json (GET method) and that is either {"locked":true} or {"locked":false} … just the App answers "Not Found" only, I guess is uses POST method for all requests and thus does not get the expected response.

vv01f avatar May 06 '22 16:05 vv01f

Something like this should work for the status: HTTP method: GET Status URL: http://192.168.0.1:8000/door.json Reply Pattern (locked): "locked":true Reply Pattern (unlocked): "locked":false

The Open URL could be something like http://192.168.0.1:8000/door.json&action=open. But that really depends on your implementation.

mwarning avatar May 06 '22 17:05 mwarning

yep, that actually works for status with method GET, just then open/close needs the POST method and there is just a single setting for it – which is sensible when thinking about e.g. iterating over simple links for open/close but not for status.

although I proposed to fix the method constraint on the other project, maybe it might be a more general solution if the method was customizable also per command.

vv01f avatar May 06 '22 17:05 vv01f

Yes, this is a limitation, I will change it in the future. When I find a good way to make in configurable without an overload of options.

mwarning avatar May 06 '22 18:05 mwarning

You also might want to return <tag "door"="open" /> instead of JSON, if you do not want a message to be displayed. HTML tags are stripped after matching.

mwarning avatar May 06 '22 19:05 mwarning