Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do I add new commands? #6

Open
204maker opened this issue Nov 1, 2021 · 8 comments
Open

How do I add new commands? #6

204maker opened this issue Nov 1, 2021 · 8 comments

Comments

@204maker
Copy link

204maker commented Nov 1, 2021

I would like to change the Charging Profile on-the-fly on the charge point,
may I ask how will I be able to add this command on the Php file?

@DeltaVetal26
Copy link
Owner

Hi, @204maker

As I understand it, you want to use setChargingProfile?

In this script, there is no universal constructor for commands, since commands have different paths, required data.
I'll try to watch it over the next few days.

@DeltaVetal26
Copy link
Owner

DeltaVetal26 commented Nov 3, 2021

Added 'SetChargingProfile'.

To avoid customizing the script, you can simply change the script code in several places.

  1. Replace $stevePathArray and its contents with this. (Added the path to the SetChargingProfile command at the bottom.)
  $stevePathArray = array(
    // Local cmd (not use)
    'signin' => '/' . $supervision . '/manager/signin',
    'getTransaction' => '/' . $supervision . '/manager/transactions',
    'getConnectorState' => '/' . $supervision . '/manager/home/connectorStatus',
    // OCPP cmd
    'ReserveNow' => '/' . $supervision . '/manager/operations/' . $ocppVersion . '/ReserveNow',
    'RemoteStartTransaction' => '/' . $supervision . '/manager/operations/' . $ocppVersion . '/RemoteStartTransaction',
    'RemoteStopTransaction' => '/' . $supervision . '/manager/operations/' . $ocppVersion . '/RemoteStopTransaction',
    'UnlockConnector' => '/' . $supervision . '/manager/operations/' . $ocppVersion . '/UnlockConnector',
    'DataTransfer' => '/' . $supervision . '/manager/operations/' . $ocppVersion . '/DataTransfer',
    'Reset' => '/' . $supervision . '/manager/operations/' . $ocppVersion . '/Reset',
    'SetChargingProfile' => '/' . $supervision . '/manager/operations/' . $ocppVersion . '/SetChargingProfile'
  );
  1. Find the function cmdInputSelector($getData), inside the switch case, at the very bottom, under the case 'Reset'.... break; add a new case.
      case 'SetChargingProfile':
         $allow = true; // Allow command?
         if($allow) {
           // Redirect to SetChargingProfile page
           $content = curlConnectTo($steveServerAddres, $stevePath);
           // Get token
           $token = getCSRFToken($content);
           // Prepare form
           $form = "chargePointSelectList=".$ocppProtocol.";".$getData['ChargeBoxID'].";".$endpointURL."&connectorId=".$getData['ConnectorID']."&chargingProfilePk=".$getData['ChargingProfileID']."&_csrf=".$token."";
           // Send form
           curl_setopt($curl, CURLOPT_POSTFIELDS, $form);
           curl_exec($curl);
           return 'Ok';
         }
        break;

Call:

curl "http://localhost:8080/main.php?key=1234&ChargeBoxID=Ecc029&cmd=SetChargingProfile&ChargingProfileID=1&ConnectorID=0"

@204maker
Copy link
Author

204maker commented Nov 8, 2021

Thank you so much!
I was able to test it successfully today.

@204maker
Copy link
Author

How about the MeterValues command?
For example, Current.Export or Current.Import as measurand?

@DeltaVetal26
Copy link
Owner

If I understand correctly, when charging, the station itself transmits the values ​​of Current.Import, Current.Export?

You just want to get the freshest data from the transaction status page?

1

Or a request via TriggerMessage? (I do not know if he gives there values ​​for the charging current)

2

@204maker
Copy link
Author

204maker commented Nov 16, 2021

The idea would be to use the Current.Import or Current.Export to act as a trigger/flag to indicate that charging have started/ended. Our SteVe server is currently down so I have not tried this yet.

Also, with the RemoteStartTransaction command, is it possible to call add a Charging Profile ID to it?

@DeltaVetal26
Copy link
Owner

DeltaVetal26 commented Nov 19, 2021

Hi @204maker,

Unfortunately, I will not have time to add this command, as I have to leave for a long time.

I really wanted to help you.
Sorry.

Perhaps someone can help you with this, with knowledge of PHP, or try it yourself (the most important thing is to determine what data needs to be sent / received, this can be done through the web inspector in the browser and then you can use command templates).

@yadu117
Copy link

yadu117 commented Feb 14, 2022

Hai @DeltaVetal26
i implemented steve and api instences.

how to get the data from respective transcation id including start value, stop value, current voltage values, etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants