Skip to content

Conversation

@linux4life798
Copy link

@linux4life798 linux4life798 commented Dec 8, 2025

ESPHome no longer implements the HEAD HTTP method and will respond
with "HTTP/1.1 405 Method Not Allowed". This doesn't help us check if
the /events endpoint exists.

Even though the /events endpoint will stream indefinitely, if we
impose a max-time (-m) in curl, curl will end the connection and return
the initial HTTP GET's status code (hopefully 200).

We could make this max-time some fraction of a second, like 10 to 100ms,
but I would worry about sleepy devices that are on very weak wifi
connections. This 2 second timeout is a one time thing, so let's not
over optimize.

We change the powershell version to use curl for this check, since the
Invoke-WebRequest method's TimeoutSec parameter only governs the time
to get the first response from the server, so it runs forever.
To implement the same curl logic seems to require many more complicated
powershell lines, so lets just fall back to the same curl test that we
do in bash. This is arguably more maintainable.

Fixes #1

@linux4life798 linux4life798 force-pushed the fix-head-not-implemented branch from 20dadac to 7b4da11 Compare December 8, 2025 20:12
ESPHome no longer implements the HEAD HTTP method and will respond
with "HTTP/1.1 405 Method Not Allowed". This doesn't help us check if
the /events endpoint exists.

Even though the /events endpoint will stream indefinitely, if we
impose a max-time (-m) in curl, curl will end the connection and return
the initial HTTP GET's status code (hopefully 200).

We could make this max-time some fraction of a second, like 10 to 100ms,
but I would worry about sleepy devices that are on very weak wifi
connections. This 2 second timeout is a one time thing, so let's not
over optimize.

We change the powershell version to use curl for this check, since the
Invoke-WebRequest method's TimeoutSec parameter only governs the time
to get the first response from the server, so it runs forever.
To implement the same curl logic seems to require many more complicated
powershell lines, so lets just fall back to the same curl test that we
do in bash. This is arguably more maintainable.

Fixes ratgdo#1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bash script fails to identify ratgdo-esphome

1 participant