Unable to connect to influxdb v1 - Query failed, code 400 resolved

I’m a new IotaWatt user. I’m finishing the initial setup of my unit, and one of the first things I wanted to get going was the InfluxDB uploader. I have an existing Influx/grafana setup that is used for many things. The database is created and tested, but the IotaWatt cannot connect. I don’t see anything helpful in the logs, either.

Logs:
** Restart **

SD initialized.
12/14/21 21:18:35z Real Time Clock is running. Unix time 1639516715
12/14/21 21:18:35z Reset Reason: Power-fail restart.
12/14/21 21:18:35z ESP8266 ID: 537647, RTC M41T81
12/14/21 21:18:35z IoTaWatt 5.0, Firmware version 02_06_06
12/14/21 21:18:35z SPIFFS mounted.
12/14/21 16:18:35 Local time zone: -5:00, using DST/BST when in effect.
12/14/21 16:18:35 device name: IotaWatt
12/14/21 16:18:38 Connecting with WiFiManager.
12/14/21 16:18:43 HTTP server started
12/14/21 16:18:43 influxDB_v1: Starting, interval:5, url:http://10.0.0.87:8086
12/14/21 16:18:43 WiFi connected. SSID=HomeWifi, IP=10.0.0.25, channel=6, RSSI -68db
12/14/21 16:18:43 MDNS responder started for hostname IotaWatt
12/14/21 16:18:43 LLMNR responder started for hostname IotaWatt
12/14/21 16:18:44 timeSync: service started.
12/14/21 16:18:44 statService: started.
12/14/21 16:18:44 Updater: service started. Auto-update class is MINOR
12/14/21 16:18:44 dataLog: service started.
12/14/21 16:18:44 dataLog: Last log entry 08/03/01 10:01:25
12/14/21 16:18:46 Updater: Auto-update is current for class MINOR.
12/14/21 16:18:49 historyLog: service started.
12/14/21 16:18:49 historyLog: Last log entry 01/07/22 15:15:00

Influx Server log (the only relevant entry):
Dec 14 17:08:48 grafana influxd[831]: [httpd] 10.0.0.25 - iotawatt [14/Dec/2021:17:08:48 -0500] “POST /query HTTP/1.1” 400 58 “-” “-” 698284fa-5d2a-11ec-86e0-005056b03dca 109

Can you post the entire influx setup including measurements?

Also, what is your release IoTaWatt firmware?

Thank you for the response! Here are the tags/measurements:

And here is the firmware:

OK, there is a problem in 02_06_06 when using tag device = $device. The problem is using the variable $device. Try substituting the actual name of the device. Same result.

The problem is fixed in 02_07_04.

Thanks, I will give that a shot. If I select the beta channel, will it upgrade to the fixed version?

The service started after changing the device tag, but it doesn’t appear to be actually writing anything to the database. I don’t see any fields/values in the DB yet.

EDIT: Please read the second part, below

I updated to the beta version and it started populating data. I think I’m out of the woods. I appreciate your help!

EDIT: It appears I’m not out of the woods. It uploaded some historical data, but hasn’t uploaded any data since about 4 hours ago. The service still shows running, but it isn’t sending any new data. I didn’t change anything since when it was updating a few minutes ago.

Weirdly enough, it doesn’t even look like it is collecting data locally, even though I can see the data on the status screen.

What is the LED state? Please post the message log, and the status display with all tabs expanded.

The tag-key $units should not have the dollar sign.


Note: the unit is not currently installed in the panel, which is why all of the CTs are reading zero. I’m just trying to get it working with voltage reporting first, then I will install it.

The LED is green, slowly blinking between bright green and dim green.

