Comparing version 0.0.0 to 1.0.0
{ | ||
"name": "linky", | ||
"version": "0.0.0", | ||
"description": "Takes a string and returns a string that wraps http links in anchor tags", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "node test.js" | ||
}, | ||
"homepage": "https://github.com/Colingo/linky", | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/Colingo/linky.git" | ||
}, | ||
"keywords": [ | ||
"html", | ||
"link" | ||
], | ||
"author": "Robert Damphousse", | ||
"license": "MIT" | ||
"name": "linky", | ||
"description": "Easily retrieve your Linky power consumption", | ||
"version": "1.0.0", | ||
"author": "bokub", | ||
"bugs": "https://github.com/bokub/linky/issues", | ||
"dependencies": { | ||
"axios": "^0.20.0", | ||
"chalk": "^4.1.0", | ||
"conf": "^7.1.2", | ||
"meow": "^7.1.1", | ||
"mkdirp": "^1.0.4", | ||
"ora": "^5.1.0", | ||
"qs": "^6.9.4" | ||
}, | ||
"devDependencies": { | ||
"@ava/typescript": "^1.1.1", | ||
"@bokub/prettier-config": "^1.0.1", | ||
"@types/mkdirp": "^1.0.1", | ||
"@types/qs": "^6.9.4", | ||
"ava": "^3.12.1", | ||
"codecov": "^3.7.2", | ||
"nyc": "^15.1.0", | ||
"pkg": "^4.4.9", | ||
"prettier": "^2.1.1", | ||
"ts-node": "^9.0.0", | ||
"typescript": "^4.0.2" | ||
}, | ||
"files": [ | ||
"dist" | ||
], | ||
"homepage": "https://github.com/bokub/linky", | ||
"keywords": [ | ||
"linky", | ||
"enedis", | ||
"datahub", | ||
"power", | ||
"api", | ||
"cli", | ||
"consumption" | ||
], | ||
"license": "GPL-3.0-or-later", | ||
"main": "dist/src/index.js", | ||
"bin": { | ||
"linky": "dist/bin/cli.js" | ||
}, | ||
"types": "dist/src/index.d.ts", | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"repository": "https://github.com/bokub/linky", | ||
"scripts": { | ||
"coverage": "nyc report --reporter=text-lcov > coverage.lcov && codecov", | ||
"test": "nyc ava --timeout=1m", | ||
"prepublish": "npm run build", | ||
"build": "rm -fr ./dist && tsc", | ||
"pkg": "rm -fr ./pkg && pkg . --out-path pkg", | ||
"prettier": "prettier --write **/*.{ts,md,json,yml,html}" | ||
}, | ||
"prettier": "@bokub/prettier-config", | ||
"ava": { | ||
"extensions": [ | ||
"ts" | ||
], | ||
"require": [ | ||
"ts-node/register" | ||
] | ||
}, | ||
"nyc": { | ||
"extension": [ | ||
".ts" | ||
], | ||
"exclude": [ | ||
"**/*.d.ts", | ||
"test.ts" | ||
] | ||
} | ||
} |
144
README.md
@@ -1,33 +0,149 @@ | ||
## Description | ||
# Linky | ||
Takes a string and returns a string that wraps http links in anchor tags | ||
[![Version][version-src]][version-href] | ||
[![Build Status][build-src]][build-href] | ||
[![Coverage][coverage-src]][coverage-href] | ||
[![Code style][style-src]][style-href] | ||
Can also take options to specify some attributes on the anchor tag (only target at the moment) | ||
> **N.B**: Because this tool is targeted for french people, the documentation is...in french | ||
## Simple example | ||
Ce module vous permet de récupérer votre consommation électrique Linky via les nouvelles API _"Authorize V1"_ et _"Metering Data V4"_ d'Enedis | ||
<p align="center"> | ||
<img src="https://user-images.githubusercontent.com/17952318/93326183-b5ba2400-f818-11ea-85cf-c278a1e32b58.gif" alt="Screenshot"> | ||
</p> | ||
Il peut s'utiliser de 2 façons : | ||
1. [En ligne de commande](#1-linky-en-ligne-de-commande) | ||
2. [En tant que module Node.js](#2-linky-comme-module-nodejs), depuis un autre programme | ||
Notez qu'il vous faut un compteur Linky et un espace client Enedis pour pouvoir utiliser ce module | ||
## 1. Linky en ligne de commande | ||
### Installation | ||
Si vous avez Node.js sur votre machine : | ||
```bash | ||
npm i -g linky | ||
``` | ||
var linky = require('linky') | ||
linky('Go to http://www.colingo.com') | ||
Dans le cas contraire, vous pouvez télécharger le binaire correspondant à votre plateforme dans les [assets de la dernière release](https://github.com/bokub/linky/releases). | ||
> **N.B :** Si vous choisissez d'utiliser un binaire, il faudra adapter les exemples de cette documentation en replaçant la commande `linky` par le nom du binaire. | ||
> | ||
> Par exemple, au lieu de faire `linky --help`, il faudra faire `./linky-win.exe --help` | ||
### Utilisation | ||
Avant toute chose, il faudra vous connecter à votre espace client Enedis et leur donner l'autorisation de partager vos données avec une application extérieure. | ||
Rendez-vous sur [conso.vercel.app](https://conso.vercel.app) pour donner votre accord et récupérer un jeu de tokens. | ||
Puis, créez une connexion à votre compte avec la commande suivante: | ||
```bash | ||
linky auth -a <access token> -r <refresh token> -u <usage point ID> --sandbox | ||
``` | ||
Returns: | ||
Si tout se passe bien, vous pourrez alors récupérer votre consommation quotidienne, votre courbe de charge (consommation par demi-heure), et votre consommation maximale par jour. | ||
```bash | ||
# Récupère la consommation quotidienne du 1er au 7 septembre 2020 inclus | ||
linky daily --start 2020-09-01 --end 2020-09-08 | ||
# Récupère la puissance moyenne consommée le 1er semptembre 2020, sur un intervalle de 30 min | ||
linky loadcurve --start 2020-09-01 --end 2020-09-02 | ||
# Récupère la puissance maximale de consommation atteinte quotidiennement du 24 au 31 août inclus | ||
linky maxpower --start 2020-08-24 --end 2020-09-01 | ||
``` | ||
Go to <a href="http://www.colingo.com" target="">http://www.colingo.com</a> | ||
Vous pouvez sauvegarder vos résultats dans un fichier JSON grâce à l'option `--output` | ||
```bash | ||
linky loadcurve --start 2020-09-01 --end 2020-09-02 --output data/ma_conso.json | ||
``` | ||
## With options | ||
Pour voir l'aide détaillée : | ||
```bash | ||
linky --help | ||
``` | ||
var linky = require('linky') | ||
linky('Go to http://www.colingo.com',{target:"_blank"}) | ||
## 2. Linky comme module Node.js | ||
### Installation | ||
```bash | ||
# Depuis un projet Node.js | ||
npm i @bokub/linky | ||
``` | ||
Returns: | ||
### Utilisation | ||
```js | ||
const linky = require('@bokub/linky'); | ||
// Créez une session | ||
const session = new linky.Session({ | ||
accessToken: 'access token', | ||
refreshToken: 'refresh token', | ||
usagePointId: 'usage point ID', | ||
onTokenRefresh: (accessToken, refreshToken) => { | ||
// Cette fonction sera appellée si les tokens sont rafaîchis | ||
// Les tokens précédents ne seront plus valides | ||
// Il faudra utiliser ces nouveaux tokens à la prochaine création de session | ||
}, | ||
}); | ||
// Récupère la consommation quotidienne du 1er au 7 septembre 2020 inclus | ||
session.getDailyConsumption('2020-09-01', '2020-09-08').then((result) => { | ||
console.log(result); | ||
/* | ||
{ | ||
"unit": "Wh", | ||
"data": [ | ||
{ "date": "2020-09-01", "value": 12278 }, | ||
{ "date": "2020-09-02", "value": 15637 }, | ||
... | ||
*/ | ||
}); | ||
// Récupère la puissance moyenne consommée le 1er semptembre 2020, sur un intervalle de 30 min | ||
session.getLoadCurve('2020-09-01', '2020-09-02').then((result) => { | ||
console.log(result); | ||
/* | ||
{ | ||
"unit": "W", | ||
"data": [ | ||
{ "date": "2020-09-01 00:00:00", "value": 582 }, | ||
{ "date": "2020-09-01 00:30:00", "value": 448 }, | ||
... | ||
*/ | ||
}); | ||
// Récupère la puissance maximale de consommation atteinte quotidiennement du 24 au 31 août inclus | ||
session.getMaxPower('2020-08-24', '2020-09-01').then((result) => { | ||
console.log(result); | ||
/* | ||
{ | ||
"unit": "VA", | ||
"data": [ | ||
{ "date": "2020-08-24 13:54:04", "value": 1941 }, | ||
{ "date": "2020-08-25 01:48:26", "value": 1648 }, | ||
... | ||
*/ | ||
}); | ||
``` | ||
Go to <a href="http://www.colingo.com" target="_blank">http://www.colingo.com</a> | ||
``` | ||
[build-src]: https://flat.badgen.net/travis/bokub/linky | ||
[build-href]: https://travis-ci.org/bokub/linky | ||
[version-src]: https://runkit.io/bokub/npm-version/branches/master/%40bokub%2Flinky?style=flat | ||
[version-href]: https://www.npmjs.com/package/@bokub/linky | ||
[coverage-src]: https://flat.badgen.net/codecov/c/github/bokub/linky | ||
[coverage-href]: https://codecov.io/gh/bokub/linky | ||
[style-src]: https://flat.badgen.net/badge/code%20style/prettier/ff69b4 | ||
[style-href]: https://github.com/prettier/prettier |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Copyleft License
License(Experimental) Copyleft license information was found.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
Non-permissive License
License(Experimental) A license not known to be considered permissive was found.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
59756
11
393
0
150
7
11
3
70
3
2
+ Addedaxios@^0.20.0
+ Addedchalk@^4.1.0
+ Addedconf@^7.1.2
+ Addedmeow@^7.1.1
+ Addedmkdirp@^1.0.4
+ Addedora@^5.1.0
+ Addedqs@^6.9.4
+ Added@babel/code-frame@7.26.2(transitive)
+ Added@babel/helper-validator-identifier@7.25.9(transitive)
+ Added@types/minimist@1.2.5(transitive)
+ Added@types/normalize-package-data@2.4.4(transitive)
+ Addedajv@6.12.6(transitive)
+ Addedansi-regex@5.0.1(transitive)
+ Addedansi-styles@4.3.0(transitive)
+ Addedarrify@1.0.1(transitive)
+ Addedatomically@1.7.0(transitive)
+ Addedaxios@0.20.0(transitive)
+ Addedbase64-js@1.5.1(transitive)
+ Addedbl@4.1.0(transitive)
+ Addedbuffer@5.7.1(transitive)
+ Addedcall-bind-apply-helpers@1.0.1(transitive)
+ Addedcall-bound@1.0.3(transitive)
+ Addedcamelcase@5.3.1(transitive)
+ Addedcamelcase-keys@6.2.2(transitive)
+ Addedchalk@4.1.2(transitive)
+ Addedcli-cursor@3.1.0(transitive)
+ Addedcli-spinners@2.9.2(transitive)
+ Addedclone@1.0.4(transitive)
+ Addedcolor-convert@2.0.1(transitive)
+ Addedcolor-name@1.1.4(transitive)
+ Addedconf@7.1.2(transitive)
+ Addeddebounce-fn@4.0.0(transitive)
+ Addeddecamelize@1.2.0(transitive)
+ Addeddecamelize-keys@1.1.1(transitive)
+ Addeddefaults@1.0.4(transitive)
+ Addeddot-prop@5.3.0(transitive)
+ Addeddunder-proto@1.0.1(transitive)
+ Addedenv-paths@2.2.1(transitive)
+ Addederror-ex@1.3.2(transitive)
+ Addedes-define-property@1.0.1(transitive)
+ Addedes-errors@1.3.0(transitive)
+ Addedes-object-atoms@1.1.1(transitive)
+ Addedfast-deep-equal@3.1.3(transitive)
+ Addedfast-json-stable-stringify@2.1.0(transitive)
+ Addedfind-up@3.0.04.1.0(transitive)
+ Addedfollow-redirects@1.15.9(transitive)
+ Addedfunction-bind@1.1.2(transitive)
+ Addedget-intrinsic@1.2.7(transitive)
+ Addedget-proto@1.0.1(transitive)
+ Addedgopd@1.2.0(transitive)
+ Addedhard-rejection@2.1.0(transitive)
+ Addedhas-flag@4.0.0(transitive)
+ Addedhas-symbols@1.1.0(transitive)
+ Addedhasown@2.0.2(transitive)
+ Addedhosted-git-info@2.8.9(transitive)
+ Addedieee754@1.2.1(transitive)
+ Addedindent-string@4.0.0(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedis-arrayish@0.2.1(transitive)
+ Addedis-core-module@2.16.1(transitive)
+ Addedis-interactive@1.0.0(transitive)
+ Addedis-obj@2.0.0(transitive)
+ Addedis-plain-obj@1.1.0(transitive)
+ Addedis-unicode-supported@0.1.0(transitive)
+ Addedjs-tokens@4.0.0(transitive)
+ Addedjson-parse-even-better-errors@2.3.1(transitive)
+ Addedjson-schema-traverse@0.4.1(transitive)
+ Addedjson-schema-typed@7.0.3(transitive)
+ Addedkind-of@6.0.3(transitive)
+ Addedlines-and-columns@1.2.4(transitive)
+ Addedlocate-path@3.0.05.0.0(transitive)
+ Addedlog-symbols@4.1.0(transitive)
+ Addedmake-dir@3.1.0(transitive)
+ Addedmap-obj@1.0.14.3.0(transitive)
+ Addedmath-intrinsics@1.1.0(transitive)
+ Addedmeow@7.1.1(transitive)
+ Addedmimic-fn@2.1.03.1.0(transitive)
+ Addedmin-indent@1.0.1(transitive)
+ Addedminimist-options@4.1.0(transitive)
+ Addedmkdirp@1.0.4(transitive)
+ Addednormalize-package-data@2.5.0(transitive)
+ Addedobject-inspect@1.13.3(transitive)
+ Addedonetime@5.1.2(transitive)
+ Addedora@5.4.1(transitive)
+ Addedp-limit@2.3.0(transitive)
+ Addedp-locate@3.0.04.1.0(transitive)
+ Addedp-try@2.2.0(transitive)
+ Addedparse-json@5.2.0(transitive)
+ Addedpath-exists@3.0.04.0.0(transitive)
+ Addedpath-parse@1.0.7(transitive)
+ Addedpicocolors@1.1.1(transitive)
+ Addedpkg-up@3.1.0(transitive)
+ Addedpunycode@2.3.1(transitive)
+ Addedqs@6.14.0(transitive)
+ Addedquick-lru@4.0.1(transitive)
+ Addedread-pkg@5.2.0(transitive)
+ Addedread-pkg-up@7.0.1(transitive)
+ Addedreadable-stream@3.6.2(transitive)
+ Addedredent@3.0.0(transitive)
+ Addedresolve@1.22.10(transitive)
+ Addedrestore-cursor@3.1.0(transitive)
+ Addedsafe-buffer@5.2.1(transitive)
+ Addedsemver@5.7.26.3.17.7.0(transitive)
+ Addedside-channel@1.1.0(transitive)
+ Addedside-channel-list@1.0.0(transitive)
+ Addedside-channel-map@1.0.1(transitive)
+ Addedside-channel-weakmap@1.0.2(transitive)
+ Addedsignal-exit@3.0.7(transitive)
+ Addedspdx-correct@3.2.0(transitive)
+ Addedspdx-exceptions@2.5.0(transitive)
+ Addedspdx-expression-parse@3.0.1(transitive)
+ Addedspdx-license-ids@3.0.21(transitive)
+ Addedstring_decoder@1.3.0(transitive)
+ Addedstrip-ansi@6.0.1(transitive)
+ Addedstrip-indent@3.0.0(transitive)
+ Addedsupports-color@7.2.0(transitive)
+ Addedsupports-preserve-symlinks-flag@1.0.0(transitive)
+ Addedtrim-newlines@3.0.1(transitive)
+ Addedtype-fest@0.13.10.6.00.8.1(transitive)
+ Addeduri-js@4.4.1(transitive)
+ Addedutil-deprecate@1.0.2(transitive)
+ Addedvalidate-npm-package-license@3.0.4(transitive)
+ Addedwcwidth@1.0.1(transitive)
+ Addedyargs-parser@18.1.3(transitive)