Unable to connect: Updater: Invalid response from server. HTTPcode: -4

Hi there!
Today I was unable to ping or access iotawatt, led was green.

After restart I was able to connect. Logs show ‘Updater: Invalid response from server. HTTPcode: -4’

From which server is this response coming from? I have influxDB configured, but I dont know if this is the one giving the response.

The -4(what is that anyway) has been thrown twice in the last couple of days.

Extra info: just purchased iotawatt and set up influxdb last weekend. Still in the process of setting things up. RasberryPI had not been powered up since the weekend.

We have the iotawatt in the fuse box located in a downstairs appartment that we normally rent out, so bug free wireless comm is a must for us. (Side question; would it be possible to drop the casing and use direct access to the usb and connect with this to the rasberryPI to limit possibility of comm errors on wifi?)

Thanks in advance!

Including log:

** Restart **

SD initialized.
11/29/22 19:52:48z Real Time Clock is running. Unix time 1669751568
11/29/22 19:52:48z Reset reason: Software/System restart
11/29/22 19:52:48z Trace: 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[5], 31:120, 21:100[31], 21:101, 31:120, 31:122, 31:123, 31:123, 21:110, 21:110, 31:1, 1:6[6], 1:3, 1:3, 1:6[1], 1:6[2], 1:6[3], 1:5[21], 1:6[4], 21:0, 21:1, 21:10, 21:10
11/29/22 19:52:48z ESP8266 ID: 14631604, RTC PCF8523 (68)
11/29/22 19:52:48z IoTaWatt 5.0, Firmware version 02_07_05
11/29/22 19:52:48z SPIFFS mounted.
11/29/22 20:52:48 Local time zone: +1:00, using DST/BST when in effect.
11/29/22 20:52:48 device name: IotaWatt
11/29/22 20:52:48 HTTP server started
11/29/22 20:52:48 influxDB_v2: Starting, interval:5, url:http://192.168.50.37:8086
11/29/22 20:52:48 timeSync: service started.
11/29/22 20:52:48 statService: started.
11/29/22 20:52:48 dataLog: service started.
11/29/22 20:52:49 dataLog: Last log entry 11/29/22 20:52:45
11/29/22 20:52:53 historyLog: service started.
11/29/22 20:52:53 historyLog: Last log entry 11/29/22 20:52:00
11/29/22 20:56:58 WiFi connected. SSID=MUDE_2.4, IP=169.254.181.66, channel=7, RSSI -63db
11/29/22 20:56:58 MDNS responder started for hostname IotaWatt
11/29/22 20:56:58 LLMNR responder started for hostname IotaWatt
11/29/22 20:56:58 Updater: service started. Auto-update class is MINOR
11/29/22 22:09:30 Updater: Auto-update is current for class MINOR.
12/01/22 17:15:51 Updater: Invalid response from server. HTTPcode: -4

Bob said this in a 2018 thread:

HTTP code -4 means that the TCP connect request failed. There are a number of possible reasons for this, but generally means either a poor WiFi/internet connection or a problem with the server that you are connecting to. I get this a lot with influx on a RPi. I’m happy that it resolved and the IoTaWatt was able to upload the backlog.

——
I had it myself when my internal dns didn’t resolve the ip of my pi properly. I use static IPs for all important devices now (not dhcp reservations). I haven’t had any issues since.

Thanks to @philrob for posting that still appropriate thread.

If it’s a metal fuse box, that’s not a good idea for either WiFi or electrical safety. The IoTaWatt should be external and any enclosure should be non-metallic.

Also would recommend you use WiFi channels 1, 6 or 11 and insure the channel used is fixed.

I’d like to climb in here with a “me too” and more info. I’ve had my setup for a couple years, unchanged. I have never had wifi issues before, but recently (just to be proactive) did an update after a LONG time with out updating, and left auto-update on (on 11/6/2022 I went from 2.05.05 to 2.07.05 after being on 2.05.05 for a LONG time). I left auto-update on but do not see any updates since.

Last night at 3:08am the iotawatt dropped offline (my network monitoring system recorded it). It also stopped recording Influxdb writes about then.

In the log, there’s nothing until 3:57am when I got the "Updater: Invalid response from server, HTTPcode:-4

Because of an alarm from my network manager I woke up and maybe 30 minutes later I power cycled it.

I think the “Updater” is a symptom not the cause, it occurred later, probably on some recurring update version check. There is no log indication that it disassociated; in real wifi outages there is always a “Wifi Disconnected” message. I did not get that.

When I power cycled the unit it rejoined the network and sent the buffered influxdb data as it should, so all good in that respect.

So I pulled my AP logs and I see the new association and authentication that occurred after the power cycle, but there is no record from that AP of any de-association, stop, etc.

I am pretty sure this means the Iotawatt was still associated, i.e. wifi was still up, but the IP stack was hung, since it was not responding to pings (I know from the NMS at 3:08am). That’s also consistent with lack of a “Wifi disconnect” message in the log.

So I am pretty certain that this was not a wifi signal issue in my case. It appears to be a hung IP stack.

Obviously not one that occurs frequently, but sure looks like software (probably not your software but the stack) not wifi nor hardware. And while one data point is not a trend, the absolute solid stability I had with 2.5.5 and one failure with 2.7.5 makes me a big suspicious.

That message is a pretty common occurrence. It just means that the connection to the IoTaWatt server to check for release update failed. Could be anything.

As far as I know, 02_05_05 and 02_05_07 have the same version of underlying lwip stack. Glad you recovered, the IoTaWatt apparently continued monitoring throughout, and your influxDB was maintained seamlessly.

Yes, that it buffers during outages is terrific. Whenever I do network changes, I have no gaps, extremely nice.

The problem is that I know, because I have logging on the AP, that wifi didn’t disassociate. So at the wifi layer there was connectivity, but the IP layer was lost.

But… time will tell, one event does not a trend make. I just wanted to add a data point.

TLDR> If you get HTTP Code -4 error, try a IP address, not a hostname, for the database server

For future IotaWatt googlers: I had installed heaps of IotaWatts. I just came across this error again today (“HTTP Code -4”). I did the following to resolve:

  • Reset log via /command?deletelog=both → no effect, not required
  • Checked InfluxDB server is accessible on network → yes, via hostname and IP
  • Gave IotaWatt an IP (instead of previous hostname) for InfluxDB → fixed

I have seen this mysterious problem before and setting an IP for the influx server worked too. I don’t understand why since DNS resolution works on the local network. I can only guess some networks/DNS configurations confuse IotaWatt (i.e confuses the IP stack / esp8266 it runs).