Logs:
12/14/21 22:13:09z Real Time Clock is running. Unix time 1639519989
12/14/21 22:13:09z Reset Reason: Power-fail restart.
12/14/21 22:13:09z ESP8266 ID: 537647, RTC M41T81
12/14/21 22:13:09z IoTaWatt 5.0, Firmware version 02_06_06
12/14/21 22:13:09z SPIFFS mounted.
12/14/21 17:13:09 Local time zone: -5:00, using DST/BST when in effect.
12/14/21 17:13:09 device name: IotaWatt
12/14/21 17:13:12 Connecting with WiFiManager.
12/14/21 17:13:15 HTTP server started
12/14/21 17:13:15 influxDB_v1: Starting, interval:5, url:http://10.0.0.87:8086
12/14/21 17:13:15 WiFi connected. SSID=AnotherDimension, IP=10.0.0.25, channel=6, RSSI -68db
12/14/21 17:13:15 MDNS responder started for hostname IotaWatt
12/14/21 17:13:15 LLMNR responder started for hostname IotaWatt
12/14/21 17:13:15 timeSync: service started.
12/14/21 17:13:15 statService: started.
12/14/21 17:13:15 Updater: service started. Auto-update class is MINOR
12/14/21 17:13:15 dataLog: service started.
12/14/21 17:13:15 dataLog: Last log entry 08/03/01 10:01:25
12/14/21 17:13:17 Updater: Auto-update is current for class MINOR.
12/14/21 17:13:20 historyLog: service started.
12/14/21 17:13:20 historyLog: Last log entry 03/18/22 21:16:00
12/14/21 17:14:57 influxDB_v1: stopped, Last post 02/06/06 01:28:16
12/14/21 17:55:03 WiFi disconnected.
12/14/21 17:55:08 WiFi connected. SSID=AnotherDimension, IP=10.0.0.25, channel=11, RSSI -72db
12/14/21 18:29:40 dataLog: datalog WDT - restarting

** Restart **

SD initialized.
12/14/21 23:29:39z Real Time Clock is running. Unix time 1639524579
12/14/21 23:29:39z Reset reason: Software/System restart
12/14/21 23:29:39z Trace: 14:8, 14:5, 14:7, 14:8, 14:5, 14:7, 14:8, 14:5, 14:7, 14:8, 14:5, 14:7, 14:8, 14:5, 14:7, 14:8, 14:5, 14:7, 14:8, 14:5, 14:7, 14:8, 14:5, 14:7, 14:8, 14:5, 14:7, 14:8, 14:5, 14:7, 14:8, 14:5
12/14/21 23:29:39z ESP8266 ID: 537647, RTC M41T81
12/14/21 23:29:39z IoTaWatt 5.0, Firmware version 02_06_06
12/14/21 23:29:39z SPIFFS mounted.
12/14/21 18:29:39 Local time zone: -5:00, using DST/BST when in effect.
12/14/21 18:29:39 device name: IotaWatt
12/14/21 18:29:39 HTTP server started
12/14/21 18:29:39 influxDB_v1: Starting, interval:5, url:http://10.0.0.87:8086
12/14/21 18:29:39 timeSync: service started.
12/14/21 18:29:39 statService: started.
12/14/21 18:29:39 dataLog: service started.
12/14/21 18:29:39 dataLog: Last log entry 08/03/01 10:01:25
12/14/21 18:29:44 historyLog: service started.
12/14/21 18:29:44 historyLog: Last log entry 07/14/22 01:51:00
12/14/21 18:29:57 WiFi connected. SSID=AnotherDimension, IP=10.0.0.25, channel=6, RSSI -69db
12/14/21 18:29:57 MDNS responder started for hostname IotaWatt
12/14/21 18:29:57 LLMNR responder started for hostname IotaWatt
12/14/21 18:29:57 Updater: service started. Auto-update class is MINOR
12/14/21 18:29:58 Updater: Auto-update is current for class MINOR.
12/14/21 18:35:07 WiFi disconnected.
12/14/21 18:35:13 WiFi connected. SSID=AnotherDimension, IP=10.0.0.25, channel=6, RSSI -70db
12/14/21 18:37:27 WiFi disconnected.
12/14/21 18:37:33 WiFi connected. SSID=AnotherDimension, IP=10.0.0.25, channel=6, RSSI -70db
12/14/21 18:40:55 WiFi disconnected.
12/14/21 18:40:59 WiFi connected. SSID=AnotherDimension, IP=10.0.0.25, channel=11, RSSI -49db
12/14/21 18:44:58 influxDB_v1: Start posting at 08/03/01 10:01:30
12/14/21 18:49:49 influxDB_v1: stopped, Last post 08/03/01 10:01:25
12/14/21 18:49:55 influxDB_v1: Start posting at 08/03/01 10:01:30
12/14/21 18:57:39 influxDB_v1: stopped, Last post 08/03/01 10:01:25
12/14/21 18:57:45 influxDB_v1: Start posting at 08/03/01 10:01:30
12/14/21 19:01:53 Restart command received.

** Restart **

