trigger
trigger copied to clipboard
SSH Lock: state is not detected, no state response patterns and can't change timeout
I use the app for a Wi-Fi socket with the command to check its state:
case "`cat /sys/class/leds/tp-link:blue:relay/brightness`" in 0) echo '"state":"open"';; 1) echo '"state":"closed"' ;; esac
There is a few problems:
- The socket is slow to respond and I almost always see a timeout error. There is an option to increase a timeout but it doesn't allow other values than default.
- For some reason almost always the returned state is even if received is ignored.
- I had to make the script to return the
"state":"open"instead of just1because the SSH config doesn't have response patterns same as the HTTP have. They are supported on the JSON level, just need for UI fields UPD #103. - (minor) The
"state":"open"is documented but the"state":"closed"I had to assume. It looks like it was recognized properly. UPD Sorry, I re-read docs and it should beLOCKEDandUNLOCKED. There is Utils.genericDoorReplyParser but it looks like when the response patterns aren't set then it simply ignores the message. - (minor, UX) The state command text field is too small, I had to edit it in IDE and then copy
- the maximum timeout is 5000 (ms). Just because I imagined it would be enough even for slow devices. Feel free to suggest a new maximum timeout.
- please test the current code and let's see if it works now. Thanks again for the MR. :)
- we can make it a bit bigger. But in general there is not enough space anyway. Unless we we use a multi line text field.
I have to check the other points later.
Thank you. I'll send a PR to increase the max timeout and will close the ticket. The merged response parsing works fine. Gute Nacht!
@stokito glad I could support. If you can think of more changes (documentation or code), then let me know. I will create a new release "soon".