armageddon421 / electrodacus-esp32

20 stars 6 forks source link

Legacy Page Stops Working, MQTT working fine #32

Closed soggygeek closed 2 years ago

soggygeek commented 3 years ago

From this discussion, two reports of somewhat the same issue (sorry, tons of off-topic postings in the middle of the two reports). https://groups.google.com/g/electrodacus/c/m0JlWcBBAOk Here is the first report: I could connect to the SBMS0 via wifi as usual (in my setup I have the SBMS0 connected via my router and the router assigns it a static IP#.) The home tab was updating as normal, I could also open the settings and the about tabs. When I tried to look at the legacy view tab, the page was flickering as if it was updating, but showing half or one quarter of the static page, but no data. I tried with both my laptop and phone, cleared the browser cache on both devices.

Here is my near-identical experience: (SBMS0 latest hw, Version: 0.3-dirty) after about a month or more of operation as normal on the Electrodacus SBMS0 with wifi, with really reliable connection with the wifi, I had the same symptoms this morning. I am using MQTT from the Electrodacus to a Mosquitto Broker on a laptop to a node-red server showing the data. I also have another browser tab with the Electrodacus legacy page up. I mainly monitor the node-red page, because it has a nice graph of what's going on. But right at charge termination, I like to see the Electrodacus legacy page because it updates faster than my node-red display (which by design only updates every 5-10 seconds). On the legacy page I can see clearly what's going on with balancing. This morning, the MQTT publish was WORKING, but the "legacy" web page was not. I could display all the other pages and they appeared OK (I forgot to notice if the home page data was actually updating). I tried refreshing the page, I cleared browser cache. I tried a different browser (on same computer). Before clearing the cache it was showing some data but not updating, and not all the data (maybe only the SOC). After clearing cache it was all blank except the basic framework of the page. We used the "turn wifi on and off" mechanism on the Electrodacus to cycle power on the ESP32 and everything worked after that. I will report again (and be a little more attentive to details, take screenshots) if it happens again. Not a big deal to toggle the wifi board if you are present, but if you are trying to monitor from afar, that's impossible to do.

BTW, rebooting the ESP32 did not lose the 12 hr history data. And it looks like while it was not responding as a web page, it was still gathering historical data.

armageddon421 commented 3 years ago

Hi soggygeek,

This is probably related to issue #23

I assume that sometimes something goes wrong with the serial communication, maybe due to EMI or similar issues. This causes corrupt data in the buffer of the ESP32 and breaks the legacy webpage. If the issue happens again, please go to /rawdata and paste the contents here so I can have a look.

The history data won't be lost because it is actually stored on the SBMS itself and transmitted completely every second.

ninlee commented 3 years ago

i have had the sbms0 maybe 6 months or more and i have has the legacy page do this same thing a number of times and turning the wifi on and off again seem to temporarily fix this issue. also after setting up mqtt it worked for 1day and then i cant access the settings to change the mqtt data information and i also cant access the settings under that data menu. see image below. how can i fix this. would really like to get the mqtt working again. sbms0

armageddon421 commented 3 years ago

Please go to /rawdata if the legacy page is not working and post the results here.

I am unsure why the settings screen is not working properly. You may try opening the developer console of your browser and look for any script or network errors and report your findings. You can try updating to the latest version using any of the methods outlined in the readme. This should reset any config and thereby fix any problems with it.

armageddon421 commented 3 years ago

Correction: it may be /rawData with a capital D

ninlee commented 3 years ago

Problem happened again today. had to reset the wifi to get it back.

i looked at the developer console in my browser but wasn't able to see any errors given that i am not even sure what to look for.

please see the output of the rawData.

var Btn="zzzzzzz|{xyyy{||}||||||||l]||EE+###%%######################################################################%%%$$####$$$$mh`]XXTTSJEB<843./)()-'/3446047?La]SIFJMXZTLK?APSUZ_ccfnty{}orrnprptvrmspunxz{xx|xy{xxyywwyruuurxvz}z{{yzvtxv{xuuvtvwtqr";
var Btp="################################$####*)27?EFGD=62%#%$$%%'+NJKKHGIMHMJGGGIMPQKIRZ[TNIHIG+#%&%%%&''&%%'+'#########################################################################################################################################";
var ELd="zzzzzzz|{xyyy{||}||||||||l]||EE+###%%######################################################################%%%$$#####$$$mh_]WWSSSHD@:731,.'&',&-2224.25=J`[QGDHLWYSKJ=?PRTY^bcemty{}orrnprptwspvsuoxz{xx|xx{xyyywwxstuurxvz}{{{zywtxv{xvtwtwxtrr";
var Ld ="################################################################################################################################################################################################################################################";
var PV1="################################################################################################################################################################################################################################################";
var PV2="################################################################################################################################################################################################################################################";
var dmppt="############################################################";
var eA="###.?7#################################.<v";
var eW="###%w/#################################%vR";
var gsbms="#########&NN#*k#+F&N7#*X#+0#########";
var s1=['Ah','A','SBMS0  '];
var s2=[0,0,0,0,0,0,0,0,3,6,1,1];
var sbms="8)(4WL#hLqM,M/Lr##LVLfL}*}##-#+4#######*u############$E^%N(";
var xsbms="###QEBr%#$^";
ninlee commented 3 years ago

