Hello ![]()
I got some issues storing the following data into InfluxDB.
All I need is basically 2 values.
Which isn’t an issue to get but to transform the values into the structure I want.
I tried working with tags, processor->rename, starlark etc. but nothing was successful.
I am requesting multiple sensor data using “inputs.http” plugin.
components[0]->status->value
components[0]->config->name
{
"components": [
{
"key": "bthomesensor:201",
"status": {
"id": 201,
"value": 34,
"last_updated_ts": 1777738048
},
"config": {
"id": 201,
"addr": "...",
"name": "humidity_kitchen",
"obj_id": 46,
"idx": 0,
"meta": {
"ui": {
"icon": null
}
}
}
}
],
"cfg_rev": 50,
"offset": 0,
"total": 2
}
[[inputs.http]]
name_override = "sensors"
urls = [
'http://<kitchen>/rpc/Shelly.GetComponents?keys=["bthomesensor:201"]',
'http://<other>/rpc/Shelly.GetComponents?keys=["bthomesensor:201"]',
'http://<outside>/rpc/Shelly.GetComponents?keys=["bthomesensor:201"]'
]
data_format = "json"
tagexclude = ["url"]
The structure I want to archive:
_measurement -> sensors
_field -> humidity
tag -> room -> humidity_kitchen
Additionally the value of the tag room should be processed, trimming it’s prefix “humidity_”
_measurement | _field | _value | room
------------------------------------------
sensors | humidity | 34 | kitchen
sensors | humidity | 38 | other
sensors | humidity | 44 | outside
Additionally I need to get the data of a few other sensor, too.
They follow the same structure but with a different config name.
$ http://<kitchen>/rpc/Shelly.GetComponents?keys=["bthomesensor:202"]
{
"components": [
{
"key": "bthomesensor:202",
"status": {
"id": 202,
"value": 18,
"last_updated_ts": 1777745372
},
"config": {
"id": 202,
"addr": "...",
"name": "temperature_kitchen",
"obj_id": 69,
"idx": 0,
"meta": {
"ui": {
"icon": null
}
}
}
}
],
"cfg_rev": 50,
"offset": 0,
"total": 1
}
Parsed data to store in InfluxDB
_measurement | _field | _value | room
------------------------------------------
sensors | temperature | 18 | kitchen
sensors | temperature | 22 | other
sensors | temperature | 16 | outside
I guess I need to use multiple “inputs.http” configs, to process different data.
The goal is to store humidity, temperature, window and door (opened 1, closed 0).
**Appreciate any help…**
This is driving my crazy for multiple days now.
Or if possible parsing the data even more dynamic using the value of:
components[0]->config->name
temperature_kitchen
temperature_other
humidity_outside
window_other
…
Parsed maybe via. regex (divider _ ):
FIELD-NAME _ ROOM
_measurement | _field | _value | room
------------------------------------------
sensors | temperature | 18 | kitchen
sensors | temperature | 22 | other
sensors | humidity | 16 | outside
sensors | window | 1 | other
