PhoneProfilesPlus icon indicating copy to clipboard operation
PhoneProfilesPlus copied to clipboard

[Feature request] HTTP Event sensor

Open balporig opened this issue 3 years ago • 2 comments

An HTTP sensor that can make a GET/POST requests in a scheduled manner that is triggered when the response body contains a specific string (will require parsing the body with regex/ simple search) or on a given response code. The scheduling can be done with the Time sensor. Example input parameters:

  • method
  • url
  • headers
  • request body
  • request parameters
  • authentication
  • number of retries with optional delay between them

Triggers

  • response code == something or
  • response body equals/contains a string
    • contains by simple search (fuzzy, case-sensitive or not, exact match) or regex

Usecase

  • Integration with home automation systems like homeassistant
  • Controlling smart home/iot devices

balporig avatar Jul 04 '22 16:07 balporig

Hm, hm, I will looking on it. But this must be broadcast (UDP?). Yes? I must studying how internet connectivity working. :-)

henrichg avatar Jul 11 '22 09:07 henrichg

HTTP/1.1 and HTTP/2 use TCP, HTTP/3 uses UDP. In general, unless you implement the actual connection, you shouldn't care. Almost all languages include rest clients in the standard libraries. I have not written Java in a long time, but a quick search brings HttpURLConnection  |  Android Developers or Overview - OkHttp. The latter looks more useful. Here's an example client similar to what we're trying to achieve here: Waboodoo/HTTP-Shortcuts: Android app to create home screen shortcuts that trigger arbitrary HTTP requests

balporig avatar Jul 11 '22 11:07 balporig