OpenEVSE ESP8266 WIFI serial to EmonCMS link
- ESP-12E module with 4M Flash
On first boot, OpenEVSE should broadcast a WiFI AP OpenEVSE_XXX
. Connect to this AP (default password: openevse
) and the captive portal should forward you to the log-in page. If this does not happen navigate to http://192.168.4.1
Note: You may need to disable mobile data if connecting via a Android 6 device
- Select your WiFi network from list of available networks
- Enter WiFi PSK key then click
Connect
- OpenEVSE should now connect to local wifi network and return local IP address.
- Browse to local IP address by clicking the hyperlink (assuming your computer is on the same WiFi network) On future boot up OpenEVSE will automatically connect to this network.
Note: on some networks it's possible to browse to the OpenEVSE using hostname http://openevse or on windows http://openevse.local
If re-connection fails (e.g. network cannot be found) the OpenEVSE will automatically revert back to WiFi AP mode after a short while to allow a new network to be re-configued if required. Re-connection to existing network will be attempted every 5min.
Holding the boot
button at startup (for about 10's) will force AP mode. This is useful when trying to connect the unit to a new WiFi network.
OpenEVSE can post its status values (e.g amp, temp1, temp2, temp3, pilot, status) to emoncms.org or any other Emoncms server (e.g. emonPi) using Emoncms API. Data will be posted every 30s.
Data can be posted using HTTP or HTTPS. For HTTPS the Emoncms server must support HTTPS (emoncms.org does, emonPi does not).Due to the limited resources on the ESP the SSL SHA-1 fingerprint for the Emoncms server must be manually entered and regularly updated.
Note: the emoncms.org fingerprint will change every 90 days when the SSL certificate is renewed.
Currently emoncms.org only supports numerical node names, other emoncms servers e.g. emonPi and data.openevse does support alphanumeric node naming.
OpenEVSE can post its status values (e.g. amp, temp1, temp2, temp3, pilot, status) to an MQTT server. Data will be published as a sub-topic of base topic.E.g <base-topic>/amp
. Data is published to MQTT every 30s.
- Enter MQTT server host and base-topic
- (Optional) Enter server authentication details if required
- Click connect
- After a few seconds
Connected: No
should change toConnected: Yes
if connection is successful. Re-connection will be attempted every 10s. A refresh of the page may be needed.
Note: emon/xxxx
should be used as the base-topic if posting to emonPi MQTT server if you want the data to appear in emonPi Emoncms. See emonPi MQTT docs.
RAPI commands can be used to control and check the status of all OpenEVSE functions. A full list of RAPI commands can be found in the OpenEVSE plus source code. RAPI commands can be issued via the web-interface, HTTP and MQTT.
Enter RAPI commands directly into to web interface, RAPI responce is printed in return:
RAPI commands can be issued via MQTT messages. The RAPI command should be published to the following MQTT:
<base-topic>/rapi/in/<$ rapi-command> payload
e.g assuming base-topic of openevse
to following command will set current to 13A:
openevse/rapi/in/$SC 13
The payload can be left blankc if the RAPI command does not require a payload e.g.
openevse/rapi/in/$GC
The responce from the RAPI command is published by the OpenEVSE back to the same sub-topic and can be received by subscribing to:
<base-topic>/rapi/out/#
e.g. $OK
See video demo of RAPI over MQTT
RAPI (rapid API) commands can also be issued directly via a single HTTP request.
Assuming 192.168.0.108
is the local IP address of the OpenEVSE ESP.
Eg.the RAPI command to set charging rate to 13A:
http://192.168.0.108/r?rapi=%24SC+13
To sleep (pause a charge) issue RAPI command $FS
http://192.168.0.108/r?rapi=%24FS
To enable (start / resume a charge) issue RAPI command $FE
http://192.168.0.108/r?rapi=%24FE
There is also an OpenEVSE RAPI command python library.
HTTP Authentication (highly recomended) can be enabled by saving admin config by default username and password.
HTTP authentication is required for all HTTP requests including input API
Pre-compiled .bin's can be uploaded via the web interface, see OpenEVSE Wifi releases
Note: the SPIFFS file-system (web page, CSS, java script and images) cannot currently be updated via web interface. They must be uploaded via serial see below.
The code for the ESP8266 can be compiled and uploaded using PlatformIO or Arduino IDE. PlatformIO is the easiest to get started.
For more detailed ESP8266 Arduino core specific PlatfomIO notes see: https://github.com/esp8266/Arduino#using-platformio
The easiest way if running Linux is to install use the install script, this installed pio via python pip and installs pip if not present. See PlatformIO installation docs. Or PlatformIO IDE can be used :
$ sudo python -c "$(curl -fsSL https://raw.githubusercontent.com/platformio/platformio/master/scripts/get-platformio.py)"
Standalone built on GitHub Atom IDE, or use PlatformIO Atom IDE plug-in if you already have Atom installed. The IDE is nice, easy and self-explanitory.
$ git clone https://github.com/chris1howell/OpenEVSE_RAPI_WiFi_ESP8266
$ cd OpenEVSE_RAPI_WiFi_ESP8266
$ pio run
The first time platformIO is ran the espressif arduino tool chain and all the required libs will be installed if required.
- Put ESP into bootloader mode
- On other ESP boards (Adafruit HUZZAH) press and hold
GPIO0
button then press Reset, LED should light dimly to indicate bootloader mode
- On other ESP boards (Adafruit HUZZAH) press and hold
$ pio run -t upload
- Put ESP back into bootloder mode, see above
$ pio run -t uploadfs
See PlatfomIO docs regarding SPIFFS uploading
To enable to OTA upload first upload via serial using the dev enviroment, this enables to OTA enable build flag:
$ pio run -t upload -e openevse_dev
Then upload using OTA enviroment, setting the hostname or IP address of the unit in platformio.ini
ota enviroment section:
$ pio run -t upload -e openevse_ota
SPIFFS can also be uploaded via OTA
$ pio run -t uploadfs -e openevse_ota
OTA uses port 8266, make sure this port is open. See PlatformIO ESP OTA docs:
This wil upload both the fimware and spiffs file system in a single command. :-)
- Requries esptool
- Put ESP into bootloader mode
esptool.py write_flash 0x000000 .pioenvs/openevse/firmware.bin 0x300000 .pioenvs/openevse/spiffs.bin
From: https://github.com/esp8266/Arduino
Starting with 1.6.4, Arduino allows installation of third-party platform packages using Boards Manager. ESP Arduino packages are available for Windows, Mac OS, and Linux (32 and 64 bit).
- Install Arduino 1.6.8 from the Arduino website.
- Start Arduino and open Preferences window.
- Enter http://arduino.esp8266.com/stable/package_esp8266com_index.json into Additional Board Manager URLs field. You can add multiple URLs, separating them with commas.
- Open Boards Manager from Tools > Board menu and install esp8266 platform (and don't forget to select your ESP8266 board from Tools > Board menu after installation).
From: https://github.com/esp8266/Arduino/blob/master/doc/filesystem.md
- Download the tool: https://github.com/esp8266/arduino-esp8266fs-plugin/releases/download/0.2.0/ESP8266FS-0.2.0.zip.
- In your Arduino sketchbook directory, create tools directory if it doesn't exist yet
- Unpack the tool into tools directory (the path will look like <home_dir>/Arduino/tools/ESP8266FS/tool/esp8266fs.jar)
- Restart Arduino
- Open EmonESP.ino in the Arduino IDE.
- Compile and Upload as normal
- Upload home.html web page using the ESP8266 Sketch Data Upload tool under Arduino tools.
If you are experiancing ESP hanging in a reboot loop after upload it may be that the ESP flash has remnants of previous code (which may have the used the ESP memory in a different way). The ESP flash can be fully erased using esptool. With the unit in bootloder mode run:
$ esptool.py erase_flash
sudo
maybe be required
Output:
esptool.py v1.2-dev
Connecting...
Running Cesanta flasher stub...
Erasing flash (this may take a while)...
Erase took 8.0 seconds
To fully erase all memory locations on an ESP-12 (4Mb) we neeed to upload a blank file to each memory location
esptool.py write_flash 0x000000 blank_1MB.bin 0x100000 blank_1MB.bin 0x200000 blank_1MB.bin 0x300000 blank_1MB.bin
GNU General Public License (GPL) V3