From bc9f6fbbc67c2bdf86274eeade863d12b157f197 Mon Sep 17 00:00:00 2001 From: KipK Date: Sun, 5 Feb 2023 21:12:07 +0100 Subject: [PATCH] edited models --- models/Config.yaml | 11 +++++++++++ models/Status.yaml | 6 ++++++ platformio.ini | 2 +- src/app_config.cpp | 8 ++++++-- 4 files changed, 24 insertions(+), 3 deletions(-) diff --git a/models/Config.yaml b/models/Config.yaml index 546ff4fb..cf0b6b1a 100644 --- a/models/Config.yaml +++ b/models/Config.yaml @@ -34,6 +34,8 @@ x-examples: hostname: openevse-a7d4 sntp_hostname: pool.ntp.org time_zone: 'Europe/London|GMT0BST,M3.5.0/1,M10.5.0' + limit_default_type: none + limit_default_value": 0 emoncms_server: 'https://emoncms.org' emoncms_node: openevse-a7d4 emoncms_apikey: _DUMMY_PASSWORD @@ -86,6 +88,7 @@ x-examples: ocpp_auth_offline: true mqtt_protocol: mqtt charge_mode: fast + is_threephase: false x-tags: - Config properties: @@ -177,6 +180,12 @@ properties: time_zone: type: string minLength: 1 + limit_default_type: + type: string + minLength: 1 + limit_default_value: + type: integer + minLength: 1 emoncms_server: type: string minLength: 1 @@ -295,3 +304,5 @@ properties: default: 600 description: | The maximum number of seconds to randomly add/subtract from the a scheduled charge start time, eg a value of 600 will adjust the start time my +/- 10 minutes. This is to help prevent large syncrinised loads when multiple verchiles start charging at the same time. + is_threephase: + type: boolean diff --git a/models/Status.yaml b/models/Status.yaml index 9269e8d1..a723121b 100644 --- a/models/Status.yaml +++ b/models/Status.yaml @@ -154,3 +154,9 @@ properties: offset: type: string description: The current timezone + has_limit: + type: boolean + description: A limit has been set + limit_version: + type: integer + description: /limit endpoint current version diff --git a/platformio.ini b/platformio.ini index e320385d..f9d12310 100644 --- a/platformio.ini +++ b/platformio.ini @@ -60,7 +60,7 @@ debug_flags = #-D ENABLE_DEBUG_MQTT #-D ENABLE_DEBUG_EMONCMS #-D ENABLE_DEBUG_TESLA_CLIENT - # -D ENABLE_DEBUG_LIMIT + #-D ENABLE_DEBUG_LIMIT #-D ENABLE_PROFILE src_build_flags = # -D ARDUINOJSON_USE_LONG_LONG diff --git a/src/app_config.cpp b/src/app_config.cpp index ac6e2d83..1dcca688 100644 --- a/src/app_config.cpp +++ b/src/app_config.cpp @@ -303,10 +303,14 @@ void config_changed(String name) limitprops.setType(limitType); limitprops.setValue(limit_default_value); limitprops.setAutoRelease(false); - if (limit.hasLimit()) { + if (limitType == LimitType::None) { + uint32_t val = 0; + config_set("limit_default_value", val); + config_commit(); limit.clear(); } - limit.set(limitprops); + else + limit.set(limitprops); } }