Skip to content

is it possible to make a httppost every x minutes to a custom adress? #19

Answered by Michael-Frank
cubensos asked this question in Q&A
Discussion options

You must be logged in to vote

@cubensos
@ajfriesen outline a method for a "pull-based" flow.

Here is one for a "pushed-based" flow. Use whatevers suites your needs or what is supported by your remote server.

To Periodically send a Post request, use "interval" with a http_request.post configuration block
See: https://esphome.io/components/http_request.html#post-body-in-json-format-syntax-2

Outline:

interval:   
   # Send data to your custom API server 
   - interval: 5min 
     then: 
       - http_request.post: 
           url: !lambda | 
             return "http://<your-custom-url>:<yourPort>/<yourEndpoint>"; 
           headers: 
             Content-Type: application/json 
           # Note: can't use the built-in…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Michael-Frank
Comment options

Answer selected by ajfriesen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants