Closed RaHehl closed 2 weeks ago
You don't have the possibility to setup a MQTT broker? Or an InfluxDB?
They are currently the only way the device can "send" data by itself.
@caco3 the problem is not setting up MQTT or Influx, that would take less time than this answer. The problem is the CGN part, but what I already have is a cheap web space with PHP/Node and MySQL. That's why I'm asking for the ability to define a webhook, that shouldn't actually be too complicated to implement (at least just HTTP) if I knew c++ I would do it myself. It should also be such a generic approach that it can potentially be used for other use cases.
The new component could be based on components/jomjol_influxdb/interface_influxdb.cpp
that already uses esp_http_client
. We should agree on a basic set of requirements to estimate the effort.
@RaHehl: Could you make a proposal for
@henrythasler
1. Use url request parameters (GET) or serialized payload via POST?
Personally, I can handle anything. I think the cleanest would be POST, based on what is currently available via MQTT in my local installation, in json format
2. What data should be pushed to an endpoint?
example payload:
{ "uptime": "921646", "main": { "value": "344.21419", "raw": "0344.21419", "pre": "344.21419", "error": "no error", "rate": "0.000000", "timestamp": "2024-08-05T12:20:43+0200" }, "MAC =": "78:E3:6D:FF:FF:FF", "interval": "4.8", "fwVersion =": "Release: v15.7.0 (Commit: 0d0b018+)" }
I just used the MAC as the identifier, but it would probably be better to send an API key either in the payload or as a header
3. What's the schema that should be used for the data?
I hope 2 answers this, otherwise please clarify what is meant
4. Is a TLS connection required (then it would get more complicated)?
TLS is of course always good, but for the use case I would suffice without it. It's always a question of cost benefit, but I think the potential damage is manageable, since you can never trust the results of the evaluation 100% anyway
These would be the basic requirements
Optionally, it would be good if you could, for example, evaluate the response from the post request, and then send the image of the counter upon request, or trigger an update, or a config update, but that would really be a bonus goal
The Feature
I would like to read the water meter at remote locations, since I am behind CGNAT everywhere, I would like to send the results to my web server with a typical LAMP stack.
For this purpose, it would be good if there was the possibility to define webhooks and transmit the data that would otherwise be transmitted by mqtt.