Skip to content

Commit

Permalink
Initial
Browse files Browse the repository at this point in the history
  • Loading branch information
WoCha-FR committed Nov 16, 2022
0 parents commit 06f3f55
Show file tree
Hide file tree
Showing 24 changed files with 13,224 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"env": {
"es2021": true,
"node": true
},
"extends": "standard",
"overrides": [
],
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"rules": {
},
"plugins": [
"jest"
],
"ignorePatterns": ["jest.config.js"]
}
104 changes: 104 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# Next.js build output
.next

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and *not* Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port
14 changes: 14 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
language: node_js

os: linux
dist: focal

node_js:
- node
- lts/*
- 17
- 16

script:
- npm run lint
- npm run coveralls
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2022 WOCHA

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
185 changes: 185 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
# mqtt4frenchtools

![npm](https://img.shields.io/npm/v/mqtt4frenchtools)
![License](https://img.shields.io/github/license/WoCha-FR/mqtt4frenchtools)
[![Build Status](https://app.travis-ci.com/WoCha-FR/mqtt4frenchtools.svg?branch=main)](https://app.travis-ci.com/WoCha-FR/mqtt4frenchtools)
[![Coverage Status](https://coveralls.io/repos/github/WoCha-FR/mqtt4frenchtools/badge.svg?branch=main)](https://coveralls.io/github/WoCha-FR/mqtt4frenchtools?branch=main)
![npm](https://img.shields.io/npm/dt/mqtt4frenchtools)

Publish values from french open api to MQTT and other usefull data.

### Data published

- Year information (number of days in year, day number in year, week number, ...)
- Saint of the day
- EDF Tempo color of today and tomorrow

And for each city provided as parameter :
- City information (INSEE code, School Zone, Latitude & Longitude, ...)
- Sun information (sunset, sunrise, ...)
- Moon Information (moonset, moonrise, ....)
- Statutory holiday (with Alsace-Moselle)
- School holidays (of the city School Zone)
- Wethear Alert

### API Used

- [geo.api.gouv.fr](https://geo.api.gouv.fr/)
- [Risques Météorologiques](https://public.opendatasoft.com/explore/dataset/risques-meteorologiques-copy/api/)
- [Le calendrier scolaire](https://data.education.gouv.fr/explore/dataset/fr-en-calendrier-scolaire/information/)
- [Jours fériés en France](https://calendrier.api.gouv.fr/jours-feries/)

## Installing

Simply install the package over npm. This will install all the required dependencies.

```
npm install -g mqtt4frenchtools
```

## Usage

```
Usage: mqtt4frenchtools [options]
Options:
-a, --ville ville [array]
-u, --mqttUrl mqtt broker url [default: "mqtt://127.0.0.1"]
-t, --mqttTopic mqtt topic prefix [default: "frenchtools"]
-v, --logVerbosity log verbosity
[choices: "error", "warn", "info", "debug"] [default: "info"]
-s, --sslVerify allow ssl connections with invalid certs
--version Show version number [boolean]
-h, --help Show help [boolean]
```

### Example

```
mqtt4apcaccess -u mqtt://192.168.5.1 -a Lyon
```

## MQTT Frame Output

```
frenchtools/global/saints
{
"saintj":"Sainte Agnès, Saint Almer, Saint Augustien, Saint Edme.",
"saintj1":"Saint Aciscle, Saint Alphée, Saint Denis d'Alexandrie."
}
```

```
frenchtools/global/annee
{
"nbjouran":365,
"numjouran":320,
"dstdate":"26/03/2023",
"dstdiff":130,
"numsem":46
}
```

```
frenchtools/global/edftempo
{
"coulj":"TEMPO_BLEU",
"coulj1":"TEMPO_BLEU",
"nb_bleu":222,
"nb_blanc":43,
"nb_rouge":22,
"tempodebut":"2022-09-01",
"tempofin":"2023-08-31"
}
```

```
frenchtools/Lyon69/infos
{
"nom":"Lyon",
"insee":"69123",
"deptnum":"69",
"deptnom":"Rhône",
"longitude":4.8351,
"latitude":45.758,
"zonevacances":"A"
}
```

```
frenchtools/Lyon69/ferie
{
"jourestferie":0,
"journomferie":"",
"prochainfdate":"25/12",
"prochainfnom":"Jour de Noël",
"prochainfdif":39
}
```

```
frenchtools/Lyon69/vacances
{
"jourestvacance":0,
"journomvacance":"",
"jourfinvacance":-1,
"prochainvacdate":"17/12",
"prochainvacnom":"Vacances de Noël",
"prochainvacdif":30
}
```

```
frenchtools/Lyon69/soleil
{
"soleillever":"7:42",
"soleilzenith":"12:26",
"soleilcoucher":"17:10",
"soleilelevation":"6.64",
"soleilelevzenith":"25.54",
"soleilposv":"-0.70",
"soleilposh":"209.80",
"jourduree":"9:28",
"jourdifference":"- 3m26s"
}
```

```
frenchtools/Lyon69/lune
{
"lunelever":"23:59",
"lunecoucher":"14:13",
"lunelevation":"-16.71",
"lunetoujours":0,
"luneabsente":0,
"lunephase":"Dernier quartier"
}
```

```
frenchtools/Lyon69/vigilance
{
"vent":"Vert",
"orage":"Vert",
"pluie_inondation":"Vert",
"inondation":"Vert",
"neige":"Vert",
"canicule":"Vert",
"grandfroid":"Vert",
"avalanches":"Vert",
"vague_submersion":"Vert",
"crue":"",
"conseil":"",
"commentaire":""
}
```

## Versioning

mqtt4apcaccess is maintained under the [semantic versioning](https://semver.org/) guidelines.

See the [releases](https://github.com/releases) on this repository for changelog.

## License

This project is licensed under MIT License - see the [LICENSE](LICENSE.md) file for details
1 change: 1 addition & 0 deletions data/alsace.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"2022-11-01":"Toussaint","2022-11-11":"11 novembre","2022-12-25":"Jour de Noël","2022-12-26":"2ème jour de Noël","2023-01-01":"1er janvier","2023-04-07":"Vendredi saint","2023-04-10":"Lundi de Pâques","2023-05-01":"1er mai","2023-05-08":"8 mai","2023-05-18":"Ascension","2023-05-29":"Lundi de Pentecôte","2023-07-14":"14 juillet","2023-08-15":"Assomption","2023-11-01":"Toussaint","2023-11-11":"11 novembre","2023-12-25":"Jour de Noël","2023-12-26":"2ème jour de Noël","2024-01-01":"1er janvier","2024-03-29":"Vendredi saint","2024-04-01":"Lundi de Pâques","2024-05-01":"1er mai","2024-05-08":"8 mai","2024-05-09":"Ascension","2024-05-20":"Lundi de Pentecôte","2024-07-14":"14 juillet","2024-08-15":"Assomption","2024-11-01":"Toussaint","2024-11-11":"11 novembre","2024-12-25":"Jour de Noël","2024-12-26":"2ème jour de Noël","2025-01-01":"1er janvier","2025-04-18":"Vendredi saint","2025-04-21":"Lundi de Pâques","2025-05-01":"1er mai","2025-05-08":"8 mai","2025-05-29":"Ascension","2025-06-09":"Lundi de Pentecôte","2025-07-14":"14 juillet","2025-08-15":"Assomption","2025-11-01":"Toussaint","2025-11-11":"11 novembre","2025-12-25":"Jour de Noël","2025-12-26":"2ème jour de Noël"}
1 change: 1 addition & 0 deletions data/metropole.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"2022-11-01":"Toussaint","2022-11-11":"11 novembre","2022-12-25":"Jour de Noël","2023-01-01":"1er janvier","2023-04-10":"Lundi de Pâques","2023-05-01":"1er mai","2023-05-08":"8 mai","2023-05-18":"Ascension","2023-05-29":"Lundi de Pentecôte","2023-07-14":"14 juillet","2023-08-15":"Assomption","2023-11-01":"Toussaint","2023-11-11":"11 novembre","2023-12-25":"Jour de Noël","2024-01-01":"1er janvier","2024-04-01":"Lundi de Pâques","2024-05-01":"1er mai","2024-05-08":"8 mai","2024-05-09":"Ascension","2024-05-20":"Lundi de Pentecôte","2024-07-14":"14 juillet","2024-08-15":"Assomption","2024-11-01":"Toussaint","2024-11-11":"11 novembre","2024-12-25":"Jour de Noël","2025-01-01":"1er janvier","2025-04-21":"Lundi de Pâques","2025-05-01":"1er mai","2025-05-08":"8 mai","2025-05-29":"Ascension","2025-06-09":"Lundi de Pentecôte","2025-07-14":"14 juillet","2025-08-15":"Assomption","2025-11-01":"Toussaint","2025-11-11":"11 novembre","2025-12-25":"Jour de Noël"}
1 change: 1 addition & 0 deletions data/saints.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions data/vacances.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"A":[{"debut":"2022-10-21T22:00:00.000Z","fin":"2022-11-07T07:30:00.000Z","nom":"Vacances de la Toussaint"},{"debut":"2022-12-16T23:00:00.000Z","fin":"2023-01-03T07:30:00.000Z","nom":"Vacances de Noël"},{"debut":"2023-02-03T23:00:00.000Z","fin":"2023-02-20T07:30:00.000Z","nom":"Vacances d'Hiver"},{"debut":"2023-04-07T22:00:00.000Z","fin":"2023-04-24T06:30:00.000Z","nom":"Vacances de Printemps"},{"debut":"2023-05-17T22:00:00.000Z","fin":"2023-05-22T06:30:00.000Z","nom":"Pont de l'Ascension"},{"debut":"2023-07-07T22:00:00.000Z","fin":"2023-09-04T06:30:00.000Z","nom":"Vacances d'Été"}],"B":[{"debut":"2022-10-21T22:00:00.000Z","fin":"2022-11-07T07:30:00.000Z","nom":"Vacances de la Toussaint"},{"debut":"2022-12-16T23:00:00.000Z","fin":"2023-01-03T07:30:00.000Z","nom":"Vacances de Noël"},{"debut":"2023-02-10T23:00:00.000Z","fin":"2023-02-27T07:30:00.000Z","nom":"Vacances d'Hiver"},{"debut":"2023-04-14T22:00:00.000Z","fin":"2023-05-02T06:30:00.000Z","nom":"Vacances de Printemps"},{"debut":"2023-05-17T22:00:00.000Z","fin":"2023-05-22T06:30:00.000Z","nom":"Pont de l'Ascension"},{"debut":"2023-07-07T22:00:00.000Z","fin":"2023-09-04T06:30:00.000Z","nom":"Vacances d'Été"}],"C":[{"debut":"2022-10-21T22:00:00.000Z","fin":"2022-11-07T07:30:00.000Z","nom":"Vacances de la Toussaint"},{"debut":"2022-12-16T23:00:00.000Z","fin":"2023-01-03T07:30:00.000Z","nom":"Vacances de Noël"},{"debut":"2023-02-17T23:00:00.000Z","fin":"2023-03-06T07:30:00.000Z","nom":"Vacances d'Hiver"},{"debut":"2023-04-21T22:00:00.000Z","fin":"2023-05-09T06:30:00.000Z","nom":"Vacances de Printemps"},{"debut":"2023-05-17T22:00:00.000Z","fin":"2023-05-22T06:30:00.000Z","nom":"Pont de l'Ascension"},{"debut":"2023-07-07T22:00:00.000Z","fin":"2023-09-04T06:30:00.000Z","nom":"Vacances d'Été"}],"CORSE":[{"debut":"2022-10-21T22:00:00.000Z","fin":"2022-11-07T07:30:00.000Z","nom":"Vacances de la Toussaint"},{"debut":"2022-12-16T23:00:00.000Z","fin":"2023-01-03T07:30:00.000Z","nom":"Vacances de Noël"},{"debut":"2022-12-16T23:00:00.000Z","fin":"2023-01-03T07:30:00.000Z","nom":"Vacances d'Hiver"},{"debut":"2023-04-14T22:00:00.000Z","fin":"2023-05-04T06:30:00.000Z","nom":"Vacances de Printemps"},{"debut":"2023-05-16T22:00:00.000Z","fin":"2023-05-22T06:30:00.000Z","nom":"Pont de l'Ascension"},{"debut":"2023-07-07T22:00:00.000Z","fin":"2023-09-04T06:30:00.000Z","nom":"Vacances d'Été"}]}
Loading

0 comments on commit 06f3f55

Please sign in to comment.