SD initialized.
12/15/21 00:01:53z Real Time Clock is running. Unix time 1639526513
12/15/21 00:01:53z Reset reason: Software/System restart
12/15/21 00:01:53z Trace: 9:3, 9:5, 9:9, 1:2, 1:3, 1:3, 1:6[1], 1:6[3], 1:5[14], 1:6[4], 14:0, 14:4, 14:5, 14:7, 14:8, 1:6[6], 1:1[2], 1:2[3], 9:0[3], 9:0, 9:1, 8:4, 8:6, 8:8, 8:9, 9:3, 9:5, 9:9, 1:2, 1:3, 10:2, 10:3
12/15/21 00:01:53z ESP8266 ID: 537647, RTC M41T81
12/15/21 00:01:53z IoTaWatt 5.0, Firmware version 02_06_06
12/15/21 00:01:53z SPIFFS mounted.
12/14/21 19:01:53 Local time zone: -5:00, using DST/BST when in effect.
12/14/21 19:01:53 device name: IotaWatt
12/14/21 19:01:53 HTTP server started
12/14/21 19:01:53 influxDB_v1: Starting, interval:5, url:http://10.0.0.87:8086
12/14/21 19:01:53 timeSync: service started.
12/14/21 19:01:53 statService: started.
12/14/21 19:01:53 dataLog: service started.
12/14/21 19:01:53 dataLog: Last log entry 08/03/01 10:01:25
12/14/21 19:01:57 WiFi connected. SSID=AnotherDimension, IP=10.0.0.25, channel=6, RSSI -67db
12/14/21 19:01:57 MDNS responder started for hostname IotaWatt
12/14/21 19:01:57 LLMNR responder started for hostname IotaWatt
12/14/21 19:01:57 Updater: service started. Auto-update class is MINOR
12/14/21 19:01:58 historyLog: service started.
12/14/21 19:01:58 historyLog: Last log entry 08/23/22 23:04:00
12/14/21 19:01:58 Updater: Auto-update is current for class MINOR.
12/14/21 19:02:01 influxDB_v1: Start posting at 08/03/01 10:01:30
12/14/21 19:03:38 Updater: Auto-update class changed to BETA
12/14/21 19:03:38 Updater: Update from 02_06_06 to 02_07_04
12/14/21 19:03:38 Updater: download 02_07_04
12/14/21 19:03:46 Updater: Release downloaded 7787ms, size 950776
12/14/21 19:03:56 Updater: signature verified
12/14/21 19:04:05 Updater: firmware upgraded to version 02_07_04
12/14/21 19:04:05 Updater: Firmware updated, restarting.

** Restart **

SD initialized.
12/15/21 00:04:13z Real Time Clock is running. Unix time 1639526653
12/15/21 00:04:13z Reset reason: Software/System restart
12/15/21 00:04:13z Trace: 18:2, 18:3, 18:2, 18:3, 18:2, 18:3, 18:4, 18:5, 1:6[6], 1:3, 1:3, 1:6[1], 1:6[2], 1:6[2], 1:6[3], 1:5[31], 1:6[4], 31:0, 31:1, 31:2[3], 32:60, 31:1, 1:6[6], 1:3, 1:3, 1:6[1], 1:6[2], 1:6[3], 1:5[5], 1:6[4], 5:0, 5:7
12/15/21 00:04:13z ESP8266 ID: 537647, RTC M41T81
12/15/21 00:04:13z IoTaWatt 5.0, Firmware version 02_07_04
12/15/21 00:04:13z Updater: Installing update files for version 02_07_04
12/15/21 00:04:13z Updater: Installing FAVICON.ICO
12/15/21 00:04:13z Updater: Installing GRAPH.HTM
12/15/21 00:04:13z Updater: Installing GRAPH.JS
12/15/21 00:04:14z Updater: Installing GRAPH2.HTM
12/15/21 00:04:14z Updater: Installing GRAPH2.JS
12/15/21 00:04:14z Updater: Installing INDEX.HTM
12/15/21 00:04:16z Updater: Installing TABLES.TXT
12/15/21 00:04:16z Updater: Installing CNFSTYLE.CSS
12/15/21 00:04:16z Updater: Installing EDIT.HTM
12/15/21 00:04:16z Updater: Installation complete.
12/15/21 00:04:16z SPIFFS mounted.
12/14/21 19:04:16 Local time zone: -5:00, using DST/BST when in effect.
12/14/21 19:04:16 device name: IotaWatt
12/14/21 19:04:16 HTTP server started
12/14/21 19:04:16 influxDB_v1: Starting, interval:5, url:http://10.0.0.87:8086
12/14/21 19:04:16 timeSync: service started.
12/14/21 19:04:16 statService: started.
12/14/21 19:04:17 dataLog: service started.
12/14/21 19:04:17 dataLog: Last log entry 08/03/01 10:01:25
12/14/21 19:04:21 Updater: service started. Auto-update class is BETA
12/14/21 19:04:21 WiFi connected. SSID=AnotherDimension, IP=10.0.0.25, channel=11, RSSI -54db
12/14/21 19:04:21 MDNS responder started for hostname IotaWatt
12/14/21 19:04:21 LLMNR responder started for hostname IotaWatt
12/14/21 19:04:22 historyLog: service started.
12/14/21 19:04:22 historyLog: Last log entry 08/25/22 23:12:00
12/14/21 19:04:23 Updater: Auto-update is current for class BETA.
12/14/21 19:04:23 Updater: update tables from 0.0.3 to 0.0.4
12/14/21 19:04:23 influxDB_v1: Start posting at 08/03/01 10:01:30
12/14/21 19:09:02 influxDB_v1: stopped, Last post 08/03/01 10:01:25
12/14/21 19:09:10 influxDB_v1: Start posting at 08/03/01 10:01:30
12/14/21 19:09:52 influxDB_v1: stopped, Last post 08/03/01 10:01:25
12/14/21 19:09:58 influxDB_v1: Start posting at 08/03/01 10:01:30
12/14/21 19:10:06 influxDB_v1: stopped, Last post 08/03/01 10:01:25
12/14/21 19:11:41 influxDB_v1: Start posting at 12/14/21 14:00:45
12/14/21 19:21:09 influxDB_v1: stopped, Last post 12/14/21 15:16:55
12/14/21 19:21:16 influxDB_v1: Start posting at 12/14/21 15:17:00
12/14/21 19:25:10 Restart command received.

