esp8266-web-interface icon indicating copy to clipboard operation
esp8266-web-interface copied to clipboard

Visual feedback when comms between esp8266 and OI board is not working

Open chrskly opened this issue 1 year ago • 10 comments

User MattsAwesomeStuff pointed out in this post that it can sometimes not be apparent (especially to people new to the OI world) that communication between the esp8266 board (or whatever is providing the web interface) and the actual OI board itself is not working. It would be good to have some visual indication of this in the interface itself.

I've done a bit of work on the web stuff in the past, so I'm happy to take the on myself. Just logging an issue here to try and follow a clear process :)

chrskly avatar Jan 19 '24 18:01 chrskly

Maybe show the number of transmitted and received messages, to give the user the chance to see what is happening. BTW: the esp32 web interface lives in a separate repository, are both maintained? I think it makes sense to have the feature in both variants.

uhi22 avatar Jan 19 '24 18:01 uhi22

All good suggestions here, thanks @uhi22

I'll get something implemented on esp8266 and then to a separate MR for the esp32 👍

chrskly avatar Jan 20 '24 11:01 chrskly

Edit : actually, I should put this over on the forum really.

Still working on this, but here's roughly what I'm thinking in case anyone has any thoughts. If we fail to fetch data from the STM, then this red notice pops up. It goes away on recovery.

oi-comms-error

chrskly avatar Jan 23 '24 23:01 chrskly

PR submitted : https://github.com/jsphuebner/esp8266-web-interface/pull/24

chrskly avatar Jan 24 '24 22:01 chrskly

I added it to ESP32 as well. I noticed in didn't trigger so I moved it to onreadystatechange https://github.com/jsphuebner/esp32-web-interface/commit/c1ed0df37e6a20ddc0ddf73d0b17df6d65ea00b0

Maybe that is more universal?

jsphuebner avatar Feb 20 '24 19:02 jsphuebner

tested the latest esp32-web-interface, can-backend branch. I do not get the red error bar, no matter what I do.

[Edit] The upload of the new files (e.g. ui.js) via the web interface and via $ curl -F '[email protected]' http://inverter.local/edit seems to work at first look, but the file on the controller does not change. In my case, it still showed version 2.1. After deleting the file via the web interface (then the web interface is broken), and uploading via curl the 2.2 was there. I guess I need to do the same procedure for the other changed files, too. At the moment, I get the red bar, when the esp is turned-off for ~20s. Doesn't look like intended.

uhi22 avatar Feb 20 '24 21:02 uhi22

Do you get it when selecting an invalid node id? To be honest that was my only test. Will expand

Edit: uploading via web interface worked for me but you have to Ctrl+F5 because the ESP sends a superficial 1-day caching time

jsphuebner avatar Feb 20 '24 22:02 jsphuebner

My test case: Precondition: Foccci running, Web interface on spot values, auto-reload, everything live. Webinterface shows correct version 2.2 after cleaning the browser cache. Windows 10, Edge. Action: Turn-off Foccci, wait 1 minute Expected: Red bar after 2 seconds. Observed: No red bar, even after one minute. --> FAIL. Action: Turn-off ESP32. Expected: Red bar after 2 seconds. Observed: Red bar after ~20s. It says connection between ESP and STM was lost. But this is not true. The web interface itself is down. --> FAIL

uhi22 avatar Feb 21 '24 08:02 uhi22

Now checking for CAN comms while fetching values via SDO. Explicitly returning error 500.

When turning off power to the ESP32 you still get the "between STM and ESP" message though, haven't found out how to check for network error and display something more appropriate

jsphuebner avatar Feb 21 '24 14:02 jsphuebner

I do not know the overall concept, so just dreaming: In the browser (javascript), there is a timer which is started as soon as data is requested from the ESP, and expires after 200ms. If no response arrived during this time, then show the error bar with the content "no response from ESP".

uhi22 avatar Feb 21 '24 16:02 uhi22