Mike Wooskey

  • 9 Posts
  • 95 Comments
Joined 8 months ago
cake
Cake day: June 3rd, 2024

help-circle






  • Mike WooskeyOPtohomeassistant@lemmy.worldWake word vanished?
    link
    fedilink
    English
    arrow-up
    1
    ·
    28 days ago

    Thanks. I had indeed found those same results. All are old (i.e., using an older version of ESPHome) and only a couple report the same problem as me, none of which have a solution.

    I’ll keep looking. In the past, similar ESPHome problems “fixed themselves” once another ESPHome update was released (or sometimes 2 or 3 updates later).











  • I’m not sure how to chain these 2 commands with &&, because the SSH command is being put in the background with &.

    This doesn’t work:

    SSH_CMD="ssh -N -L ${LOCAL_PORT}:127.0.0.1:${REMOTE_PORT} ${REMOTE_USER}@${REMOTE_HOST}"
    $SSH_CMD & && TEST=$(curl -o /dev/null -s -k -w "%{http_code}" -u "${USERNAME}:${PASSWORD}" "${URL}/dashboard/")
    SSH_PID=$!
    SSH_RESULT=$?
    echo $TEST
    

    Perhaps I don’t need it in the background - the goal was to establish the tunnel and then continue with the script without it hanging until the ssh command is canceled.



  • I stumbled on a possible cause, but more background is necessary to explain.

    The script actually creates an ssh tunnel (to the Traefik host) and then does the curl. So the code is like:

    SSH_CMD="ssh -N -L ${LOCAL_PORT}:127.0.0.1:${REMOTE_PORT} ${REMOTE_USER}@${REMOTE_HOST}"
    $SSH_CMD &
    SSH_PID=$!
    SSH_RESULT=$?
    
    TEST=$(curl -o /dev/null -s -k -w "%{http_code}" -u "${USERNAME}:${PASSWORD}" "${URL}/dashboard/")
    echo "${TEST}" #debug
    

    What I learned is that when i run the script, the tunnel is successfully created but the curl fails; but then if I run the script again a second tunnel is created and the curl works fine.



  • Here is the result of the script curling a known good URL (it still results in exit code 7 and thus a result of “000”), followed by a copy-paste of the curl command run in the shell (exited with “200”):

    $ ./test.sh
    curl -o /dev/null -s -k -w "%{http_code}" "https://i0.wp.com/www.notquitezen.co/wp-content/uploads/2022/07/Is-Happiness-an-Emotion.png"
    previous exit code: 7
    000
    $
    $ curl -o /dev/null -s -k -w "%{http_code}" "https://i0.wp.com/www.notquitezen.co/wp-content/uploads/2022/07/Is-Happiness-an-Emotion.png"
    200