** Restart **

SD initialized.
12/15/21 00:25:10z Real Time Clock is running. Unix time 1639527910
12/15/21 00:25:10z Reset reason: Software/System restart
12/15/21 00:25:10z Trace: 9:9, 1:2, 1:3, 1:3, 1:6[1], 1:6[2], 1:6[3], 1:5[31], 1:6[4], 31:0, 31:1, 31:2[3], 32:60, 32:60, 31:1, 1:6[6], 1:1[5], 1:2[6], 9:0[6], 9:0, 9:1, 8:4, 8:6, 8:8, 8:9, 9:3, 9:5, 9:9, 1:2, 1:3, 10:2, 10:3
12/15/21 00:25:10z ESP8266 ID: 537647, RTC M41T81
12/15/21 00:25:10z IoTaWatt 5.0, Firmware version 02_07_04
12/15/21 00:25:10z SPIFFS mounted.
12/14/21 19:25:10 Local time zone: -5:00, using DST/BST when in effect.
12/14/21 19:25:10 device name: IotaWatt
12/14/21 19:25:10 HTTP server started
12/14/21 19:25:10 influxDB_v1: Starting, interval:5, url:http://10.0.0.87:8086
12/14/21 19:25:10 timeSync: service started.
12/14/21 19:25:10 statService: started.
12/14/21 19:25:10 dataLog: service started.
12/14/21 19:25:10 dataLog: Last log entry 08/03/01 10:01:25
12/14/21 19:25:15 historyLog: service started.
12/14/21 19:25:15 historyLog: Last log entry 09/13/22 09:00:00
12/14/21 19:25:20 WiFi connected. SSID=AnotherDimension, IP=10.0.0.25, channel=6, RSSI -69db
12/14/21 19:25:20 MDNS responder started for hostname IotaWatt
12/14/21 19:25:20 LLMNR responder started for hostname IotaWatt
12/14/21 19:25:20 Updater: service started. Auto-update class is BETA
12/14/21 19:25:21 Updater: Auto-update is current for class BETA.
12/14/21 19:25:23 influxDB_v1: Start posting at 12/14/21 15:17:00
12/14/21 19:41:16 influxDB_v1: stopped, Last post 12/14/21 15:16:55
12/14/21 19:41:21 influxDB_v1: Start posting at 12/14/21 15:17:00

I noticed the $units tag, and corrected it. Thanks. I actually copied that from a screenshot somewhere else on the community. it looked wrong when I typed it, but that person said their config was working so I left it. It’s corrected now.