matth-x / OCPP-Socket

OCPP Smart Socket firmware. Supports the Sonoff Pow R2 and R3
1 stars 0 forks source link

OCPP 1.6 Smart Socket

OCPP 1.6 firmware for the Sonoff Pow R2 and Sonoff Pow R3.

:heavy_check_mark: Full OCPP 1.6 support: all feature profiles included

:iphone:  App-based charging: via RemoteStart-/StopTransaction

:tada: Based on MicroOcpp: broad backend support

:hammer: Customizable code: fork and add your own features

:heart: Contributions highly welcome: open to adding more devices

Build & Use

This project uses PlatformIO as the SDK and needs to be compiled before flashing. See the docs of PIO on how to get started.

After opening this project in the IDE of your choice, select a build environment that suits your hardware configuration. It is recommended to first test the Wi-Fi and OCPP connectivity in development mode and view the console output via serial debugger. The current list of environments is as follows:

At the moment, the Wi-Fi credentials and OCPP server adress are hardcoded into the firmware. They must be changed accordingly.

To flash the firmware, see one of the tutorials on this matter (e.g. for the Sonoff Pow R3). You can either flash the compiled binary file using any third-party tool, or use PIO directly like this:

pio run -e sonoff_powr3_dev -t upload

To view the Serial output, start the monitor in PIO or use any approriate tool. The baud rate for the development build is 115200.

:warning: Danger of injury and electrical damage

The Sonoff Pow series devices can never be connected to a live AC wire and the programmer at the same time. The Sonoff will bridge all attached devices with the AC wire, exposing them to a dangerous AC voltage. Before powering the Sonoff over the AC wires, make sure that the case is fully enclosed and no other cables are attached than shown in the official installation guide.

Limitations

Due to the low RAM installed on the ESP8266, it is not possible to use TLS at the moment. See this project as a reference Socket implementation for your own designs based on the newer ESP32. It could be possible to overcome the heap shortage by switching to the ESP8266 RTOS SDK which has more controls for fine-tuning integrated components and trying other TLS libraries (MbedTLS or WolfSSL).

A further limitation is that the Wi-Fi credentials and OCPP server address are hardcoded, so that the firmware needs to be compiled again for each deployment. It's not clear which provisioning scheme is best for this device type. The obvious solution, a captive portal, could be too inflexible for larger deployments. It's left to the users of this project to integrate an appropriate solution.

License

This project is licensed under the GNU General Public License (GPL) Version 3.0 as it depends on modules under the GPL V3.0. If you don't need the respective dependencies and remove all derivative code, then the MIT license applies.