From 1607caf729335fb769da2575ead7930854b9b360 Mon Sep 17 00:00:00 2001 From: cddu33 Date: Sun, 5 Nov 2023 18:29:09 +0000 Subject: [PATCH 01/10] recuperation ok --- config.yaml | 21 ++++++++++------- src/config.ts | 31 +++++++++++++++++++------ src/index.ts | 44 +++++++++++++++++++++++++++++------ src/linky.ts | 64 ++++++++++++++++++++++++++++++++++++--------------- 4 files changed, 119 insertions(+), 41 deletions(-) diff --git a/config.yaml b/config.yaml index 6a050d5..dbee94c 100644 --- a/config.yaml +++ b/config.yaml @@ -1,10 +1,10 @@ name: Linky description: Sync Energy dashboards with your Linky smart meter -version: 1.1.0 +version: 1.2.1 slug: linky init: false url: https://github.com/bokub/ha-linky -image: ghcr.io/bokub/ha-linky-{arch} +#image: ghcr.io/bokub/ha-linky-{arch} arch: - aarch64 - amd64 @@ -13,12 +13,17 @@ arch: - i386 homeassistant_api: true options: - consumption PRM: '' - consumption token: '' + PRM: '' + token: '' consumption name: 'Linky consumption' - consumption action: sync + action: sync + sync production: non + production name: 'Linky production' + schema: - consumption PRM: str? - consumption token: str? + PRM: str? + token: str? consumption name: str - consumption action: list(sync|reset) + action: list(sync|reset) + sync production: list(yes|non) + production name: str diff --git a/src/config.ts b/src/config.ts index da55f4d..781e291 100644 --- a/src/config.ts +++ b/src/config.ts @@ -7,25 +7,42 @@ export type UserConfig = { name: string; action: 'sync' | 'reset'; }; + production?: { + prm: string; + token: string; + name: string; + action: 'yes' | 'non'; + }; }; export function getUserConfig(): UserConfig { try { const parsed: { - 'consumption PRM'?: string; - 'consumption token'?: string; + PRM?: string; + token?: string; 'consumption name'?: string; - 'consumption action'?: string; + action?: string; + 'production name'?: string; + 'sync production'?: string; } = JSON.parse(readFileSync('/data/options.json', 'utf8')); return { consumption: - parsed['consumption PRM'] && parsed['consumption token'] + parsed['PRM'] && parsed['token'] ? { - prm: parsed['consumption PRM'], - token: parsed['consumption token'], + prm: parsed['PRM'], + token: parsed['token'], name: parsed['consumption name'] || 'Linky consumption', - action: parsed['consumption action'] === 'reset' ? 'reset' : 'sync', + action: parsed['action'] === 'reset' ? 'reset' : 'sync', + } + : undefined, + production: + parsed['PRM'] && parsed['token'] + ? { + prm: parsed['PRM'], + token: parsed['token'], + name: parsed['production name'] || 'Linky consumption', + action: parsed['sync production'] === 'yes' ? 'yes' : 'non', } : undefined, }; diff --git a/src/index.ts b/src/index.ts index 9d7b409..a564c83 100644 --- a/src/index.ts +++ b/src/index.ts @@ -16,14 +16,19 @@ async function main() { return; } - info('Consumption PRM ' + userConfig.consumption.prm + ' found in configuration'); + info('PRM ' + userConfig.consumption.prm + ' found in configuration'); const consumptionClient = new LinkyClient(userConfig.consumption.token, userConfig.consumption.prm); + let productionClient = null; + if (userConfig.production.action === 'yes') { + productionClient = new LinkyClient(userConfig.production.token, userConfig.production.prm); + } const haClient = new HomeAssistantClient(); await haClient.connect(); if (userConfig.consumption.action === 'reset') { await haClient.purge(userConfig.consumption.prm); + await haClient.purge(userConfig.production.prm); info('Statistics removed successfully!'); haClient.disconnect(); debug('HA Linky stopped'); @@ -32,8 +37,12 @@ async function main() { async function init() { info(`[${dayjs().format('DD/MM HH:mm')}] New PRM detected, importing as much historical data as possible`); - const energyData = await consumptionClient.getEnergyData(null); + const energyData = await consumptionClient.getEnergyData(null, false); await haClient.saveStatistics(userConfig.consumption.prm, userConfig.consumption.name, energyData); + if (userConfig.production.action === 'yes') { + const energyData = await productionClient.getEnergyData(null, true); + await haClient.saveStatistics(userConfig.production.prm, userConfig.production.name, energyData); + } } async function sync() { info(`[${dayjs().format('DD/MM HH:mm')}] Data synchronization started`); @@ -43,16 +52,37 @@ async function main() { warn('Data synchronization failed, no previous statistic found in Home Assistant'); return; } + let lastStatistic1; + if (userConfig.production.action === 'yes') { + lastStatistic1 = await haClient.findLastStatistic(userConfig.production.prm); + if (!lastStatistic1) { + warn('Data synchronization failed, no previous statistic found in Home Assistant'); + return; + } + } const isSyncingNeeded = dayjs(lastStatistic.start).isBefore(dayjs().subtract(2, 'days')) && dayjs().hour() >= 6; - if (!isSyncingNeeded) { + let isSyncingNeeded1 = false; + if (userConfig.production.action === 'yes') { + isSyncingNeeded1 = dayjs(lastStatistic1.start).isBefore(dayjs().subtract(2, 'days')) && dayjs().hour() >= 6; + } + + if (!isSyncingNeeded && !isSyncingNeeded1) { debug('Everything is up to date, nothing to synchronize'); return; } - const firstDay = dayjs(lastStatistic.start).add(1, 'day'); - const energyData = await consumptionClient.getEnergyData(firstDay); - incrementSums(energyData, lastStatistic.sum); - await haClient.saveStatistics(userConfig.consumption.prm, userConfig.consumption.name, energyData); + if (isSyncingNeeded) { + const firstDay = dayjs(lastStatistic.start).add(1, 'day'); + const energyData = await consumptionClient.getEnergyData(firstDay, false); + incrementSums(energyData, lastStatistic.sum); + await haClient.saveStatistics(userConfig.consumption.prm, userConfig.consumption.name, energyData); + } + if (isSyncingNeeded1) { + const firstDay = dayjs(lastStatistic1.start).add(1, 'day'); + const energyData = await productionClient.getEnergyData(firstDay, true); + incrementSums(energyData, lastStatistic1.sum); + await haClient.saveStatistics(userConfig.production.prm, userConfig.production.name, energyData); + } } const isNew = await haClient.isNewPRM(userConfig.consumption.prm); diff --git a/src/linky.ts b/src/linky.ts index 712d9ac..ace9ba5 100644 --- a/src/linky.ts +++ b/src/linky.ts @@ -11,10 +11,10 @@ export class LinkyClient { constructor(token: string, prm: string) { this.prm = prm; this.session = new Session(token, prm); - this.session.userAgent = 'ha-linky/1.1.0'; + this.session.userAgent = 'ha-linky/1.2.0'; } - public async getEnergyData(firstDay: null | Dayjs): Promise { + public async getEnergyData(firstDay: null | Dayjs, prod: boolean): Promise { const history: LinkyDataPoint[][] = []; let offset = 0; let limitReached = false; @@ -35,14 +35,27 @@ export class LinkyClient { } let to = dayjs().subtract(offset, 'days').format('YYYY-MM-DD'); - try { - const loadCurve = await this.session.getLoadCurve(from, to); - history.unshift(LinkyClient.formatLoadCurve(loadCurve)); - debug(`Successfully retrieved load curve from ${from} to ${to}`); - offset += interval; - } catch (e) { - debug(`Cannot fetch load curve from ${from} to ${to}, here is the error:`); - warn(e); + + if (prod) { + try { + const loadCurve = await this.session.getProductionLoadCurve(from, to); + history.unshift(LinkyClient.formatLoadCurve(loadCurve)); + debug(`Successfully retrieved load curve from ${from} to ${to}`); + offset += interval; + } catch (e) { + debug(`Cannot fetch load curve prod from ${from} to ${to}, here is the error:`); + warn(e); + } + } else { + try { + const loadCurve = await this.session.getLoadCurve(from, to); + history.unshift(LinkyClient.formatLoadCurve(loadCurve)); + debug(`Successfully retrieved load curve from ${from} to ${to}`); + offset += interval; + } catch (e) { + debug(`Cannot fetch load curve consum from ${from} to ${to}, here is the error:`); + warn(e); + } } for (let loop = 0; loop < 10; loop++) { @@ -65,15 +78,28 @@ export class LinkyClient { limitReached = true; } - try { - const dailyData = await this.session.getDailyConsumption(from, to); - history.unshift(LinkyClient.formatDailyData(dailyData)); - debug(`Successfully retrieved daily data from ${from} to ${to}`); - offset += interval; - } catch (e) { - debug(`Cannot fetch daily data from ${from} to ${to}, here is the error:`); - warn(e); - break; + if (prod) { + try { + const dailyData = await this.session.getDailyProduction(from, to); + history.unshift(LinkyClient.formatDailyData(dailyData)); + debug(`Successfully retrieved daily prod data from ${from} to ${to}`); + offset += interval; + } catch (e) { + debug(`Cannot fetch daily prod data from ${from} to ${to}, here is the error:`); + warn(e); + break; + } + } else { + try { + const dailyData = await this.session.getDailyConsumption(from, to); + history.unshift(LinkyClient.formatDailyData(dailyData)); + debug(`Successfully retrieved daily consum data from ${from} to ${to}`); + offset += interval; + } catch (e) { + debug(`Cannot fetch daily data comsum from ${from} to ${to}, here is the error:`); + warn(e); + break; + } } } From ec450cfa5fae0344be7f37bd4dc8a2cb8cfa9069 Mon Sep 17 00:00:00 2001 From: cddu33 Date: Sun, 5 Nov 2023 19:08:54 +0000 Subject: [PATCH 02/10] OK --- src/ha.ts | 12 ++++++++++-- src/index.ts | 10 +++++----- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/ha.ts b/src/ha.ts index 70c4abb..0b154cc 100644 --- a/src/ha.ts +++ b/src/ha.ts @@ -88,8 +88,16 @@ export class HomeAssistantClient { }); } - public async saveStatistics(prm: string, name: string, stats: { start: string; state: number; sum: number }[]) { - const statisticId = `${SOURCE}:${prm}`; + public async saveStatistics( + prm: string, + name: string, + prod: boolean, + stats: { start: string; state: number; sum: number }[], + ) { + let statisticId = `${SOURCE}:${prm}`; + if (prod) { + statisticId = `${SOURCE}:${prm}p`; + } await this.sendMessage({ type: 'recorder/import_statistics', metadata: { diff --git a/src/index.ts b/src/index.ts index a564c83..8f03796 100644 --- a/src/index.ts +++ b/src/index.ts @@ -28,7 +28,7 @@ async function main() { if (userConfig.consumption.action === 'reset') { await haClient.purge(userConfig.consumption.prm); - await haClient.purge(userConfig.production.prm); + await haClient.purge(userConfig.production.prm + 'p'); info('Statistics removed successfully!'); haClient.disconnect(); debug('HA Linky stopped'); @@ -38,10 +38,10 @@ async function main() { async function init() { info(`[${dayjs().format('DD/MM HH:mm')}] New PRM detected, importing as much historical data as possible`); const energyData = await consumptionClient.getEnergyData(null, false); - await haClient.saveStatistics(userConfig.consumption.prm, userConfig.consumption.name, energyData); + await haClient.saveStatistics(userConfig.consumption.prm, userConfig.consumption.name, false, energyData); if (userConfig.production.action === 'yes') { const energyData = await productionClient.getEnergyData(null, true); - await haClient.saveStatistics(userConfig.production.prm, userConfig.production.name, energyData); + await haClient.saveStatistics(userConfig.production.prm, userConfig.production.name, true, energyData); } } async function sync() { @@ -75,13 +75,13 @@ async function main() { const firstDay = dayjs(lastStatistic.start).add(1, 'day'); const energyData = await consumptionClient.getEnergyData(firstDay, false); incrementSums(energyData, lastStatistic.sum); - await haClient.saveStatistics(userConfig.consumption.prm, userConfig.consumption.name, energyData); + await haClient.saveStatistics(userConfig.consumption.prm, userConfig.consumption.name, false, energyData); } if (isSyncingNeeded1) { const firstDay = dayjs(lastStatistic1.start).add(1, 'day'); const energyData = await productionClient.getEnergyData(firstDay, true); incrementSums(energyData, lastStatistic1.sum); - await haClient.saveStatistics(userConfig.production.prm, userConfig.production.name, energyData); + await haClient.saveStatistics(userConfig.production.prm, userConfig.production.name, true, energyData); } } From bd7261cd252b86bec7805d85a7087edfb06178c1 Mon Sep 17 00:00:00 2001 From: cddu33 <59371705+cddu33@users.noreply.github.com> Date: Mon, 6 Nov 2023 11:30:08 +0100 Subject: [PATCH 03/10] modif refresh --- config.yaml | 2 +- src/index.ts | 2 +- src/linky.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/config.yaml b/config.yaml index dbee94c..da6c8ec 100644 --- a/config.yaml +++ b/config.yaml @@ -1,6 +1,6 @@ name: Linky description: Sync Energy dashboards with your Linky smart meter -version: 1.2.1 +version: 1.2.2 slug: linky init: false url: https://github.com/bokub/ha-linky diff --git a/src/index.ts b/src/index.ts index 8f03796..5af47f5 100644 --- a/src/index.ts +++ b/src/index.ts @@ -54,7 +54,7 @@ async function main() { } let lastStatistic1; if (userConfig.production.action === 'yes') { - lastStatistic1 = await haClient.findLastStatistic(userConfig.production.prm); + lastStatistic1 = await haClient.findLastStatistic(userConfig.production.prm+'p'); if (!lastStatistic1) { warn('Data synchronization failed, no previous statistic found in Home Assistant'); return; diff --git a/src/linky.ts b/src/linky.ts index ace9ba5..d292ee3 100644 --- a/src/linky.ts +++ b/src/linky.ts @@ -33,7 +33,7 @@ export class LinkyClient { from = firstDay.format('YYYY-MM-DD'); limitReached = true; } - + let to = dayjs().subtract(offset, 'days').format('YYYY-MM-DD'); if (prod) { From 9a5dd8887239fdd0280ef980cd6dff5ce140a2f9 Mon Sep 17 00:00:00 2001 From: cddu33 <59371705+cddu33@users.noreply.github.com> Date: Wed, 8 Nov 2023 13:12:50 +0100 Subject: [PATCH 04/10] Update README.md --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index cdb8649..b93a548 100644 --- a/README.md +++ b/README.md @@ -41,12 +41,14 @@ Pour utiliser cet add-on, il vous faut : Une fois l'add-on installé, rendez-vous dans l'onglet _Configuration_ et remplissez les champs vides : -- `consumption PRM` : Votre numéro de PRM (14 chiffres). +- `PRM` : Votre numéro de PRM (14 chiffres). - Si vous ne le connaissez pas, entrez votre token sur [la page exemples](https://conso.boris.sh/exemples) de Conso API et le PRM s'affichera dans le champ _PRM_ - Vous pouvez également le trouver sur votre compteur en appuyant sur la touche **+** jusqu’à lire la valeur du _numéro de PRM_. -- `consumption token` : Votre token **Conso API** +- `token` : Votre token **Conso API** - `consumption name` : Choisissez le nom qui sera affiché dans les tableaux de bord d'énergie. Vous pourrez le changer plus tard si vous le souhaitez. +- `production name` : Choisissez le nom qui sera affiché dans les tableaux de bord d'énergie partie production. Vous pourrez le changer plus tard si vous le souhaitez. - `consumption action` : Laissez la valeur par défaut: `sync` +- `sync production` : active la partie production de votre linky Appliquez les modifications et démarrez / redémarrez l'add-on si ce n'est pas déjà fait From ec0c54a6ce2c60c14d311607aa77c0c37a088e96 Mon Sep 17 00:00:00 2001 From: cddu33 Date: Sat, 11 Nov 2023 15:30:47 +0000 Subject: [PATCH 05/10] =?UTF-8?q?division=20PRM,=20reprise=20des=20libell?= =?UTF-8?q?=C3=A9s=20des=20variables?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 22 +++++---- config.yaml | 30 +++++++----- src/config.ts | 40 +++++++++------- src/ha.ts | 13 ++--- src/index.ts | 128 +++++++++++++++++++++++++++++++------------------- src/linky.ts | 2 +- 6 files changed, 137 insertions(+), 98 deletions(-) diff --git a/README.md b/README.md index b93a548..5f120b1 100644 --- a/README.md +++ b/README.md @@ -41,14 +41,20 @@ Pour utiliser cet add-on, il vous faut : Une fois l'add-on installé, rendez-vous dans l'onglet _Configuration_ et remplissez les champs vides : -- `PRM` : Votre numéro de PRM (14 chiffres). +- `Consumption Sync`: Acive la récupération de la consommation +- `Consumption PRM` : Votre numéro de PRM (14 chiffres) pour la consommation. - Si vous ne le connaissez pas, entrez votre token sur [la page exemples](https://conso.boris.sh/exemples) de Conso API et le PRM s'affichera dans le champ _PRM_ - Vous pouvez également le trouver sur votre compteur en appuyant sur la touche **+** jusqu’à lire la valeur du _numéro de PRM_. -- `token` : Votre token **Conso API** -- `consumption name` : Choisissez le nom qui sera affiché dans les tableaux de bord d'énergie. Vous pourrez le changer plus tard si vous le souhaitez. -- `production name` : Choisissez le nom qui sera affiché dans les tableaux de bord d'énergie partie production. Vous pourrez le changer plus tard si vous le souhaitez. -- `consumption action` : Laissez la valeur par défaut: `sync` -- `sync production` : active la partie production de votre linky +- `Consumption Token` : Votre token **Conso API** +- `Consumption Name` : Choisissez le nom qui sera affiché dans les tableaux de bord d'énergie. Vous pourrez le changer plus tard si vous le souhaitez. +- `Consumption action` : Laissez la valeur par défaut: `sync` +- `Production Sync`: Acive la récupération de la production +- `Production PRM` : Votre numéro de PRM (14 chiffres) pour la production. + - Si vous ne le connaissez pas, entrez votre token sur [la page exemples](https://conso.boris.sh/exemples) de Conso API et le PRM s'affichera dans le champ _PRM_ + - Vous pouvez également le trouver sur votre compteur en appuyant sur la touche **+** jusqu’à lire la valeur du _numéro de PRM_. +- `Production Token` : Votre token **Conso API** +- `Production Name` : Choisissez le nom qui sera affiché dans les tableaux de bord d'énergie. Vous pourrez le changer plus tard si vous le souhaitez. +- `Production action` : Laissez la valeur par défaut: `sync` Appliquez les modifications et démarrez / redémarrez l'add-on si ce n'est pas déjà fait @@ -84,8 +90,8 @@ Pour visualiser les données de **HA Linky** dans vos tableaux de bord d'énergi En cas de problème, il est toujours possible d'effacer toutes les données créées par **HA Linky** -Revenez sur l'onglet _Configuration_ de l'add-on et changez la valeur de `consumption action` à `reset`, puis appliquez les modifications et redémarrez l'add-on. +Revenez sur l'onglet _Configuration_ de l'add-on et changez la valeur de `Production/Consumption Action` à `reset`, puis appliquez les modifications et redémarrez l'add-on. Ouvrez ensuite l'onglet _Journal_ / _Log_ pour vérifier que la remise à zéro s'est bien déroulée. -Au prochain démarrage, si `consumption action` est repassé à `sync`, **HA Linky** réimportera à nouveau toutes vos données. Cette manipulation peut surcharger le serveur de **Conso API**, ne l'utilisez donc que si nécessaire pour ne pas risquer un ban ! +Au prochain démarrage, si `Production/Consumption Action` est repassé à `sync`, **HA Linky** réimportera à nouveau toutes vos données. Cette manipulation peut surcharger le serveur de **Conso API**, ne l'utilisez donc que si nécessaire pour ne pas risquer un ban ! diff --git a/config.yaml b/config.yaml index da6c8ec..69270bb 100644 --- a/config.yaml +++ b/config.yaml @@ -1,6 +1,6 @@ name: Linky description: Sync Energy dashboards with your Linky smart meter -version: 1.2.2 +version: 1.2.6 slug: linky init: false url: https://github.com/bokub/ha-linky @@ -13,17 +13,21 @@ arch: - i386 homeassistant_api: true options: - PRM: '' - token: '' - consumption name: 'Linky consumption' - action: sync - sync production: non - production name: 'Linky production' + Consumption Sync: true + Consumption PRM: '' + Consumption Token: '' + Consumption Action: sync + Production Sync: false + Production PRM: '' + Production Token: '' + Production Action: sync schema: - PRM: str? - token: str? - consumption name: str - action: list(sync|reset) - sync production: list(yes|non) - production name: str + Consumption Sync: bool? + Consumption PRM: str? + Consumption Token: str? + Consumption Action: list(sync|reset) + Production Sync: bool? + Production PRM: str? + Production Token: str? + Production Action: list(sync|reset) diff --git a/src/config.ts b/src/config.ts index 781e291..2f29090 100644 --- a/src/config.ts +++ b/src/config.ts @@ -2,47 +2,53 @@ import { readFileSync } from 'fs'; export type UserConfig = { consumption?: { + sync: boolean; prm: string; token: string; name: string; action: 'sync' | 'reset'; }; production?: { + sync: boolean; prm: string; token: string; name: string; - action: 'yes' | 'non'; + action: 'sync' | 'reset'; }; }; export function getUserConfig(): UserConfig { try { const parsed: { - PRM?: string; - token?: string; - 'consumption name'?: string; - action?: string; - 'production name'?: string; - 'sync production'?: string; + 'Consumption Sync'?: boolean; + 'Consumption PRM'?: string; + 'Consumption Token'?: string; + 'Consumption Action'?: string; + 'Production Sync'?: boolean; + 'Production PRM'?: string; + 'Production Token'?: string; + 'Production Action'?: string; } = JSON.parse(readFileSync('/data/options.json', 'utf8')); return { consumption: - parsed['PRM'] && parsed['token'] + parsed['Consumption PRM'] && parsed['Consumption Token'] ? { - prm: parsed['PRM'], - token: parsed['token'], - name: parsed['consumption name'] || 'Linky consumption', - action: parsed['action'] === 'reset' ? 'reset' : 'sync', + sync: parsed['Consumption Sync'], + prm: parsed['Consumption PRM'], + token: parsed['Consumption Token'], + name: parsed['Consumption Name'] || 'Linky consumption', + action: parsed['consumption_action'] === 'reset' ? 'reset' : 'sync', } : undefined, production: - parsed['PRM'] && parsed['token'] + parsed['Production PRM'] && parsed['Production Token'] ? { - prm: parsed['PRM'], - token: parsed['token'], - name: parsed['production name'] || 'Linky consumption', - action: parsed['sync production'] === 'yes' ? 'yes' : 'non', + sync: parsed['Production Sync'], + prm: parsed['Production PRM'], + token: parsed['Production Token'], + name: parsed['Production Name'] || 'Linky consumption', + action: parsed['Production Action'] === 'reset' ? 'reset' : 'sync', } : undefined, }; diff --git a/src/ha.ts b/src/ha.ts index 0b154cc..6df10a2 100644 --- a/src/ha.ts +++ b/src/ha.ts @@ -88,16 +88,9 @@ export class HomeAssistantClient { }); } - public async saveStatistics( - prm: string, - name: string, - prod: boolean, - stats: { start: string; state: number; sum: number }[], - ) { - let statisticId = `${SOURCE}:${prm}`; - if (prod) { - statisticId = `${SOURCE}:${prm}p`; - } + public async saveStatistics(prm: string, name: string, stats: { start: string; state: number; sum: number }[]) { + const statisticId = `${SOURCE}:${prm}`; + await this.sendMessage({ type: 'recorder/import_statistics', metadata: { diff --git a/src/index.ts b/src/index.ts index 5af47f5..a8b66a4 100644 --- a/src/index.ts +++ b/src/index.ts @@ -10,26 +10,39 @@ async function main() { const userConfig = getUserConfig(); - if (!userConfig.consumption) { - warn('Add-on is not configured properly'); + if (!userConfig.consumption && userConfig.consumption.sync) { + warn('Add-on consumption is not configured properly'); debug('HA Linky stopped'); return; } + if (!userConfig.production && userConfig.production.sync) { + warn('Add-on production is not configured properly'); + debug('HA Linky stopped'); + return; + } + let consumptionClient; + let productionClient; - info('PRM ' + userConfig.consumption.prm + ' found in configuration'); - const consumptionClient = new LinkyClient(userConfig.consumption.token, userConfig.consumption.prm); - let productionClient = null; - if (userConfig.production.action === 'yes') { + if (userConfig.consumption.sync) { + info('consumption PRM ' + userConfig.consumption.prm + ' found in configuration'); + consumptionClient = new LinkyClient(userConfig.consumption.token, userConfig.consumption.prm); + } + if (userConfig.production.sync) { + info('production PRM ' + userConfig.production.prm + ' found in configuration'); productionClient = new LinkyClient(userConfig.production.token, userConfig.production.prm); } - const haClient = new HomeAssistantClient(); await haClient.connect(); if (userConfig.consumption.action === 'reset') { await haClient.purge(userConfig.consumption.prm); + info('Statistics removed successfully for consumption!'); + } + if (userConfig.production.action === 'reset') { await haClient.purge(userConfig.production.prm + 'p'); - info('Statistics removed successfully!'); + info('Statistics removed successfully for production!'); + } + if (userConfig.production.action === 'reset' || userConfig.consumption.action === 'reset') { haClient.disconnect(); debug('HA Linky stopped'); return; @@ -37,56 +50,71 @@ async function main() { async function init() { info(`[${dayjs().format('DD/MM HH:mm')}] New PRM detected, importing as much historical data as possible`); - const energyData = await consumptionClient.getEnergyData(null, false); - await haClient.saveStatistics(userConfig.consumption.prm, userConfig.consumption.name, false, energyData); - if (userConfig.production.action === 'yes') { + if (userConfig.consumption.sync) { + const energyData = await consumptionClient.getEnergyData(null, false); + await haClient.saveStatistics(userConfig.consumption.prm, userConfig.consumption.name, energyData); + } + if (userConfig.production.sync) { const energyData = await productionClient.getEnergyData(null, true); - await haClient.saveStatistics(userConfig.production.prm, userConfig.production.name, true, energyData); + await haClient.saveStatistics(userConfig.production.prm + 'p', userConfig.production.name, energyData); } } async function sync() { - info(`[${dayjs().format('DD/MM HH:mm')}] Data synchronization started`); - - const lastStatistic = await haClient.findLastStatistic(userConfig.consumption.prm); - if (!lastStatistic) { - warn('Data synchronization failed, no previous statistic found in Home Assistant'); - return; + let lastStatisticC = null; + if (userConfig.consumption.sync) { + info(`[${dayjs().format('DD/MM HH:mm')}] Data synchronization started consumption`); + lastStatisticC = await haClient.findLastStatistic(userConfig.consumption.prm); + if (!lastStatisticC) { + warn('Data synchronization failed, no previous statistic found in Home Assistant for consumption'); + return; + } } - let lastStatistic1; - if (userConfig.production.action === 'yes') { - lastStatistic1 = await haClient.findLastStatistic(userConfig.production.prm+'p'); - if (!lastStatistic1) { - warn('Data synchronization failed, no previous statistic found in Home Assistant'); + let lastStatisticP = null; + if (userConfig.production.sync) { + info(`[${dayjs().format('DD/MM HH:mm')}] Data synchronization started production`); + lastStatisticP = await haClient.findLastStatistic(userConfig.production.prm + 'p'); + if (!lastStatisticP) { + warn('Data synchronization failed, no previous statistic found in Home Assistant for production'); return; } } - const isSyncingNeeded = dayjs(lastStatistic.start).isBefore(dayjs().subtract(2, 'days')) && dayjs().hour() >= 6; - let isSyncingNeeded1 = false; - if (userConfig.production.action === 'yes') { - isSyncingNeeded1 = dayjs(lastStatistic1.start).isBefore(dayjs().subtract(2, 'days')) && dayjs().hour() >= 6; + let isSyncingNeededC = false; + if (userConfig.consumption.sync) { + isSyncingNeededC = dayjs(lastStatisticC.start).isBefore(dayjs().subtract(2, 'days')) && dayjs().hour() >= 6; + } + let isSyncingNeededP = false; + if (userConfig.production.sync) { + isSyncingNeededP = dayjs(lastStatisticP.start).isBefore(dayjs().subtract(2, 'days')) && dayjs().hour() >= 6; } - if (!isSyncingNeeded && !isSyncingNeeded1) { + if (!isSyncingNeededC && !isSyncingNeededP && (userConfig.consumption.sync || userConfig.production.sync)) { debug('Everything is up to date, nothing to synchronize'); return; } - if (isSyncingNeeded) { - const firstDay = dayjs(lastStatistic.start).add(1, 'day'); + if (isSyncingNeededC) { + const firstDay = dayjs(lastStatisticC.start).add(1, 'day'); const energyData = await consumptionClient.getEnergyData(firstDay, false); - incrementSums(energyData, lastStatistic.sum); - await haClient.saveStatistics(userConfig.consumption.prm, userConfig.consumption.name, false, energyData); + incrementSums(energyData, lastStatisticC.sum); + await haClient.saveStatistics(userConfig.consumption.prm, userConfig.consumption.name, energyData); } - if (isSyncingNeeded1) { - const firstDay = dayjs(lastStatistic1.start).add(1, 'day'); + if (isSyncingNeededP) { + const firstDay = dayjs(lastStatisticP.start).add(1, 'day'); const energyData = await productionClient.getEnergyData(firstDay, true); - incrementSums(energyData, lastStatistic1.sum); - await haClient.saveStatistics(userConfig.production.prm, userConfig.production.name, true, energyData); + incrementSums(energyData, lastStatisticP.sum); + await haClient.saveStatistics(userConfig.production.prm + 'p', userConfig.production.name, energyData); } } - const isNew = await haClient.isNewPRM(userConfig.consumption.prm); - if (isNew) { + let isNewC = false; + let isNewP = false; + if (userConfig.consumption.sync) { + isNewC = await haClient.isNewPRM(userConfig.consumption.prm); + } + if (userConfig.production.sync) { + isNewP = await haClient.isNewPRM(userConfig.production.prm + 'p'); + } + if (isNewP || isNewC) { await init(); } else { await sync(); @@ -96,17 +124,19 @@ async function main() { const randomMinute = Math.floor(Math.random() * 59); const randomSecond = Math.floor(Math.random() * 59); - info( - `Data synchronization planned every day at ` + - `06:${randomMinute.toString().padStart(2, '0')}:${randomSecond.toString().padStart(2, '0')} and ` + - `09:${randomMinute.toString().padStart(2, '0')}:${randomSecond.toString().padStart(2, '0')}`, - ); - - cron.schedule(`${randomSecond} ${randomMinute} 6,9 * * *`, async () => { - await haClient.connect(); - await sync(); - haClient.disconnect(); - }); + if (userConfig.consumption.sync || userConfig.production.sync) { + info( + `Data synchronization planned every day at ` + + `06:${randomMinute.toString().padStart(2, '0')}:${randomSecond.toString().padStart(2, '0')} and ` + + `09:${randomMinute.toString().padStart(2, '0')}:${randomSecond.toString().padStart(2, '0')}`, + ); + + cron.schedule(`${randomSecond} ${randomMinute} 6,9 * * *`, async () => { + await haClient.connect(); + await sync(); + haClient.disconnect(); + }); + } } function incrementSums(data: { sum: number }[], value: number) { diff --git a/src/linky.ts b/src/linky.ts index d292ee3..ace9ba5 100644 --- a/src/linky.ts +++ b/src/linky.ts @@ -33,7 +33,7 @@ export class LinkyClient { from = firstDay.format('YYYY-MM-DD'); limitReached = true; } - + let to = dayjs().subtract(offset, 'days').format('YYYY-MM-DD'); if (prod) { From 46e7eacecba12ad3da8b8d81b7cb57060b8b6a3b Mon Sep 17 00:00:00 2001 From: cddu33 <59371705+cddu33@users.noreply.github.com> Date: Mon, 13 Nov 2023 19:53:52 +0100 Subject: [PATCH 06/10] Update src/linky.ts Co-authored-by: Boris K --- src/linky.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/linky.ts b/src/linky.ts index ace9ba5..58db4c1 100644 --- a/src/linky.ts +++ b/src/linky.ts @@ -96,7 +96,7 @@ export class LinkyClient { debug(`Successfully retrieved daily consum data from ${from} to ${to}`); offset += interval; } catch (e) { - debug(`Cannot fetch daily data comsum from ${from} to ${to}, here is the error:`); + debug(`Cannot fetch daily consumption data from ${from} to ${to}, here is the error:`); warn(e); break; } From c938fd44bcf56582f161a05b79e044abb011c790 Mon Sep 17 00:00:00 2001 From: cddu33 <59371705+cddu33@users.noreply.github.com> Date: Mon, 13 Nov 2023 19:54:01 +0100 Subject: [PATCH 07/10] Update src/linky.ts Co-authored-by: Boris K --- src/linky.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/linky.ts b/src/linky.ts index 58db4c1..2a827af 100644 --- a/src/linky.ts +++ b/src/linky.ts @@ -85,7 +85,7 @@ export class LinkyClient { debug(`Successfully retrieved daily prod data from ${from} to ${to}`); offset += interval; } catch (e) { - debug(`Cannot fetch daily prod data from ${from} to ${to}, here is the error:`); + debug(`Cannot fetch daily production data from ${from} to ${to}, here is the error:`); warn(e); break; } From 9627d00cb24f375f2229793a4e533083c72d1016 Mon Sep 17 00:00:00 2001 From: cddu33 Date: Mon, 13 Nov 2023 19:51:10 +0000 Subject: [PATCH 08/10] modification nom config && suppression des sync boolean --- README.md | 24 +++++++++---------- config.yaml | 34 +++++++++++++-------------- src/config.ts | 40 ++++++++++++++----------------- src/index.ts | 65 +++++++++++++++++++++++++-------------------------- 4 files changed, 78 insertions(+), 85 deletions(-) diff --git a/README.md b/README.md index 5f120b1..bc0178d 100644 --- a/README.md +++ b/README.md @@ -41,20 +41,18 @@ Pour utiliser cet add-on, il vous faut : Une fois l'add-on installé, rendez-vous dans l'onglet _Configuration_ et remplissez les champs vides : -- `Consumption Sync`: Acive la récupération de la consommation -- `Consumption PRM` : Votre numéro de PRM (14 chiffres) pour la consommation. +- `consumption PRM` : Votre numéro de PRM (14 chiffres) pour la consommation. - Si vous ne le connaissez pas, entrez votre token sur [la page exemples](https://conso.boris.sh/exemples) de Conso API et le PRM s'affichera dans le champ _PRM_ - Vous pouvez également le trouver sur votre compteur en appuyant sur la touche **+** jusqu’à lire la valeur du _numéro de PRM_. -- `Consumption Token` : Votre token **Conso API** -- `Consumption Name` : Choisissez le nom qui sera affiché dans les tableaux de bord d'énergie. Vous pourrez le changer plus tard si vous le souhaitez. -- `Consumption action` : Laissez la valeur par défaut: `sync` -- `Production Sync`: Acive la récupération de la production -- `Production PRM` : Votre numéro de PRM (14 chiffres) pour la production. +- `consumption token` : Votre token **Conso API** +- `consumption name` : Choisissez le nom qui sera affiché dans les tableaux de bord d'énergie. Vous pourrez le changer plus tard si vous le souhaitez. +- `consumption action` : Laissez la valeur par défaut: `sync` +- `production PRM` : Votre numéro de PRM (14 chiffres) pour la production. - Si vous ne le connaissez pas, entrez votre token sur [la page exemples](https://conso.boris.sh/exemples) de Conso API et le PRM s'affichera dans le champ _PRM_ - Vous pouvez également le trouver sur votre compteur en appuyant sur la touche **+** jusqu’à lire la valeur du _numéro de PRM_. -- `Production Token` : Votre token **Conso API** -- `Production Name` : Choisissez le nom qui sera affiché dans les tableaux de bord d'énergie. Vous pourrez le changer plus tard si vous le souhaitez. -- `Production action` : Laissez la valeur par défaut: `sync` +- `production token` : Votre token **Conso API** +- `production name` : Choisissez le nom qui sera affiché dans les tableaux de bord d'énergie. Vous pourrez le changer plus tard si vous le souhaitez. +- `production action` : Laissez la valeur par défaut: `sync` Appliquez les modifications et démarrez / redémarrez l'add-on si ce n'est pas déjà fait @@ -77,7 +75,7 @@ Pour visualiser les données de **HA Linky** dans vos tableaux de bord d'énergi - Cliquez [ici](https://my.home-assistant.io/redirect/config_energy/), ou ouvrez le menu _Paramètres_ / _Settings_, puis _Tableaux de bord_ / _Dashboards_, puis _Énergie_ / _Energy_ - Dans la section _Réseau électrique_ / _Electricity grid_, cliquez sur _Ajouter une consommation_ / _Add consumption_ -- Choisissez la statistique correspondant au `consumption name` que vous avez choisi à l'étape de configuration +- Choisissez la statistique correspondant au `consumption name` et/ou `production name` que vous avez choisi à l'étape de configuration - Cliquez sur _Enregistrer_ / _Save_ ### Bon à savoir @@ -90,8 +88,8 @@ Pour visualiser les données de **HA Linky** dans vos tableaux de bord d'énergi En cas de problème, il est toujours possible d'effacer toutes les données créées par **HA Linky** -Revenez sur l'onglet _Configuration_ de l'add-on et changez la valeur de `Production/Consumption Action` à `reset`, puis appliquez les modifications et redémarrez l'add-on. +Revenez sur l'onglet _Configuration_ de l'add-on et changez la valeur de `production/consumption action` à `reset`, puis appliquez les modifications et redémarrez l'add-on. Ouvrez ensuite l'onglet _Journal_ / _Log_ pour vérifier que la remise à zéro s'est bien déroulée. -Au prochain démarrage, si `Production/Consumption Action` est repassé à `sync`, **HA Linky** réimportera à nouveau toutes vos données. Cette manipulation peut surcharger le serveur de **Conso API**, ne l'utilisez donc que si nécessaire pour ne pas risquer un ban ! +Au prochain démarrage, si `production/consumption action` est repassé à `sync`, **HA Linky** réimportera à nouveau toutes vos données. Cette manipulation peut surcharger le serveur de **Conso API**, ne l'utilisez donc que si nécessaire pour ne pas risquer un ban ! diff --git a/config.yaml b/config.yaml index 69270bb..8871b5c 100644 --- a/config.yaml +++ b/config.yaml @@ -1,6 +1,6 @@ name: Linky description: Sync Energy dashboards with your Linky smart meter -version: 1.2.6 +version: 1.2.8 slug: linky init: false url: https://github.com/bokub/ha-linky @@ -13,21 +13,21 @@ arch: - i386 homeassistant_api: true options: - Consumption Sync: true - Consumption PRM: '' - Consumption Token: '' - Consumption Action: sync - Production Sync: false - Production PRM: '' - Production Token: '' - Production Action: sync + consumption name: 'Linky consumption' + consumption PRM: '' + consumption token: '' + consumption action: sync + production name: 'Linky production' + production PRM: '' + production token: '' + production action: sync schema: - Consumption Sync: bool? - Consumption PRM: str? - Consumption Token: str? - Consumption Action: list(sync|reset) - Production Sync: bool? - Production PRM: str? - Production Token: str? - Production Action: list(sync|reset) + consumption name: str? + consumption PRM: str? + consumption token: str? + consumption action: list(sync|reset) + production name: str? + production PRM: str? + production token: str? + production action: list(sync|reset) diff --git a/src/config.ts b/src/config.ts index 2f29090..732d57a 100644 --- a/src/config.ts +++ b/src/config.ts @@ -2,14 +2,12 @@ import { readFileSync } from 'fs'; export type UserConfig = { consumption?: { - sync: boolean; prm: string; token: string; name: string; action: 'sync' | 'reset'; }; production?: { - sync: boolean; prm: string; token: string; name: string; @@ -20,35 +18,33 @@ export type UserConfig = { export function getUserConfig(): UserConfig { try { const parsed: { - 'Consumption Sync'?: boolean; - 'Consumption PRM'?: string; - 'Consumption Token'?: string; - 'Consumption Action'?: string; - 'Production Sync'?: boolean; - 'Production PRM'?: string; - 'Production Token'?: string; - 'Production Action'?: string; + 'consumption name'?: string; + 'consumption PRM'?: string; + 'consumption token'?: string; + 'consumption action'?: string; + 'production name'?: string; + 'production PRM'?: string; + 'production token'?: string; + 'production action'?: string; } = JSON.parse(readFileSync('/data/options.json', 'utf8')); return { consumption: - parsed['Consumption PRM'] && parsed['Consumption Token'] + parsed['consumption PRM'] && parsed['consumption token'] ? { - sync: parsed['Consumption Sync'], - prm: parsed['Consumption PRM'], - token: parsed['Consumption Token'], - name: parsed['Consumption Name'] || 'Linky consumption', - action: parsed['consumption_action'] === 'reset' ? 'reset' : 'sync', + prm: parsed['consumption PRM'], + token: parsed['consumption token'], + name: parsed['consumption name'] || 'Linky consumption', + action: parsed['consumption action'] === 'reset' ? 'reset' : 'sync', } : undefined, production: - parsed['Production PRM'] && parsed['Production Token'] + parsed['production PRM'] && parsed['production token'] ? { - sync: parsed['Production Sync'], - prm: parsed['Production PRM'], - token: parsed['Production Token'], - name: parsed['Production Name'] || 'Linky consumption', - action: parsed['Production Action'] === 'reset' ? 'reset' : 'sync', + prm: parsed['production PRM'], + token: parsed['production token'], + name: parsed['production name'] || 'Linky consumption', + action: parsed['production action'] === 'reset' ? 'reset' : 'sync', } : undefined, }; diff --git a/src/index.ts b/src/index.ts index a8b66a4..4c4c30d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -10,58 +10,57 @@ async function main() { const userConfig = getUserConfig(); - if (!userConfig.consumption && userConfig.consumption.sync) { + if (!userConfig.consumption) { warn('Add-on consumption is not configured properly'); - debug('HA Linky stopped'); - return; } - if (!userConfig.production && userConfig.production.sync) { + if (!userConfig.production) { warn('Add-on production is not configured properly'); - debug('HA Linky stopped'); - return; } let consumptionClient; let productionClient; - if (userConfig.consumption.sync) { + const haClient = new HomeAssistantClient(); + await haClient.connect(); + + if (userConfig.consumption) { info('consumption PRM ' + userConfig.consumption.prm + ' found in configuration'); consumptionClient = new LinkyClient(userConfig.consumption.token, userConfig.consumption.prm); + + if (userConfig.consumption.action === 'reset') { + await haClient.purge(userConfig.consumption.prm); + info('Statistics removed successfully for consumption!'); + haClient.disconnect(); + debug('HA Linky stopped'); + return; + } } - if (userConfig.production.sync) { + if (userConfig.production) { info('production PRM ' + userConfig.production.prm + ' found in configuration'); productionClient = new LinkyClient(userConfig.production.token, userConfig.production.prm); - } - const haClient = new HomeAssistantClient(); - await haClient.connect(); - if (userConfig.consumption.action === 'reset') { - await haClient.purge(userConfig.consumption.prm); - info('Statistics removed successfully for consumption!'); - } - if (userConfig.production.action === 'reset') { - await haClient.purge(userConfig.production.prm + 'p'); - info('Statistics removed successfully for production!'); - } - if (userConfig.production.action === 'reset' || userConfig.consumption.action === 'reset') { - haClient.disconnect(); - debug('HA Linky stopped'); - return; + if (userConfig.production && userConfig.production.action === 'reset') { + await haClient.purge(userConfig.production.prm + 'p'); + info('Statistics removed successfully for production!'); + haClient.disconnect(); + debug('HA Linky stopped'); + return; + } } async function init() { info(`[${dayjs().format('DD/MM HH:mm')}] New PRM detected, importing as much historical data as possible`); - if (userConfig.consumption.sync) { + if (userConfig.consumption) { const energyData = await consumptionClient.getEnergyData(null, false); await haClient.saveStatistics(userConfig.consumption.prm, userConfig.consumption.name, energyData); } - if (userConfig.production.sync) { + if (userConfig.production) { const energyData = await productionClient.getEnergyData(null, true); await haClient.saveStatistics(userConfig.production.prm + 'p', userConfig.production.name, energyData); } } async function sync() { let lastStatisticC = null; - if (userConfig.consumption.sync) { + if (userConfig.consumption) { info(`[${dayjs().format('DD/MM HH:mm')}] Data synchronization started consumption`); lastStatisticC = await haClient.findLastStatistic(userConfig.consumption.prm); if (!lastStatisticC) { @@ -70,7 +69,7 @@ async function main() { } } let lastStatisticP = null; - if (userConfig.production.sync) { + if (userConfig.production) { info(`[${dayjs().format('DD/MM HH:mm')}] Data synchronization started production`); lastStatisticP = await haClient.findLastStatistic(userConfig.production.prm + 'p'); if (!lastStatisticP) { @@ -80,15 +79,15 @@ async function main() { } let isSyncingNeededC = false; - if (userConfig.consumption.sync) { + if (userConfig.consumption) { isSyncingNeededC = dayjs(lastStatisticC.start).isBefore(dayjs().subtract(2, 'days')) && dayjs().hour() >= 6; } let isSyncingNeededP = false; - if (userConfig.production.sync) { + if (userConfig.production) { isSyncingNeededP = dayjs(lastStatisticP.start).isBefore(dayjs().subtract(2, 'days')) && dayjs().hour() >= 6; } - if (!isSyncingNeededC && !isSyncingNeededP && (userConfig.consumption.sync || userConfig.production.sync)) { + if (!isSyncingNeededC && !isSyncingNeededP && (userConfig.consumption || userConfig.production)) { debug('Everything is up to date, nothing to synchronize'); return; } @@ -108,10 +107,10 @@ async function main() { let isNewC = false; let isNewP = false; - if (userConfig.consumption.sync) { + if (userConfig.consumption) { isNewC = await haClient.isNewPRM(userConfig.consumption.prm); } - if (userConfig.production.sync) { + if (userConfig.production) { isNewP = await haClient.isNewPRM(userConfig.production.prm + 'p'); } if (isNewP || isNewC) { @@ -124,7 +123,7 @@ async function main() { const randomMinute = Math.floor(Math.random() * 59); const randomSecond = Math.floor(Math.random() * 59); - if (userConfig.consumption.sync || userConfig.production.sync) { + if (userConfig.consumption || userConfig.production) { info( `Data synchronization planned every day at ` + `06:${randomMinute.toString().padStart(2, '0')}:${randomSecond.toString().padStart(2, '0')} and ` + From 967a24cbe619bc24fad89d23bbda2305158723ad Mon Sep 17 00:00:00 2001 From: Boris K Date: Tue, 14 Nov 2023 14:52:58 +0100 Subject: [PATCH 09/10] Apply suggestions from code review --- config.yaml | 12 ++++++------ src/config.ts | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/config.yaml b/config.yaml index 8871b5c..262e973 100644 --- a/config.yaml +++ b/config.yaml @@ -1,10 +1,10 @@ name: Linky description: Sync Energy dashboards with your Linky smart meter -version: 1.2.8 +version: 1.2.0 slug: linky init: false url: https://github.com/bokub/ha-linky -#image: ghcr.io/bokub/ha-linky-{arch} +image: ghcr.io/bokub/ha-linky-{arch} arch: - aarch64 - amd64 @@ -13,21 +13,21 @@ arch: - i386 homeassistant_api: true options: - consumption name: 'Linky consumption' consumption PRM: '' consumption token: '' + consumption name: 'Linky consumption' consumption action: sync - production name: 'Linky production' production PRM: '' production token: '' + production name: 'Linky production' production action: sync schema: - consumption name: str? consumption PRM: str? consumption token: str? + consumption name: str? consumption action: list(sync|reset) - production name: str? production PRM: str? production token: str? + production name: str? production action: list(sync|reset) diff --git a/src/config.ts b/src/config.ts index 732d57a..6177426 100644 --- a/src/config.ts +++ b/src/config.ts @@ -18,13 +18,13 @@ export type UserConfig = { export function getUserConfig(): UserConfig { try { const parsed: { - 'consumption name'?: string; 'consumption PRM'?: string; 'consumption token'?: string; + 'consumption name'?: string; 'consumption action'?: string; - 'production name'?: string; 'production PRM'?: string; 'production token'?: string; + 'production name'?: string; 'production action'?: string; } = JSON.parse(readFileSync('/data/options.json', 'utf8')); From 861d3025e0e54816a6754ff7dee1467af22b5d09 Mon Sep 17 00:00:00 2001 From: Boris Kubiak Date: Wed, 15 Nov 2023 07:29:46 +0100 Subject: [PATCH 10/10] Small fixes --- config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config.yaml b/config.yaml index 262e973..3eaf24e 100644 --- a/config.yaml +++ b/config.yaml @@ -25,9 +25,9 @@ options: schema: consumption PRM: str? consumption token: str? - consumption name: str? + consumption name: str consumption action: list(sync|reset) production PRM: str? production token: str? - production name: str? + production name: str production action: list(sync|reset)