Basic HTTP client for sending commands remotely to the Steve OCPP control panel
Introduction:
This client can be used to expand the management capabilities of charging points connected to the SteVe OCPP server. Steve OCPP server has a reliable implementation of the OCPP protocol (1.2 - 1.6 SOAP/JSON), a convenient web interface. Unfortunately, at the moment SteVe does not have an API implementation for connecting external automation systems (Home Assistant, applications). I think this will appear, as SteVe is actively developing. Since Steve’s web interface works over HTTP, the idea came up to create an emulator that generates and sends requests to it from outside.
Why it can be applied:
How it works: 1) We call the main.php script (you can use curl, which is suitable for many situations) with the necessary parameters in the request (the implemented commands are indicated below) 2) The script is connected to the web server 3) Steve redirects the command to the charging point.
Conclusion: This script allows you to replace a person to create some automation.
The implemented commands: 1) Get connector state (it will return the current state):
curl "http://youraddress/main.php?key=YourKey&ChargeBoxID=001&cmd=getConnectorState&ConnectorID=2"
2) DataTransfer (will return the answer):curl "http://youraddress/main.php?key=YourKey&ChargeBoxID=001&cmd=DataTransfer&VendorID=YourVendor&MessageID=Hello!"
3) RemoteStartTransaction (response not implemented):curl "http://youraddress/main.php?key=YourKey&ChargeBoxID=001&cmd=RemoteStartTransaction&ConnectorID=2&idTag=ABCDE"
4) RemoteStopTransaction (response not implemented):curl "http://youraddress/main.php?key=YourKey&ChargeBoxID=001&cmd=RemoteStopTransaction&ConnectorID=2&idTag=ABCDE"
5) ReserveNow (response not implemented):
- Expiry=2020-07-09 12:30
curl "http://youraddress/main.php?key=YourKey&ChargeBoxID=001&cmd=ReserveNow&ConnectorID=2&idTag=ABCDE&Expiry=2020-07-09+12:30"
6) UnlockConnector (no response):curl "http://youraddress/main.php?key=YourKey&ChargeBoxID=001&cmd=UnlockConnector&ConnectorID=2"
7) Reset (no response):curl "http://youraddress/main.php?key=YourKey&ChargeBoxID=001;002;003&cmd=Reset"
8) SetChargingProfile (no response):curl "http://youraddress/main.php?key=YourKey&ChargeBoxID=001&cmd=SetChargingProfile&ChargingProfileID=1&ConnectorID=0"
Important details: 1) I wrote this for the first time, suggestions for improvement are welcome. 2) You can add new teams or leave a request. 3) This script has only basic functions. Perhaps there is not something here.
Configuration:
$steveServerAddres = 'http://xx.xx.xxx.xx:0000'; // Steve server address
$steveLogin = 'admin'; // Steve login
$stevePass = '1234'; // Steve pass
$authKey = 'WriteYourKey'; // Protection key (Generate it for and enter each time you access the script)
$ocppProtocol = 'JSON'; // (If use OCPP-S - change to SOAP)
$ocppVersion = 'v1.6';
$supervision = 'steve';
// Only for SOAP use - charge point endpoint url
// Write here your charge point endpoint url
$endpointURL = 'http://localhost:9090/ocpp'; // (ex: http://localhost:9090/ocpp)