openevse / openevse_esp32_firmware Goto Github PK
View Code? Open in Web Editor NEWOpenEVSE V4 WiFi gateway using ESP32
OpenEVSE V4 WiFi gateway using ESP32
Using hostname lookup in a desktop browser e.g http://openevse.local results in the following errors. These errors result in some parameters not being displayed e.g max current
Access to XMLHttpRequest at 'http://192.168.86.20/r?json=1&rapi=$GH' from origin 'http://openevse.local' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
I apologize if this request is being worked on already, but if so, I couldn't find it.
I'd like the ability to set schedules for charging by day, and time, multiple times per day (if possible).
I have time-of-use billing and I would rather have the schedule of cheap rates (mostly at night) done on my OpenEVSE rather than my 2014 Volt. I know that right now I can set a daily schedule, but that doesn't help me when my weekend rates are the same as my nightly rates during the week :)
"GUI documentation"
https://github.com/OpenEVSE/ESP32_WiFi_V3.x/blob/master/gui/readme.md
It would be useful if it was possible to enable debug from within the web UI, is this possible?
Test using Olimex ES32-gateway with Ethernet to be used instead of Wi-Fi when installation is more suited to wired Ethernet
https://www.olimex.com/Products/IoT/ESP32/ESP32-GATEWAY/open-source-hardware
Enable HTTPS support for the webserver, including changing the certificate and private key.
This is another un-important possible change...
At the moment messages are posted to
<base topic>/
which by default is
openevse-XXXX/
but announce messages are posted to (irregardless of base topic):
openevse/announce/XXXX
(although that may change soon toopenevse/announce
).
For consistency does it make sense to have a separate base topic , so messages would be posted too:
openevse/<base topic>
which would then by default be:
openevse/openevse-XXXX
I guess the problem with this is that it isnt backward compatible?
Personally I dont have strong feelings about this. But I thought it would be worth raising it.
In order of priority:
These seemingly minor tweaks are actually very important, it took many attempts to setup a WiFi in a location with 100's of WiFi networks since the wifi network scan table kept jumping around in size while trying to enter a complex PSK. Most of the WiFi networks where very weak and should not have been displayed. Also if a user wants use to use stand-alone more it's frustrating to have to wait for a wifi scan that is not needed.
Add support for secure MQTT connections, depends on #29
All the info in http://status should be made available via MQTT.
Also ESP chipID should be added to status and also posted to MQTT
We should add some hardware info to the config
so we can distinguish between the ESP8622 and ESP32
After connecting to WiFi network the module suggests browsing to http://openevse/
, this should be updated to include the unique string e.g http://openevse-55ad/
If possible the RAPI loop should be non-blocking and if the open evse controller is not detected a message should be displayed:
"OpenEVSE controller not detected, please check connections"
Trying to update via HTTP web interface results in ESP32 rebooting but update is no applied. The firmware file does not seem to uploading correctly. Browser does not register a file upload:
Here is the debug log showing the update process starting them immediately rebooting
Free: 250504
Free: 251192
Free: 251652
Free: 251652
Free: 251652
Update Start: firmware.bin
Update: 0%
0:32
Got 'emonpi' 144 == 144 @ 282:32
Got 'emonpimqtt2016' 137 == 137 @ 314:64
Got 'emon/emontx3/power2' 242 == 242 @ 378:30
Got '' 128 == 128 @ 408:30
Got '' 255 == 128 @ 498:15
Using default ''
I can't seem to compile the latest mater branch. I think the issue could be due to changing the build script to use python3. What are the steps I need to tell Pio to use Python3? I've got python 3.6.8 installed on my machine which in invoked by $ python3
just $python
invokes python 2.7.15
We should make each OpenEVSE unique, this will fix the issues of conflicting devices on a single network and help with integration with services that require unique ID e.g home assistant auto config etc. Each device should have a name consisting of openevse-
followed by 4 chars representing the 'chip ID`
openevse-<chipID>
openevse-1234
The <chipID>
should be the base64 encoded version of the NIC specific part of the MAC address/Chip ID. Each char in Base64 encodes 6 bits, 6x4=24 which just happens to be the number of chars that should be easy to remember and the number of bits of the MAC NIC.
Note: Even though Base64 is case sensitive and some of the context that it will be used (eg host name) are not, it still should be sufficiently unique. Also need to consider the mapping of the '62' and '63'.
We should append ESP Chip ID to the following default strings:
In order for other services to discover the openevse and determine the unique ID the MQTT initial connection message and LWT (last will testament) should be published to a fixed topic e.g
openevse/announce/<chip ID>
topic. The message will be a JSON block of the format:{
"state":"connected",
"name":"openevse-<chipID>",
"mqtt":"<MQTT base topic>",
"http":"<HTTP endpoint>"
}
openevse/announce/<chip ID>
topic{
"state":"disconnected",
"name":"openevse-<chipID>"
}
Both the initial connection message and LWT should have MQTT retain flag set
Demand shaper uses a day ahead power availability forecast to schedules charging sessions at the lowest cost Octopus Agile / carbon time. The forecast could be grid carbon intensity, of cost e.g Octopus API OpenEVSE/ESP8266_WiFi_v2.x#175
Demand shaper module is available for Emoncms, it would be preferable to run it locally on the ESP: https://github.com/emoncms/demandshaper
When using on a Raspberry Pi Zero W (which is a pain to get Node.js running on anyway as Pi Zero is armv6. But it's plenty fast for talking serial to the OpenEVSE over Rapi. At any rate...
Node V11.5.0
NPM V 6.4.1
Here's the report...which may entirely be my fault, so feel free to shout me down, call me an idiot and kick-ban me for life. But this is what the freshest of fresh installs yielded.
=== npm audit security report ===
# Run npm update handlebars --depth 3 to resolve 4 vulnerabilities
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Moderate │ Denial of Service │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package │ handlebars │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ nyc [dev] │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path │ nyc > istanbul-reports > handlebars │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info │ https://nodesecurity.io/advisories/1300 │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ High │ Arbitrary Code Execution │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package │ handlebars │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ nyc [dev] │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path │ nyc > istanbul-reports > handlebars │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info │ https://nodesecurity.io/advisories/1316 │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ High │ Arbitrary Code Execution │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package │ handlebars │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ nyc [dev] │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path │ nyc > istanbul-reports > handlebars │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info │ https://nodesecurity.io/advisories/1324 │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ High │ Prototype Pollution │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package │ handlebars │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ nyc [dev] │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path │ nyc > istanbul-reports > handlebars │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info │ https://nodesecurity.io/advisories/1325 │
└───────────────┴──────────────────────────────────────────────────────────────┘
Currently, the codacy badge in the readme still points at the ESP8266 version:
https://app.codacy.com/manual/jeremy_poulter/ESP8266_WiFi_v2.x/dashboard
Posting to Emoncms (emonPi) via http / https works great but even when successfully posting the interface still reports Connected: No
and debug log reports Emoncms error: {" success": true}
Currently, I'm posting to an emonPi which does not support https, is https only enabled for emoncms.org and data.openevse?
I can't see to get OTA upload to work either am I missing something? I checked that ENABLE_OTA
was enabled in the build flags.
Uploading .pioenvs/openevse_huzzah32/firmware.bin
19:34:15 [DEBUG]: Options: {'timeout': 10, 'esp_ip': '192.168.86.20', 'host_port': 33428, 'image': '.pioenvs/openevse_huzzah32/firmware.bin', 'host_ip': '0.0.0.0', 'auth': '', 'esp_port': 8266, 'spiffs': False, 'debug': True, 'progress': True}
19:34:15 [INFO]: Starting on 0.0.0.0:33428
19:34:15 [INFO]: Upload size: 1295600
Sending invitation to 192.168.86.20 ..........
19:35:55 [ERROR]: No response from the ESP
*** [upload] Error 1
mosquitto_pub -h home.lan -u emonpi -P emonpimqtt2016 -n -t 'emon/openevse-a7d4/rapi/in/$FS'
MQTT received:
Topic: emon/openevse-a7d4/rapi/in
Guru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled.
Core 1 register dump:
PC : 0x4000c3f0 PS : 0x00060a30 A0 : 0x800e8181 A1 : 0x3ffb1b90
A2 : 0x3ffc15e0 A3 : 0x00000000 A4 : 0x00000001 A5 : 0x3ffcfd52
A6 : 0x0000006e A7 : 0x00000000 A8 : 0x00000000 A9 : 0x00000000
A10 : 0x3ffb1c18 A11 : 0x00000000 A12 : 0x00000002 A13 : 0x0000ff00
A14 : 0x00ff0000 A15 : 0xff000000 SAR : 0x00000008 EXCCAUSE: 0x0000001c
EXCVADDR: 0x00000000 LBEG : 0x400014fd LEND : 0x4000150d LCOUNT : 0xffffffff
Backtrace: 0x4000c3f0:0x3ffb1b90 0x400e817e:0x3ffb1bb0 0x400e829a:0x3ffb1bd0 0x400d6999:0x3ffb1bf0 0x4017eba1:0x3ffb1c70 0x400deee7:0x3ffb1c90 0x400def02:0x3ffb1cf0 0x400e4c99:0x3ffb1d10 0x400e2c82:0x3ffb1dd0 0x400e3e65:0x3ffb1e00 0x400e42a7:0x3ffb1e60 0x400e45c6:0x3ffb1ec0 0x4017f085:0x3ffb1f20 0x400de06f:0x3ffb1f40 0x400d6402:0x3ffb1f60 0x400e9b81:0x3ffb1fb0 0x40088f69:0x3ffb1fd0
0x400e817e: String::move(String&) at /home/jeremy/.platformio/packages/framework-arduinoespressif32/cores/esp32/WString.cpp:857
0x400e829a: String::operator=(String&&) at /home/jeremy/.platformio/packages/framework-arduinoespressif32/cores/esp32/WString.cpp:857
0x400d6999: mqttmsg_callback(MongooseString, MongooseString) at /home/jeremy/Dev/JeremyPoulter/ESP8266_WiFi_v2.x.mongoose/.pio/libdeps/openevse_esp-wrover-kit/ArduinoJson_ID64/src/ArduinoJson/Json/JsonSerializer.hpp:80
0x4017eba1: std::_Function_handler<void (MongooseString, MongooseString), void (*)(MongooseString, MongooseString)>::_M_invoke(std::_Any_data const&, MongooseString&&, MongooseString&&) at /home/jeremy/.platformio/packages/toolchain-xtensa32/xtensa-esp32-elf/include/c++/5.2.0/functional:1871
0x400deee7: std::function<void (MongooseString, MongooseString)>::operator()(MongooseString, MongooseString) const at /home/jeremy/.platformio/packages/toolchain-xtensa32/xtensa-esp32-elf/include/c++/5.2.0/functional:2271
(inlined by) MongooseMqttClient::eventHandler(mg_connection*, int, void*) at /home/jeremy/Dev/JeremyPoulter/ArduinoMongoose/src/MongooseMqttClient.cpp:96
0x400def02: MongooseMqttClient::eventHandler(mg_connection*, int, void*, void*) at /home/jeremy/Dev/JeremyPoulter/ArduinoMongoose/src/MongooseMqttClient.cpp:34
0x400e4c99: mqtt_handler at /home/jeremy/Dev/JeremyPoulter/ArduinoMongoose/src/mongoose.c:3529
0x400e2c82: mg_call at /home/jeremy/Dev/JeremyPoulter/ArduinoMongoose/src/mongoose.c:3529
0x400e3e65: mg_recv_tcp at /home/jeremy/Dev/JeremyPoulter/ArduinoMongoose/src/mongoose.c:3529
(inlined by) mg_do_recv at /home/jeremy/Dev/JeremyPoulter/ArduinoMongoose/src/mongoose.c:2965
0x400e42a7: mg_if_can_recv_cb at /home/jeremy/Dev/JeremyPoulter/ArduinoMongoose/src/mongoose.c:3529
(inlined by) mg_mgr_handle_conn at /home/jeremy/Dev/JeremyPoulter/ArduinoMongoose/src/mongoose.c:4080
0x400e45c6: mg_socket_if_poll at /home/jeremy/Dev/JeremyPoulter/ArduinoMongoose/src/mongoose.c:3529
0x4017f085: mg_mgr_poll at /home/jeremy/Dev/JeremyPoulter/ArduinoMongoose/src/mongoose.c:3529
0x400de06f: MongooseCore::poll(int) at /home/jeremy/Dev/JeremyPoulter/ArduinoMongoose/src/MongooseCore.cpp:38
0x400d6402: loop() at /home/jeremy/Dev/JeremyPoulter/ESP8266_WiFi_v2.x.mongoose/src/main.cpp:110
0x400e9b81: loopTask(void*) at /home/jeremy/.platformio/packages/framework-arduinoespressif32/cores/esp32/main.cpp:19
0x40088f69: vPortTaskWrapper at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/port.c:355 (discriminator 1)
Building with 1.10.0 or the ESP32 BSP fails, see https://travis-ci.org/OpenEVSE/ESP32_WiFi_V3.x/builds/585990684
Most likely as a result of espressif/arduino-esp32@56ce580
Based on discussion here: me-no-dev/ESPAsyncWebServer#324 (comment) we are moving the ESP32 port to use the Mongoose via ArduinoMongoose
HTTPS is already supported for ESP32 however the UI needs updating to reflect this:
A few times recently I have even noticing the car or is not properly being plugged in so in the morning the car has not been charged.
It would be really good if a notification could be sent if the car is not plugged in at some specific time, eg overnight.
Some possible options could be email, SMS, Slack or other web service.
WiFi to control sleep and charging with RAPI commands while on timers and eliminate the RTC chip. The chip and parts add significant cost to every batch of LCDs we make. Also timer functions take up considerable code space on the open_evse controller.
Time could be updated automatically via NTP and held in memory.
I added hooks to facilitate support of OCPP. In the process, RAPI got altered a bit, and became incompatible with existing code. The changes are as follows:
I was going to create a pull request, but then realized that I don't understand your code well enough to fully test it. I've put some changes into the following commit in my own branch:
lincomatic/ESP8266_WiFi_v2.x@da56fea
Please review them, and alter as needed, at your convenience.
Building upon #15 it would be useful for Home Assistant integration for the Carbon Coop OpenDSR project that @beaylott is leading if:
The OpenEVSE Announce message was periodically published to the announce topic (every 30s) and
The announce message was published to the bare announce topic e.g openevse/announce
rather than an ID sub topic e.g openevse/announce/<id>
What are your thoughts @jeremypoulter? I'm happy to make both these changes, I think it would make it easier for any service to integrate with OpenEVSE MQTT.
On the ESP32 Huzzah holding down GPIO0 for 5s does not force Wifi AP and holding GPIO0 for 10s does not force a hardware reset. Maybe the button for GPIO0 needs to be remapped?
Depends on jeremypoulter/ArduinoMongoose#1
After changing MQTT sub-topic RAPI via MQTT does not respond until reboot
e.g changing MQTT sub-topic from openevse-xyz
to emon/openevse
and posting to emon/openevse/rapi/in/$GS
the openevse does not respond on emon/openevse/rapi/out
until the ESP32 is rebooted.
Add basic energy savings.
Add ability to turn of LCD back light after x minutes of inactivity with the RAPI command $FB 0.
back light will turn back on automatically with any state change.
Port to the ESP32, primerially targeting the NodeMCU ESP-32S.
Currently we have a very basic random number seed:
randomSeed(analogRead(0));
While this is kind of ok for ESP8266, on the ESP32 we are using a lot encryption so should improve the seed.
Here are some sources of inspiration:
As far as I understand a common problem in older Nissan Leafs is that the car charger's firmware might not be fully compliant with SAE J1772. Upgrading that firmware might pose challenges as I've discovered; there seems to be not much interest from dealers and it's also not a high priority for others offering services that dealers do not offer.
It would be great if OpenEVSE would have a RAPI command that changes the default overcurrent threshold and timeout.
#define OVERCURRENT_THRESHOLD 5 // A
#define OVERCURRENT_TIMEOUT 5000UL // ms
When an over current state is detected the GUI does not pick this up and displays 'invalid'
Clicking the update time button sends the RAPI command but the connection is immediately closed.
Depends on jeremypoulter/ArduinoMongoose#2
Print hostname e.g openevse-55ad
to LCD display at startup just after IP address
Hostname lookup e.g htp://openevse does not seem to work on the ESP32
Add Hidden SSID support
As a first step towards #5 and negating the need for a hardware RTC, NTP time from the ESP could be used to automatically set the time on the OpenEVSE controller.
We should keep the option to "sync" the time from a web browser for the use case where no web connection is present.
Open Charge Point Protocol: http://www.openchargealliance.org/protocols/ocpp/ocpp-16/
Allow OpenEVSE to integrate easily with other charging networks.
Spec attached:
ocpp-1.6_edition_2.pdf
OCPP_1.6_JSON_Specification.pdf
Wiki page: https://github.com/OpenEVSE/openevse_wifi_server/wiki/Open-Charge-Point-Protocol
It should not be possible to change the max current accidentally. We should add a user confirmation when selecting a current change via the UI.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.