Hey there,
I’m pretty new to Telegraf itself and my goal is to get my power consumption monitored and visualized later on. For that matter I’ve installed a PowerOpti - and the API docs are pretty straight forward (only available in german, still, for reference: https://www.powerfox.energy/wp-content/uploads/2020/05/powerfox-Kunden-API.pdf )
I prepared all the information upfront in Postman to get the correct curl command - which works like a charm.
Translating it into a telegraf config gives me a major headache.
My config looks like this:
[[inputs.http]]
urls = ["https://backend.powerfox.energy/api/2.0/my/all/devices" ]
method = "GET"
timeout = "5s"
name_override = "CurrentWattage"
# [inputs.http.headers]
# Authorization = "Basic XXXX"
# username = "mailAddress"
# password = "YYYY"
bearer_token = "/etc/telegraf/bearertoken"
data_format = "json_v2"
# timestamp_path = "Timestamp"
# timestamp_format = "unix"
As you can see, I tried to test the different combinations already. Every combination results in
2022-01-17T16:53:40Z E! [inputs.http] Error in plugin: [url=https://backend.powerfox.energy/api/2.0/my/all/devices]: received status code 502 (Bad Gateway), expected any value out of [200]
Whereas the curl command nets a proper result:
curl --request GET \
--url https://backend.powerfox.energy/api/2.0/my/all/devices \
--header 'Authorization: Basic XXXX'
[{“DeviceId”:“ZZZZ”,“AccountAssociatedSince”:1628851338,“MainDevice”:true,“Prosumer”:false,“Division”:0}]%
Any idea how to proceed here?