Hi.
I have a flow that connects to broker and brings in values via MQTT. All the values except 1 are numbers (parsed JSON object). One is a state (string) that says, stand-by, discharged, chargind. For some reason, InfluxDB is not liking this. Do I need to confgure the influx node in NodeRed before sending it to the influxDB node? It correct value (word) is displayed in the debug pane after the function node.
The error im getting in influxDB is " unsupported input type for mean aggregate: string"
Here are two flows: one is showing RenogyBattTemp (a number), the other is RenogyBattState ( a word). Its the latter that I'm having trouble bringing into InfluxDB.
[
{
"id": "a2dfcb43bcf6b83c",
"type": "mqtt in",
"z": "51a740fcee7d2bf2",
"name": "Renogy Battery Temperature",
"topic": "solar/renogy_battery_1/temperature/state",
"qos": "2",
"datatype": "json",
"broker": "607f4bb0a0ae6958",
"nl": false,
"rap": true,
"rh": 0,
"inputs": 0,
"x": 1320,
"y": 280,
"wires": [
[
"81966104e50ed507"
]
]
},
{
"id": "81966104e50ed507",
"type": "function",
"z": "51a740fcee7d2bf2",
"name": "",
"func": "msg.payload = {\n RenogyBattTemp: msg.payload\n}\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1520,
"y": 280,
"wires": [
[
"69d1bb968ae31db3",
"b9dabd5ea9e5b78f"
]
]
},
{
"id": "69d1bb968ae31db3",
"type": "influxdb out",
"z": "51a740fcee7d2bf2",
"influxdb": "8906a2bc97d7619b",
"name": "Influx",
"measurement": "SolarRegulator",
"precision": "",
"retentionPolicy": "",
"database": "database",
"precisionV18FluxV20": "ms",
"retentionPolicyV18Flux": "",
"org": "Home",
"bucket": "AntonioBucket",
"x": 1690,
"y": 280,
"wires": []
},
{
"id": "faec16862dd6a6a2",
"type": "mqtt in",
"z": "51a740fcee7d2bf2",
"name": "Renogy Battery State",
"topic": "solar/renogy_battery_1/state/state",
"qos": "2",
"datatype": "utf8",
"broker": "607f4bb0a0ae6958",
"nl": false,
"rap": true,
"rh": 0,
"inputs": 0,
"x": 1300,
"y": 340,
"wires": [
[
"6f6d139f8a0f235e"
]
]
},
{
"id": "6f6d139f8a0f235e",
"type": "function",
"z": "51a740fcee7d2bf2",
"name": "",
"func": "msg.payload = {\n RenogyBattState: msg.payload\n}\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1500,
"y": 340,
"wires": [
[
"87f5417001aa3137",
"b9dabd5ea9e5b78f"
]
]
},
{
"id": "87f5417001aa3137",
"type": "influxdb out",
"z": "51a740fcee7d2bf2",
"influxdb": "8906a2bc97d7619b",
"name": "Influx",
"measurement": "SolarRegulator",
"precision": "",
"retentionPolicy": "",
"database": "database",
"precisionV18FluxV20": "ms",
"retentionPolicyV18Flux": "",
"org": "Home",
"bucket": "AntonioBucket",
"x": 1690,
"y": 340,
"wires": []
},
{
"id": "607f4bb0a0ae6958",
"type": "mqtt-broker",
"name": "",
"broker": "192.168.1.139",
"port": "1883",
"clientid": "",
"autoConnect": true,
"usetls": false,
"protocolVersion": "4",
"keepalive": "60",
"cleansession": true,
"birthTopic": "",
"birthQos": "0",
"birthPayload": "",
"birthMsg": {},
"closeTopic": "",
"closeQos": "0",
"closePayload": "",
"closeMsg": {},
"willTopic": "",
"willQos": "0",
"willPayload": "",
"willMsg": {},
"sessionExpiry": ""
},
{
"id": "8906a2bc97d7619b",
"type": "influxdb",
"hostname": "127.0.0.1",
"port": "8086",
"protocol": "http",
"database": "database",
"name": "",
"usetls": false,
"tls": "",
"influxdbVersion": "2.0",
"url": "http://192.168.1.139:8086",
"rejectUnauthorized": true
}
]```