i am having problems updating using the methods you outlined in the readme. i got at far as platformio run and then there is a bunch of errors.

see below

C:\electrodacus-esp32>platformio run
Processing serial (platform: https://github.com/platformio/platform-espressif32.git; board: nodemcu-32s; framework: arduino, espidf)
------------------------------------------------------------------------------------------------------------------------
Platform Manager: Installing git+https://github.com/platformio/platform-espressif32.git
Error: Traceback (most recent call last):
  File "C:\Users\Lee\AppData\Local\Programs\Python\Python39\lib\site-packages\platformio\commands\run\processor.py", line 70, in process
    p = PlatformFactory.new(self.options["platform"])
  File "C:\Users\Lee\AppData\Local\Programs\Python\Python39\lib\site-packages\platformio\platform\factory.py", line 54, in new
    raise UnknownPlatform(pkg_or_spec)
platformio.platform.exception.UnknownPlatform: Unknown development platform 'https://github.com/platformio/platform-espressif32.git'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Lee\AppData\Local\Programs\Python\Python39\lib\site-packages\platformio\__main__.py", line 109, in main
    cli()  # pylint: disable=no-value-for-parameter
  File "C:\Users\Lee\AppData\Local\Programs\Python\Python39\lib\site-packages\click\core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "C:\Users\Lee\AppData\Local\Programs\Python\Python39\lib\site-packages\click\core.py", line 782, in main
    rv = self.invoke(ctx)
  File "C:\Users\Lee\AppData\Local\Programs\Python\Python39\lib\site-packages\platformio\commands\__init__.py", line 44, in invoke
    return super(PlatformioCLI, self).invoke(ctx)
  File "C:\Users\Lee\AppData\Local\Programs\Python\Python39\lib\site-packages\click\core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "C:\Users\Lee\AppData\Local\Programs\Python\Python39\lib\site-packages\click\core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "C:\Users\Lee\AppData\Local\Programs\Python\Python39\lib\site-packages\click\core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "C:\Users\Lee\AppData\Local\Programs\Python\Python39\lib\site-packages\click\decorators.py", line 21, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "C:\Users\Lee\AppData\Local\Programs\Python\Python39\lib\site-packages\platformio\commands\run\command.py", line 133, in cli
    process_env(
  File "C:\Users\Lee\AppData\Local\Programs\Python\Python39\lib\site-packages\platformio\commands\run\command.py", line 175, in process_env
    result = {"env": name, "duration": time(), "succeeded": ep.process()}
  File "C:\Users\Lee\AppData\Local\Programs\Python\Python39\lib\site-packages\platformio\commands\run\processor.py", line 72, in process
    self.cmd_ctx.invoke(
  File "C:\Users\Lee\AppData\Local\Programs\Python\Python39\lib\site-packages\click\core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "C:\Users\Lee\AppData\Local\Programs\Python\Python39\lib\site-packages\platformio\commands\platform.py", line 325, in platform_install
    pkg = pm.install(
  File "C:\Users\Lee\AppData\Local\Programs\Python\Python39\lib\site-packages\platformio\package\manager\platform.py", line 51, in install
    pkg = super(PlatformPackageManager, self).install(
  File "C:\Users\Lee\AppData\Local\Programs\Python\Python39\lib\site-packages\platformio\package\manager\_install.py", line 48, in install
    pkg = self._install(
  File "C:\Users\Lee\AppData\Local\Programs\Python\Python39\lib\site-packages\platformio\package\manager\_install.py", line 97, in _install
    pkg = self.install_from_url(spec.url, spec, silent=silent)
  File "C:\Users\Lee\AppData\Local\Programs\Python\Python39\lib\site-packages\platformio\package\manager\_install.py", line 141, in install_from_url
    vcs = VCSClientFactory.new(tmp_dir, url)
  File "C:\Users\Lee\AppData\Local\Programs\Python\Python39\lib\site-packages\platformio\package\vcsclient.py", line 54, in new
    obj = getattr(sys.modules[__name__], "%sClient" % type_.title())(
  File "C:\Users\Lee\AppData\Local\Programs\Python\Python39\lib\site-packages\platformio\package\vcsclient.py", line 137, in __init__
    self.configure()
  File "C:\Users\Lee\AppData\Local\Programs\Python\Python39\lib\site-packages\platformio\package\vcsclient.py", line 146, in configure
    result = proc.exec_command([cls.command, "--exec-path"])
  File "C:\Users\Lee\AppData\Local\Programs\Python\Python39\lib\site-packages\platformio\proc.py", line 117, in exec_command
    p = subprocess.Popen(*args, **kwargs)
  File "C:\Users\Lee\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 951, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Users\Lee\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 1420, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified

============================================================

An unexpected error occurred. Further steps:

* Verify that you have the latest version of PlatformIO using
  `pip install -U platformio` command

* Try to find answer in FAQ Troubleshooting section
  https://docs.platformio.org/page/faq.html

* Report this problem to the developers
  https://github.com/platformio/platformio-core/issues

============================================================
armageddon421 commented 3 years ago

This is a strange error, as the repository definitely exists. Are you running the latest version of platformio? Can you try updating everything? pip install -U platformio or pio upgrade

ninlee commented 3 years ago

you tried all that... You're up-to-date! PlatformIO 5.1.1 is currently the newest version available.

Everlanders commented 3 years ago

I just wanted to chime in and +1 this issue.

We've got an SBMS60 and an SBMS100, these were equipped with a ESP8266 and so I've connected an external ESP32 to the TX pin on the SBMS, and then we're curling the data and storing it in InfluxDB. (work in progress, any help getting this into InfluxDB appreciated.)

Everything works as you'd expect, except every so often the rawData hangs and we get the last known good values for 1/2 an hour or more. Power cycling everything works, But now that I've seen this I will try and catch the rawData for you.

Everlanders commented 3 years ago

Well, that didn't take long, The Legacy Page is stuck with the timestamp 22:33 for the last half an hour and the reading aren't updating.

This is the rawData from this event.

var Btn="+**)*-.**))+/+**))-.)*)(*.,)*))*.*))(),.**)(*,-)*))*--*)()*,-*)()0996O}gH;:78555c83000/30/10)'.)))*,&#&#%$##'#-##$##,##([XUF#####%*+####60+&##############&8lg`_V##########NNMI>,###############################################################";
var Btp="#####################################################################################################$#####&###$$#0*##)#####6-.$&###*->C####)8B}omo[JXTJ>'#######%$-17EMMK7######]fXnTjadaXaekt?iktNmjmmq`rlrwmqtpt`ahfah^rjl[qesqspymrzspeqjv|y";
var ELd="&&&&&&&&&&&&&%&&&&&&%&&%&&&&&&&%&&&%&&&&&&%&&%&&&&&&&%&&&%&&%&&&%&&%&?lU8(((((()O(((((((())))(((((()()))())()(()(((((())66568;865678686677667765554:86665434445447769968777778778747:J<FFFIA@@;]>;8U@?:;<I;:::;;:9;CI>FCEE<??M9G9<=::<;:9<H>>888";
var Ld ="('&&'*+&'&&',(''&&)+&'&%&+(&'%&'+'&&%&(+&'&%&)*&'&&')*&&%&')*'&%&-66333548746454:844543:634544;945535:545445/)6)(6+-3+(4def[444<;;<;333;eeeeb]X29;;ANFDCDKKOkd]]W5::::7111=eede_W22;EGEB@BEGEA@CFGDAADGFB@CGDAFDBGAG@GAG@FBDDAFAEDAF@FD@FDACFDAD";
var PV1="######################################################################$%%&'()**+*+-022355224=@>C<><7AQBFCCFL74977GKF57>?;<==<;:9987679=CGJKLNPQPOOOOOOLIEA>:8544579;>@ABBA@@@@ABDGIJOOOOOOOOPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPQQQQQQQQQQQ";
var PV2="#######################################################################$%%&'())*)*,/01134113<>=A;=:6@NADAADJ53766EID46<=9;<<;988765568<AEGHILNNNMMMMMLJGC@<96433457:<>@@@??>>>?@BEGHMMMMMMMMMMMMMMMMMMMMMNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN";
var dmppt="############################################################";
var eA="##-pYx##-XL7##-PgF########8+5Z##1m>G##)DyV";
var eW="##$J|Y##$IL7##$HMm########%nw&##$|$@###oxi";
var gsbms="#L7#G}#CD$@$#:*#4Q$@u#F[#<|#########";
var s1=['Ah','W','SBMS100'];
var s2=[0,0,0,0,0,0,0,0,8,2,1,1];
var sbms="#%49DQ#TG6G0########G9G:*{##+$G+$F+$?P#Q2###############%N(";
var xsbms="#kAL6>N$#,t";

Disabling and Re-Enabling the Wi-Fi on the SBMS100 immediately fixes the issue.

Everlanders commented 3 years ago

Moments later it's stuck again... I don't know if another rawData example will help??

var Btn="+**)*-.**))+/+**))-.)*)(*.,)*))*.*))(),.**)(*,-)*))*--*)()*,-*)()0996O}gH;:78555c83000/30/10)'.)))*,&#&#%$##'#-##$##,##([XUF#####%*+####60+&##############&8lg`_V##########NNMI>,###############################################################";
var Btp="#####################################################################################################$#####&###$$#0*##)#####6-.$&###*->C####)8B}omo[JXTJ>'#######%$-17EMMK7######]fXnTjadaXaekt?iktNmjmmq`rlrwmqtpt`ahfah^rjl[qesqspymrzspeqjv|y";
var ELd="&&&&&&&&&&&&&%&&&&&&%&&%&&&&&&&%&&&%&&&&&&%&&%&&&&&&&%&&&%&&%&&&%&&%&?lU8(((((()O(((((((())))(((((()()))())()(()(((((())66568;865678686677667765554:86665434445447769968777778778747:J<FFFIA@@;]>;8U@?:;<I;:::;;:9;CI>FCEE<??M9G9<=::<;:9<H>>888";
var Ld ="('&&'*+&'&&',(''&&)+&'&%&+(&'%&'+'&&%&(+&'&%&)*&'&&')*&&%&')*'&%&-66333548746454:844543:634544;945535:545445/)6)(6+-3+(4def[444<;;<;333;eeeeb]X29;;ANFDCDKKOkd]]W5::::7111=eede_W22;EGEB@BEGEA@CFGDAADGFB@CGDAFDBGAG@GAG@FBDDAFAEDAF@FD@FDACFDAD";
var PV1="######################################################################$%%&'()**+*+-022355224=@>C<><7AQBFCCFL74977GKF57>?;<==<;:9987679=CGJKLNPQPOOOOOOLIEA>:8544579;>@ABBA@@@@ABDGIJOOOOOOOOPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPQQQQQQQQQQQ";
var PV2="#######################################################################$%%&'())*)*,/01134113<>=A;=:6@NADAADJ53766EID46<=9;<<;988765568<AEGHILNNNMMMMMLJGC@<96433457:<>@@@??>>>?@BEGHMMMMMMMMMMMMMMMMMMMMMNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN";
var dmppt="############################################################";
var eA="##-pYx##-XL7##-PgF########8+5Z##1m>G##)DyV";
var eW="##$J|Y##$IL7##$HMm########%nw&##$|$@###oxi";
var gsbms="#L7#G}#CD$@$#:*#4Q$@u#F[#<|#########";
var s1=['Ah','W','SBMS100'];
var s2=[0,0,0,0,0,0,0,0,8,2,1,1];
var sbms="#%49DQ#TG6G0########G9G:*{##+$G+$F+$?P#Q2###############%N(";
var xsbms="#kAL6>N$#,t";

Power Cycling the ESP32 causes the Legacy page to be blank, and the rawData becomes:

var Btn=")+/+**))-.)*)(*.,)*))*.*))(),.**)(*,-)*))*--*)()*,-*)()0996O}gH;:78555c83000/30/10)'.)))*,&#&#%$##'#-##$##,##(#########%########################################################IJ?#############################################################";
var Btp="###########################################################################################$#####&###$$#0*##)#/5'45,-63#MSIOPRWcfhhdZ&*/9989`lurruqlc]YZZX256118Bnz}wqdcecee_YC&###7pgpptsopMqgqpppknhmtmVgpionqiojlpcywvwwysmxgumh|{wwszydww|wY";
var ELd="&&&%&&&&&&%&&%&&&&&&&%&&&%&&&&&&%&&%&&&&&&&%&&&%&&%&&&%&&%&?lU8(((((()O(((((((())))(((((()()))())()(()(((((())()((((())(314234333434433212445333222323322333335233214366222455454422<@<<;;==J<@===<>=@>;>G@=@=>=?=@?=B9;;:::<?:A;?A99:;=::C;;:;G";
var Ld ="&',(''&&)+&'&%&+(&'%&'+'&&%&(+&'&%&)*&'&&')*&&%&')*'&%&-66333548746454:844543:634544;945535:545445/)6)(6+-3+(4)(;.)/2)(5//76666///27?jiiccbbF@886111688888TTU[[[U7111598884111<Nkjc@UUUUUUUTUUTUUUVUUTUUUUUUUTTTUUTTUUUTTUUUTTTUUTTTTUTTTTTTTTTT";
var PV1="############################################################$$%&&'())*)*,.001220029<;?9;84>K>B??AG42654CFB35;;CIOQJGLNG?>@ABCDEGGHIJKLMOOOOPPQPONMKJIHGGFGGGHIJKLNNONMLKJJIHFDB@?>>>PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPQPPQQQQQQQQQQQQQQ";
var PV2="#############################################################$$%&&'(()()+.//011//18;9=8973<I=@==?E31543AD@249:AGMNHFJKF>=>?@ABCEFFGHIJKLMMMNNNNMLKIHGFEEEEEFFGHIJKLMLKJIHHGFEB@?====NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN";
var dmppt="############################################################";
var eA="##-p_4##-Z*b##-R>i########8.FM##1nS{##)EWs";
var eW="##$J}=##$I_m##$H`N########%oB=##$|33###p%A";
var gsbms="#R3#Rs#@2$@$#C3#,j$@u#N.#;4#########";
var s1=['Ah','W','SBMS100'];
var s2=[0,0,0,0,0,0,0,0,8,2,1,1];
var sbms="#%4:B%#UG;G8########G>G@+(##+#Oa$9F$3W#n0###############%N(";
var xsbms="$-/L6>N$#,t";
armageddon421 commented 3 years ago

@Everlanders the rawData looks good but must for some reason not be updated anymore. By any chance, do you have MQTT running and can confirm or deny that MQTT is still working in that scenario?

Everlanders commented 3 years ago

No, I wasn't using proper MQTT, I've been using Blynk (quasi mqtt) (but I'm currently moving away from that as much as I can.)

I was just using this to get the SBMS data onto my network and then I was parsing it in Python to Blynk, InfluxDB, and others.

I have now moved to a wired serial connection. https://github.com/Burtond/Electrodacus

I was getting several bad readings a day there too, (3485% SoC, etc) but have fought through it, and now have it filtered nicely.

helgef commented 2 years ago

Just got this as well. Issue present in both the legacy view inside the vue application and also on /sbms.html directly

Seems like the issue us with the javascript parsing the rawData: Uncaught SyntaxError: Unexpected identifier (at rawData:7:9)

rawData looks like this:

var Btn="###########################################8A-&,8ShA@;WC???7W??7?XB?9??<U@99Y=<@TH<<77;n}d`^ZTQenmnmmfgjiigii]YYY^NMRuvvuuuvuutpfbebbbbbbbbbbbbbbbbbbbbbbdno}YZSSRZSUSRW[ZYYZ]Y]W||||||||}{{|{||{||{{{|||{|{{|||||{{||{{{|{|{{|{{||||||{|||{{"; var Btp="%###############$%%%%%%%%&&&&&&'(()((()*,,$#####################################################################################################################################################################################################"; var ELd="###########################################7A,%,8Sg@@;WC???7W??7?;WB>9?>U@89Y<;?TG<<77;n|d`^YTQemmnmmegjiigii[XXX^MMRuvvuuuvuutofbebbababbbbbabbbbababbbbdno|YZRRRYSURQW[ZYYZ]Y]W{|{||||||{{|{{{{{|{{{|{{z|{{||{||{{||{{{|{{{{|{{||||||{|||{|"; var Ld ="################################################################################################################################################################################################################################################"; var PV1="################################################################################################################################################################################################################################################"; var PV2="################################################################################################################################################################################################################################################"; var dm t="############################################################"; var dmppt="############################################################"; var eA="##$Os&############################I+##$Im}"; var eW="###4xm############################'z###4/^"; var eWs="##+L6>N$#%}"; var esbms="###L6>N$#%}"; var gsbms="#########$4S$$_#Yn$3w$$(#Y9#########"; var s1=['Ah','A','SBMS0 ']; var s2=[0,0,0,0,0,0,0,0,8,2,1,1]; var sbms="9+>8YD#qF}Fy########FzG#*:##-#Y7#######XY############$C%%N("; var xsbms="##'L6>N$#%}";

As you can see indeed is line 7 suspect: var dm t="############################################################";

Not sure what happens here.. Might look at the code generating rawData from uart when i get home

helgef commented 2 years ago

So I traced down what is happening here.

  1. The legacy page calls the /rawData inside a Githubissues.
  2. Githubissues is a development platform for aggregating issues.