Building openEVSE wifi gui

I fancied rebuilding the OpenEVSE WIFI GUE so I could customise it.

git clone GitHub - OpenEVSE/ESP8266_WiFi_v2.x: ESP8266 WiFi for OpenEVSE Version 2.x
cd ESP8266_WiFi_v2.x
git submodule update –init
cd gui
npm install
npm build

Now using Arduino IDE to compile I get

Error compiling:
In file included from sketch\web_server_static.cpp:14:0:
sketch\web_static/web_server_static_files.h:1:34: fatal error: web_server.assets.js.h: No such file or directory
#include "web_server.assets.js.h

However using Platform.io I get

*** [src\web_static\web_server.emoncms.jpg.h] TypeError : ord() expected a character, but string of length 0 found
Traceback (most recent call last):

  File "C:\Users\fred\.platformio\packages\tool-scons\script\..\engine\SCons\Action.py", line 1209, in execute
    result = self.execfunction(target=target, source=rsources, env=env)
  File "D:\OPENENERGYMONITOR\ESP8266_WiFi_v2.x\scripts\extra_script.py", line 61, in data_to_header
    output += binary_to_header(file)
  File "D:\OPENENERGYMONITOR\ESP8266_WiFi_v2.x\scripts\extra_script.py", line 42, in binary_to_header
    output += "0x{:02x}, ".format(ord(byte))
TypeError: ord() expected a character, but string of length 0 found
*** [src\web_static\web_server.favicon-16x16.png.h] TypeError : ord() expected a character, but string of length 0 found
Traceback (most recent call last):
  File "C:\Users\fred\.platformio\packages\tool-scons\script\..\engine\SCons\Action.py", line 1209, in execute
    result = self.execfunction(target=target, source=rsources, env=env)
  File "D:\OPENENERGYMONITOR\ESP8266_WiFi_v2.x\scripts\extra_script.py", line 61, in data_to_header
    output += binary_to_header(file)
  File "D:\OPENENERGYMONITOR\ESP8266_WiFi_v2.x\scripts\extra_script.py", line 42, in binary_to_header
    output += "0x{:02x}, ".format(ord(byte))
TypeError: ord() expected a character, but string of length 0 found
*** [src\web_static\web_server.favicon-32x32.png.h] TypeError : ord() expected a character, but string of length 0 found
Traceback (most recent call last):
  File "C:\Users\fred\.platformio\packages\tool-scons\script\..\engine\SCons\Action.py", line 1209, in execute
    result = self.execfunction(target=target, source=rsources, env=env)
  File "D:\OPENENERGYMONITOR\ESP8266_WiFi_v2.x\scripts\extra_script.py", line 61, in data_to_header
    output += binary_to_header(file)
  File "D:\OPENENERGYMONITOR\ESP8266_WiFi_v2.x\scripts\extra_script.py", line 42, in binary_to_header
    output += "0x{:02x}, ".format(ord(byte))
TypeError: ord() expected a character, but string of length 0 found
*** [src\web_static\web_server.assets.js.h] AttributeError : 'str' object has no attribute 'decode'
Traceback (most recent call last):
  File "C:\Users\fred\.platformio\packages\tool-scons\script\..\engine\SCons\Action.py", line 1209, in execute
    result = self.execfunction(target=target, source=rsources, env=env)
  File "D:\OPENENERGYMONITOR\ESP8266_WiFi_v2.x\scripts\extra_script.py", line 59, in data_to_header
    output += text_to_header(file)
  File "D:\OPENENERGYMONITOR\ESP8266_WiFi_v2.x\scripts\extra_script.py", line 26, in text_to_header
    original = source_fh.read().decode('utf-8')
AttributeError: 'str' object has no attribute 'decode'

Can anybody throw any light on these errors?
I’m obviously missing something :grimacing:

Rebuilding the UI is only really supported on Platform IO as the scripts that convert the HTML/JS/etc to files to embed in the firmware are Python 3 and part of the Platform IO build process.

I think the errors you are getting from Platform IO are due to running Platform IO with Python 2 not Python 3. FYI the changes for Python 3 are here, should be easy to revert if it is not practical to upgrade to Python 3 (but you really, really should)

1 Like

Thanks for getting back to me - Noted re: Platform IO

I am running Python 3.8.1 but on windows 10 v1909, if that makes a difference.
Maybe it only compiles on Linux?

F

Update! Works OK on Linux…

Just would have been nice to use a gui on windows rather than a ssh session…

Hum… I only made the Python 3 changes for the ESP32 version… oops, will apply to the ESP8266 version.

I have made a PR with the Python 3 changes to match ESP32. should fix your windows build, but probably break the Linux build as that must be Python 2 (may be installed in Platform IO’s virtual env)

1 Like