trigger icon indicating copy to clipboard operation
trigger copied to clipboard

SSH Lock: state is not detected, no state response patterns and can't change timeout

Open stokito opened this issue 1 month ago • 2 comments

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:

  1. 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.
  2. For some reason almost always the returned state is even if received is ignored.
  3. I had to make the script to return the "state":"open" instead of just 1 because 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.
  4. (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 be LOCKED and UNLOCKED. There is Utils.genericDoorReplyParser but it looks like when the response patterns aren't set then it simply ignores the message.
  5. (minor, UX) The state command text field is too small, I had to edit it in IDE and then copy

stokito avatar Dec 11 '25 20:12 stokito

  1. 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.
  2. please test the current code and let's see if it works now. Thanks again for the MR. :)
  3. 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.

mwarning avatar Dec 13 '25 21:12 mwarning

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 avatar Dec 13 '25 21:12 stokito

@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".

mwarning avatar Dec 15 '25 15:12 mwarning