blueandi / niu-cloud-cli Goto Github PK
View Code? Open in Web Editor NEWNIU cloud command line interface for easy scripting.
License: MIT License
NIU cloud command line interface for easy scripting.
License: MIT License
I like your project !
I would like to have data of my Niu Scooter to integrate in Home Assistant
Your CLI is perfect but only on error on get-tracks
After many research, i think API have been change : /v3/motor_data/track/ respond an error...
Could you help me to find the new API point please, just the end point.
Thanks a lot !
Hi there,
is there a known problem with the communication protocol?
Main branch gave me some protocol errors, so I tried the development branch as it was more recent.
When I want to create the token file, I get the following error:
Internal error.
file:///home/openhabian/niu-cloud-cli-dev/src/createToken.js:100
yargs().exit(errorCode.FAILED);
^
ReferenceError: yargs is not defined
at file:///home/openhabian/niu-cloud-cli-dev/src/createToken.js:100:9
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Node.js v18.19.0
When building with a current node Docker image, I got the following error:
/opt/niu-cloud-cli/libs/niu-cloud-connector/index.js:25
var got = require("got");
^
Error [ERR_REQUIRE_ESM]: require() of ES Module /opt/niu-cloud-cli/node_modules/got/dist/source/index.js from /opt/niu-cloud-cli/libs/niu-cloud-connector/index.js not supported.
Instead change the require of /opt/niu-cloud-cli/node_modules/got/dist/source/index.js in /opt/niu-cloud-cli/libs/niu-cloud-connector/index.js to a dynamic import() which is available in all CommonJS modules.
at Object.<anonymous> (/opt/niu-cloud-cli/libs/niu-cloud-connector/index.js:25:11) {
code: 'ERR_REQUIRE_ESM'
}
This can be fixed by changing the above require to import got from 'got';
and adding "type": "module",
to package.json.
However, the same error happens after that with require("yargs");
from niu-cloud-cli.js. Changing that to the import syntax then leads to a bunch of errors from yarn that are above my (very limited) js knowledge:
file:///opt/niu-cloud-cli/niu-cloud-cli.js:30
.command(require("./src/createToken"))
^
ReferenceError: require is not defined in ES module scope, you can use import instead
This file is being treated as an ES module because it has a '.js' file extension and '/opt/niu-cloud-cli/package.json' contains "type": "module". To treat it as a CommonJS script, rename it to use the '.cjs' file extension.
at file:///opt/niu-cloud-cli/niu-cloud-cli.js:30:5
at ModuleJob.run (node:internal/modules/esm/module_job:218:25)
at async ModuleLoader.import (node:internal/modules/esm/loader:329:24)
at async loadESM (node:internal/process/esm_loader:28:7)
at async handleMainPromise (node:internal/modules/run_main:113:12)
```
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.