Skip to content

Commit

Permalink
Release/v1.4.0 (#62)
Browse files Browse the repository at this point in the history
* Add Inverted Eastron kWh meter (#20)

Co-authored-by: Hans Dingemans <[email protected]>

* Read and display EV meter currents and use them to limit power to MaxCircuit (#21)

Co-authored-by: Hans Dingemans <[email protected]>

* Wifi debugging (#23)

* Add RemoteDebug for debugging over wifi

* Minimal code adaptions for debugging over wifi

* Add instructions for debugging over wifi

* Correct the default = production release

* Add useful debugging comment

Co-authored-by: Hans Dingemans <[email protected]>

* Code improvement3 (#24)

* evse.cpp: fixing reconnect after wifi disconnect (#32)

* evse.cpp: fixing reconnect after wifi disconnect

* evse.cpp: only reconnect when in normal wifi mode

* evse.cpp: improve wifi for weak signals

Co-authored-by: dingo35 <[email protected]>

* README.md: update docs with added functionality in 1.4.0 (#30)

* README.md: update docs with added functionality in 1.4.0

* README.md: wifi disconnect no longer known bug

Co-authored-by: dingo35 <[email protected]>

* evse.h: put compiletime in debug version string (#36)

Co-authored-by: dingo35 <[email protected]>

* index.html: make it pass validation of html checker + small layout change (#38)

Co-authored-by: dingo35 <[email protected]>

* modbus.cpp: add debug messages for sent packets (#41)

Co-authored-by: dingo35 <[email protected]>

* evse.cpp: fix modbus overload when loadbalance disabled (#40)

* evse.cpp: fix modbus overload when loadbalance disabled

* evse.cpp: More elegant solution for incrementing ModbusRequest

Co-authored-by: dingo35 <[email protected]>

* evse.cpp, evse.h: comment out unused ChargeTimer (#37)

* evse.cpp, evse.h: comment out unused ChargeTimer

* evse.h, evse.cpp: remove unused ChargeTimer

Co-authored-by: dingo35 <[email protected]>

* evse.cpp: Fix compiler warning (#44)

Co-authored-by: dingo35 <[email protected]>

* evse.h, OneWire.cpp: introduce FAKE_RFID for debugging without an RFI… (#45)

* evse.h, OneWire.cpp: introduce FAKE_RFID for debugging without an RFID reader

* evse.h: extend comments on how to use FAKE_RFID

Co-authored-by: dingo35 <[email protected]>

* evse.cpp, evse.h: read imported and exported energy from mainsmeter+e… (#39)

* evse.cpp, evse.h: read imported and exported energy from mainsmeter+evmeter and feed them to the API

* evse.cpp: Fix modbus bug

* evse.h: Undo debug settings

Co-authored-by: dingo35 <[email protected]>

* evse.cpp: improve PP pin debug message (#59)

Co-authored-by: dingo35 <[email protected]>

* evse.cpp: fix meter config bug when switching modes (#60)

Co-authored-by: dingo35 <[email protected]>

* Release/v1.4.0 merge (#52)

* Pipeline build for release branches

* Increased 'safety' temperature thressholds to 70 (#48)

* Features/increased temp safety menu (#49)

* Added max temp menu item

* Added max temp menu item

* Added EV Meter information

* Added EV meter details on status page

* Added EV meter details on status page

* Refactored API textual booleans into real booleans

* Hide EV/BATT widget by default

Co-authored-by: Koen Serneels <[email protected]>

Co-authored-by: dingo35 <[email protected]>
Co-authored-by: Hans Dingemans <[email protected]>
Co-authored-by: Koen Serneels <[email protected]>
  • Loading branch information
4 people authored Aug 26, 2022
1 parent 488f302 commit e92a49d
Show file tree
Hide file tree
Showing 46 changed files with 10,079 additions and 594 deletions.
35 changes: 35 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,31 @@ Feel free to use this repository to build it yourself or to use the latest on fr
* Override charge current
* Pass in current measurements (p1, battery, ...) - this eliminates having to use additionalhard
* Switch between single- and three phase power (requires extra 2P relais on the 2nd output)
* Added "Inverted Eastron" kWh, so that polarity is reversed when power is supplied to meter from below (like in most Dutch power panels)
* Added current-limiting functionality if a subpanel is used, example:

mains
|
[main breaker 25A]
|
[kWh meter "Mains"]
|
-----------------------------------
| | |
[group breaker 16A] [subpanel breaker 16A]
|
[kWh meter "EV"]
|
----------------
| |
[washer breaker 16A] [smartevse breaker 16A]

In this example you configure Mains to 25A, MaxCircuit to 16A; the charger will limit itself so that neither the 25A mains nor the 16A from the subpanel will be exceeded...

* Added wifi-debugging: if compiled in, you can debug SmartEVSE device by telnetting to it over your wifi connection
* Small code optimisations, fixed some small bugs



# New Status Page
![image](https://user-images.githubusercontent.com/36994651/160653707-121dd618-ee0d-4cb3-bc39-82fde1a1a653.png)
Expand Down Expand Up @@ -50,3 +75,13 @@ View API <a href="https://swagger-ui.serkri.be/" target="_blank">https://swagger


Have an idea for the API? Edit it here <a href="https://swagger-editor.serkri.be/" target="_blank">https://swagger-editor.serkri.be/</a> and copy/paste it in a new issue with your request (https://github.com/serkri/SmartEVSE-3/issues)

# Building the firmware

* Install platformio-core https://docs.platformio.org/en/latest/core/installation/methods/index.html
* Clone this github project, cd to the smartevse directory where platformio.ini is located
* Compile firmware.bin: platformio run
* Compile spiffs.bin: platformio run -t buildfs

If you are not using the webserver /update endpoint:
* Upload via USB configured in platformio.ini: platformio run --target upload
64 changes: 26 additions & 38 deletions SmartEVSE-3/data/index.html

Large diffs are not rendered by default.

70 changes: 52 additions & 18 deletions SmartEVSE-3/include/evse.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,30 @@

#define __EVSE_MAIN


//for wifi-debugging, don't forget to set the debug levels LOG_EVSE_LOG and LOG_MODBUS_LOG before compiling
//the wifi-debugger is available by telnetting to your SmartEVSE device
//the on-screen instructions for verbose/warning/info/... do not apply,
//the debug messages that are compiled in are always shown for backwards compatibility reasons
//uncomment for production release, comment this to debug via wifi:
#define DEBUG_DISABLED 1

//uncomment this to emulate an rfid reader with rfid of card = 123456
//showing the rfid card is simulated by executing http://smartevse-xxx.lan/debug?showrfid=1
//don't forget to first store the card before it can activate charging
//#define FAKE_RFID 1

#ifndef VERSION
#ifdef DEBUG_DISABLED
#define VERSION "v3serkri-0.00"
#else
//please note that this version will only be displayed with the correct time/date if the program is recompiled
//so the webserver will show correct version if evse.cpp is recompiled
//the lcd display will show correct version if glcd.cpp is recompiled
#define VERSION (__TIME__ " @" __DATE__)
#endif
#endif


#define LOG_DEBUG 3 // Debug messages including measurement data
#define LOG_INFO 2 // Information messages without measurement data
Expand All @@ -38,6 +59,19 @@
#define LOG_MODBUS LOG_WARN // Default: LOG_WARN


#ifdef DEBUG_DISABLED
#define _Serialprintf Serial.printf //for standard use of the serial line
#define _Serialprintln Serial.println //for standard use of the serial line
#define _Serialprint Serial.print //for standard use of the serial line
#else
#define _Serialprintf rdebugA //for debugging over the serial line
#define _Serialprintln rdebugA //for debugging over the serial line
#define _Serialprint rdebugA //for debugging over the serial line
#include "RemoteDebug.h" //https://github.com/JoaoLopesF/RemoteDebug
extern RemoteDebug Debug;
#endif


#define TRANSFORMER_COMP 100


Expand Down Expand Up @@ -100,7 +134,7 @@
#define CHARGEDELAY 60 // Seconds to wait after overcurrent, before trying again
#define BACKLIGHT 120 // Seconds delay for the LCD backlight to turn off.
#define RFIDLOCKTIME 60 // Seconds delay for the EVSE to lock again (RFIDreader = EnableOne)
#define START_CURRENT 4 // Start charging when surplus current on one phase exceeds 4A (Solar)
#define START_CURRENT 4 // Start charging when surplus current on sum of all phases exceeds 4A (Solar)
#define STOP_TIME 10 // Stop charging after 10 minutes at MIN charge current (Solar)
#define IMPORT_CURRENT 0 // Allow the use of grid power when solar charging (Amps)
#define MAINS_METER 1 // Mains Meter, 1= Sensorbox, 2=Phoenix, 3= Finder, 4= Eastron, 5=Custom
Expand Down Expand Up @@ -307,11 +341,12 @@
#define EM_PHOENIX_CONTACT 2
#define EM_FINDER 3
#define EM_EASTRON 4
#define EM_ABB 5
#define EM_SOLAREDGE 6
#define EM_WAGO 7
#define EM_API 8
#define EM_CUSTOM 9
#define EM_EASTRON_INV 5
#define EM_ABB 6
#define EM_SOLAREDGE 7
#define EM_WAGO 8
#define EM_API 9
#define EM_CUSTOM 10

#define ENDIANESS_LBF_LWF 0
#define ENDIANESS_LBF_HWF 1
Expand All @@ -333,12 +368,10 @@ extern portMUX_TYPE rtc_spinlock; //TODO: Will be placed in the appropriate po
#define RTC_EXIT_CRITICAL() portEXIT_CRITICAL(&rtc_spinlock)


extern IPAddress localIp;
extern String APhostname;
extern String APpassword;
extern struct tm timeinfo;

extern uint8_t GLCDbuf[512]; // GLCD buffer (half of the display)

extern uint16_t MaxMains; // Max Mains Amps (hard limit, limited by the MAINS connection)
extern uint16_t MaxCurrent; // Max Charge current
Expand All @@ -352,9 +385,6 @@ extern uint8_t LoadBl;
extern uint8_t Switch; // Allow access to EVSE with button on SW
extern uint8_t RCmon; // Residual Current monitor
extern uint8_t Grid;
extern uint16_t StartCurrent;
extern uint16_t StopTime;
extern uint16_t ImportCurrent;
extern uint8_t MainsMeter; // Type of Mains electric meter (0: Disabled / Constants EM_*)
extern uint8_t MainsMeterAddress;
extern uint8_t MainsMeterMeasure; // What does Mains electric meter measure (0: Mains (Home+EVSE+PV) / 1: Home+EVSE / 2: Home)
Expand All @@ -363,21 +393,22 @@ extern uint8_t PVMeterAddress;
extern uint8_t EVMeter; // Type of EV electric meter (0: Disabled / Constants EM_*)
extern uint8_t EVMeterAddress;
extern uint8_t RFIDReader;
#ifdef FAKE_RFID
extern uint8_t Show_RFID;
#endif
extern uint8_t WIFImode;

extern int32_t Irms[3]; // Momentary current per Phase (Amps *10) (23 = 2.3A)
extern int32_t Irms_EV[3]; // Momentary current per Phase (Amps *10) (23 = 2.3A)

extern uint8_t State;
extern uint8_t ErrorFlags;
extern uint8_t NextState;

extern uint16_t MaxCapacity; // Cable limit (Amps)(limited by the wire in the charge cable, set automatically, or manually if Config=Fixed Cable)
extern int16_t Imeasured; // Max of all CT inputs (Amps * 10) (23 = 2.3A)
extern int16_t Isum;
extern uint16_t Balanced[NR_EVSES]; // Amps value per EVSE

extern uint8_t menu;
extern uint32_t ChargeTimer; // seconds counter
extern uint8_t LCDTimer;
extern uint16_t BacklightTimer; // remaining seconds the LCD backlight is active
extern int8_t TempEVSE; // Temperature EVSE in deg C (-40 - +125)
Expand All @@ -401,6 +432,9 @@ extern uint8_t RFIDstatus;
extern bool LocalTimeSet;

extern uint8_t MenuItems[MENU_EXIT];
extern boolean enable3f;
extern uint16_t maxTemp;
extern uint8_t ExternalMaster;

const struct {
char Key[8];
Expand Down Expand Up @@ -482,8 +516,10 @@ struct EMstruct {
uint8_t IDivisor; // 10^x
uint16_t PRegister; // Total power (W) -- only used for EV/PV meter momentary power
uint8_t PDivisor; // 10^x
uint16_t ERegister; // Total energy (kWh)
uint16_t ERegister; // Total imported energy (kWh); equals total energy if meter doesnt support exported energy
uint8_t EDivisor; // 10^x
uint16_t ERegister_Exp; // Total exported energy (kWh)
uint8_t EDivisor_Exp; // 10^x
};

extern struct EMstruct EMConfig[EM_CUSTOM + 1];
Expand All @@ -495,11 +531,9 @@ void setSolarStopTimer(uint16_t Timer);
void setState(uint8_t NewState, boolean forceState);
void setState(uint8_t NewState);
void setAccess(bool Access);
uint8_t getMenuItems(void);
uint8_t setItemValue(uint8_t nav, uint16_t val);
uint16_t getItemValue(uint8_t nav);
const char * getMenuItemOption(uint8_t nav);
void ConfigureModbusMode(uint8_t newmode);


#endif
#endif
15 changes: 5 additions & 10 deletions SmartEVSE-3/include/modbus.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,25 +52,20 @@ uint8_t mapModbusRegister2ItemID();
void ModbusReadInputRequest(uint8_t address, uint8_t function, uint16_t reg, uint16_t quantity);
void ModbusReadInputResponse(uint8_t address, uint8_t function, uint16_t *values, uint8_t count);
void ModbusWriteSingleRequest(uint8_t address, uint16_t reg, uint16_t value);
void ModbusWriteSingleResponse(uint8_t address, uint16_t reg, uint16_t value);
void ModbusWriteMultipleRequest(uint8_t address, uint16_t reg, uint16_t *values, uint8_t count);
void ModbusWriteMultipleResponse(uint8_t address, uint16_t reg, uint16_t count);
void ModbusException(uint8_t address, uint8_t function, uint8_t exception);
void ModbusDecode(uint8_t *buf, uint8_t len);

// ########################### EVSE modbus functions ###########################

signed int receiveMeasurement(uint8_t *buf, uint8_t pos, uint8_t Endianness, MBDataType dataType, signed char Divisor);
void requestEnergyMeasurement(uint8_t Meter, uint8_t Address);
signed int receiveEnergyMeasurement(uint8_t *buf, uint8_t Meter);
void requestPowerMeasurement(uint8_t Meter, uint8_t Address);
signed int receivePowerMeasurement(uint8_t *buf, uint8_t Meter);
void requestMeasurement(uint8_t Meter, uint8_t Address, uint16_t Register, uint8_t Count);
void requestCurrentMeasurement(uint8_t Meter, uint8_t Address);
uint8_t receiveCurrentMeasurement(uint8_t *buf, uint8_t Meter, signed int *var);

void ReadItemValueResponse(void);
void WriteItemValueResponse(void);
void WriteMultipleItemValueResponse(void);
//void ReadItemValueResponse(void);
//void WriteItemValueResponse(void);
//void WriteMultipleItemValueResponse(void);


#endif
#endif
29 changes: 29 additions & 0 deletions SmartEVSE-3/lib/RemoteDebug/.github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
name: Bug report
about: Create a report to help us improve

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1.
2.
3.

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Arduino Information:**
- OS: [e.g. Windows, MacOS, Linux]
- IDE [e.g. Arduino IDE, Eclipse, VSCode]
- IDE Version [e.g. 1.8.6]
- Board [e.g ESP32]

**Additional context**
Add any other context about the problem here.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
name: Feature request
about: Suggest an idea for this project

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
1 change: 1 addition & 0 deletions SmartEVSE-3/lib/RemoteDebug/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.DS_Store
21 changes: 21 additions & 0 deletions SmartEVSE-3/lib/RemoteDebug/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2018 Joao Lopes

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Loading

0 comments on commit e92a49d

Please sign in to comment.