Open udayprksh opened 4 years ago
hi I also received this error.Is your problem solved?
Try this
import { CentralSystem, OCPPCommands } from 'ocpp-eliftech';
const server = new CentralSystem();
server.listen(9220);
i try this but get this error SyntaxError: The requested module 'ocpp-eliftech' does not provide an export named 'OCPPCommands'
Hi @pSnehanshu ,
I am facing the same issue for "OCPPCommands" and shows me error SyntaxError: The requested module 'ocpp-eliftech' does not provide an export named 'OCPPCommands'
So, can you please provide me the solution for it?
I wrote a small project using this package but got this error instead
Error: Cannot find module 'babel-runtime/helpers/extends'
Hence I installed it using npm i babel-runtime
.
But then it worked. Check the attached zip file.
Also do notice that I have put type: module
in package.json.
I will also like to plug my own package here, which you can give a try. https://github.com/pSnehanshu/ocpp-task-manager
Hi @pSnehanshu,
I have downloaded "ocpp-eliftech.zip" and extract and tried to run on my end as below:
on package.json file I have added "start": "node index.js", under "scripts" object and run with command "npm start".
But still facing the same issue and show me error: SyntaxError: The requested module 'ocpp-eliftech' does not provide an export named 'OCPPCommands'
Can you please point out to me why it is showing above error to me?
What is your node version? Can you try with v16?
Hi @pSnehanshu , Thanks Awesome! now it's working with node version to 16.14.2 I think ocpp-eliftech package is working with ocpp version 1.6. Am I Correct?
Hi @pSnehanshu,
If we want to communicate with OCPP system in real world, then do we need to implement both server and client on our end? Or do we need to just implement OCPP client only?
Here, I am little bit confused because on some packages it is mentioned the server URL to config at client side like "http://localhost:9220/webServices/ocpp/CP1111" and on some packages it is mentioned as "ws://localhost:8080/ocpp/1.6J"
Because I have tried to run ocpp client, but not working on my end. So, can you please provide me related help on it?
Thanks,
@kvext Depends on if you are trying to build a charger or a backend system. Read my article and see if it helps. https://www.snehanshu.com/electric-vehicles/ocpp/2020/04/03/what-is-ocpp.html
Hi @pSnehanshu, I want to communicate with charging station through back-end and want to get status and information about charging % to be completed. So, what should I do for it? Thanks,
You will have to create an OCPP server. It will listen for websocket connections. It can receive commands from charger as well as send commands to the charger. I will suggest you read the official documentation for a better understanding.
Hi @pSnehanshu,
I am trying to create OCPP server and client using https://www.npmjs.com/package/ocpp-rpc But here, If I am sending message from server to client by creating separate apps like server_app and client_app, It is not working. From server app, I want to send message or call method from server:
rpcServer.on('client', client => {
client.call('Say', `Hello, ${client.identity}!`);
});
On Client app, I have already define method as below:
cli.handle('Say', ({params}) => {
console.log('Server said:', params);
});
But, Same thing is working only if I will create both server and client objects on the same file as per last example.
So, Any idea why it is not working if I want to call methods with separate files?
Thanks,
You should ask the creator of that library.
Hi,
I have installed the OCPP module using "npm install --save ocpp-eliftech" and use the OCPP Server example in our index.js file as shown below :
import { OCPPServer, OCPPCommands } from 'ocpp-eliftech'; const server = new OCPPServer(); server.listen(9220); server.onRequest = async function(command) { // Handle different commands if (command instanceof OCPPCommands.BootNotification) { return { status: 'Accepted', currentTime: new Date().toISOString(), interval: 60 }; } }
When we run
npm start
then got error "SyntaxError: The requested module 'ocpp-eliftech' does not provide an export named 'OCPPServer'"Please let me know how to solve this issue.