From 0e23acc651e9f5c5f222d0cee3c3fbcd512f754a Mon Sep 17 00:00:00 2001 From: pokornyIt <8665714+pokornyit@users.noreply.github.com> Date: Sun, 24 Mar 2024 23:43:28 +0100 Subject: [PATCH 1/4] Fix time set for EVV1 and other Task: #32 --- .../cezdistribuce/continuous_measurement.py | 66 +++++++++---------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/custom_components/cezdistribuce/continuous_measurement.py b/custom_components/cezdistribuce/continuous_measurement.py index ece277a..4b59259 100644 --- a/custom_components/cezdistribuce/continuous_measurement.py +++ b/custom_components/cezdistribuce/continuous_measurement.py @@ -116,31 +116,29 @@ def getCode(code: str) -> dict: "CAS_ZAP_10": None, "CAS_VYP_10": None, } - AKU8V5: dict = ( - { - "PLATNOST": "Po - Ne", - "CAS_ZAP_1": "1:00", - "CAS_VYP_1": "6:00", - "CAS_ZAP_2": "18:00", - "CAS_VYP_2": "21:00", - "CAS_ZAP_3": None, - "CAS_VYP_3": None, - "CAS_ZAP_4": None, - "CAS_VYP_4": None, - "CAS_ZAP_5": None, - "CAS_VYP_5": None, - "CAS_ZAP_6": None, - "CAS_VYP_6": None, - "CAS_ZAP_7": None, - "CAS_VYP_7": None, - "CAS_ZAP_8": None, - "CAS_VYP_8": None, - "CAS_ZAP_9": None, - "CAS_VYP_9": None, - "CAS_ZAP_10": None, - "CAS_VYP_10": None, - }, - ) + AKU8V5: dict = { + "PLATNOST": "Po - Ne", + "CAS_ZAP_1": "1:00", + "CAS_VYP_1": "6:00", + "CAS_ZAP_2": "18:00", + "CAS_VYP_2": "21:00", + "CAS_ZAP_3": None, + "CAS_VYP_3": None, + "CAS_ZAP_4": None, + "CAS_VYP_4": None, + "CAS_ZAP_5": None, + "CAS_VYP_5": None, + "CAS_ZAP_6": None, + "CAS_VYP_6": None, + "CAS_ZAP_7": None, + "CAS_VYP_7": None, + "CAS_ZAP_8": None, + "CAS_VYP_8": None, + "CAS_ZAP_9": None, + "CAS_VYP_9": None, + "CAS_ZAP_10": None, + "CAS_VYP_10": None, + } AKU8V6: dict = { "PLATNOST": "Po - Ne", "CAS_ZAP_1": "3:00", @@ -305,15 +303,15 @@ def getCode(code: str) -> dict: EVV1: dict = { "PLATNOST": "Po - Ne", "CAS_ZAP_1": "0:00", - "CAS_VYP_1": "9:00", - "CAS_ZAP_2": "10:00", - "CAS_VYP_2": "11:00", - "CAS_ZAP_3": "12:00", + "CAS_VYP_1": "6:00", + "CAS_ZAP_2": "7:00", + "CAS_VYP_2": "9:00", + "CAS_ZAP_3": "10:00", "CAS_VYP_3": "13:00", "CAS_ZAP_4": "14:00", "CAS_VYP_4": "16:00", "CAS_ZAP_5": "17:00", - "CAS_VYP_5": "0:00", + "CAS_VYP_5": "23:59", "CAS_ZAP_6": None, "CAS_VYP_6": None, "CAS_ZAP_7": None, @@ -510,7 +508,7 @@ def getCode(code: str) -> dict: "CAS_VYP_10": None, } ZAV1_WEEK: dict = { - "PLATNOST": "Po - Pa", + "PLATNOST": "So - Ne", "CAS_ZAP_1": "0:00", "CAS_VYP_1": "23:59", "CAS_ZAP_2": None, @@ -556,7 +554,7 @@ def getCode(code: str) -> dict: "CAS_VYP_10": None, } ZAV2_WEEK: dict = { - "PLATNOST": "Po - Pa", + "PLATNOST": "So - Ne", "CAS_ZAP_1": "0:00", "CAS_VYP_1": "23:59", "CAS_ZAP_2": None, @@ -742,5 +740,7 @@ def getCode(code: str) -> dict: "ZAV1": [ZAV1_WORK, ZAV1_WEEK], "ZAV2": [ZAV2_WORK, ZAV2_WEEK], "VIKV1": [VIKV1_1, VIKV1_2, VIKV1_3], - "VYRV": [VYRV1, VYRV2, VYRV3], + "VYRV1": [VYRV1], + "VYRV2": [VYRV2], + "VYRV3": [VYRV3], } From 90bb8b3a7e41e2f4463ee44e2dc870b504009ef5 Mon Sep 17 00:00:00 2001 From: pokornyIt <8665714+pokornyit@users.noreply.github.com> Date: Mon, 25 Mar 2024 11:30:07 +0100 Subject: [PATCH 2/4] Update time in TCV1 #32 --- .../cezdistribuce/continuous_measurement.py | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/custom_components/cezdistribuce/continuous_measurement.py b/custom_components/cezdistribuce/continuous_measurement.py index 4b59259..ff41cac 100644 --- a/custom_components/cezdistribuce/continuous_measurement.py +++ b/custom_components/cezdistribuce/continuous_measurement.py @@ -54,7 +54,7 @@ def getCode(code: str) -> dict: "CAS_ZAP_2": "18:00", "CAS_VYP_2": "20:00", "CAS_ZAP_3": "23:00", - "CAS_VYP_3": "00:00", + "CAS_VYP_3": "23:59", "CAS_ZAP_4": None, "CAS_VYP_4": None, "CAS_ZAP_5": None, @@ -77,7 +77,7 @@ def getCode(code: str) -> dict: "CAS_ZAP_2": "17:00", "CAS_VYP_2": "19:00", "CAS_ZAP_3": "22:00", - "CAS_VYP_3": "00:00", + "CAS_VYP_3": "23:59", "CAS_ZAP_4": None, "CAS_VYP_4": None, "CAS_ZAP_5": None, @@ -98,7 +98,7 @@ def getCode(code: str) -> dict: "CAS_ZAP_1": "0:00", "CAS_VYP_1": "6:00", "CAS_ZAP_2": "22:00", - "CAS_VYP_2": "00:00", + "CAS_VYP_2": "23:59", "CAS_ZAP_3": None, "CAS_VYP_3": None, "CAS_ZAP_4": None, @@ -192,7 +192,7 @@ def getCode(code: str) -> dict: "CAS_ZAP_2": "13:00", "CAS_VYP_2": "16:00", "CAS_ZAP_3": "19:00", - "CAS_VYP_3": "0:00", + "CAS_VYP_3": "23:59", "CAS_ZAP_4": None, "CAS_VYP_4": None, "CAS_ZAP_5": None, @@ -219,7 +219,7 @@ def getCode(code: str) -> dict: "CAS_ZAP_4": "14:00", "CAS_VYP_4": "16:00", "CAS_ZAP_5": "17:00", - "CAS_VYP_5": "0:00", + "CAS_VYP_5": "23:59", "CAS_ZAP_6": None, "CAS_VYP_6": None, "CAS_ZAP_7": None, @@ -242,7 +242,7 @@ def getCode(code: str) -> dict: "CAS_ZAP_4": "14:00", "CAS_VYP_4": "16:00", "CAS_ZAP_5": "17:00", - "CAS_VYP_5": "0:00", + "CAS_VYP_5": "23:59", "CAS_ZAP_6": None, "CAS_VYP_6": None, "CAS_ZAP_7": None, @@ -265,7 +265,7 @@ def getCode(code: str) -> dict: "CAS_ZAP_4": "16:00", "CAS_VYP_4": "19:00", "CAS_ZAP_5": "20:00", - "CAS_VYP_5": "0:00", + "CAS_VYP_5": "23:59", "CAS_ZAP_6": None, "CAS_VYP_6": None, "CAS_ZAP_7": None, @@ -288,7 +288,7 @@ def getCode(code: str) -> dict: "CAS_ZAP_4": "15:00", "CAS_VYP_4": "17:00", "CAS_ZAP_5": "18:00", - "CAS_VYP_5": "0:00", + "CAS_VYP_5": "23:59", "CAS_ZAP_6": None, "CAS_VYP_6": None, "CAS_ZAP_7": None, @@ -334,7 +334,7 @@ def getCode(code: str) -> dict: "CAS_ZAP_4": "16:00", "CAS_VYP_4": "19:00", "CAS_ZAP_5": "20:00", - "CAS_VYP_5": "0:00", + "CAS_VYP_5": "23:59", "CAS_ZAP_6": None, "CAS_VYP_6": None, "CAS_ZAP_7": None, @@ -357,7 +357,7 @@ def getCode(code: str) -> dict: "CAS_ZAP_4": "15:00", "CAS_VYP_4": "17:00", "CAS_ZAP_5": "18:00", - "CAS_VYP_5": "0:00", + "CAS_VYP_5": "23:59", "CAS_ZAP_6": None, "CAS_VYP_6": None, "CAS_ZAP_7": None, @@ -376,7 +376,7 @@ def getCode(code: str) -> dict: "CAS_ZAP_2": "10:00", "CAS_VYP_2": "12:00", "CAS_ZAP_3": "13:00", - "CAS_VYP_3": "10:00", + "CAS_VYP_3": "23:59", "CAS_ZAP_4": None, "CAS_VYP_4": None, "CAS_ZAP_5": None, @@ -443,7 +443,7 @@ def getCode(code: str) -> dict: "CAS_ZAP_1": "0:00", "CAS_VYP_1": "4:30", "CAS_ZAP_2": "8:30", - "CAS_VYP_2": "0:00", + "CAS_VYP_2": "23:59", "CAS_ZAP_3": None, "CAS_VYP_3": None, "CAS_ZAP_4": None, @@ -466,7 +466,7 @@ def getCode(code: str) -> dict: "CAS_ZAP_1": "0:00", "CAS_VYP_1": "14:00", "CAS_ZAP_2": "18:00", - "CAS_VYP_2": "0:00", + "CAS_VYP_2": "23:59", "CAS_ZAP_3": None, "CAS_VYP_3": None, "CAS_ZAP_4": None, @@ -489,7 +489,7 @@ def getCode(code: str) -> dict: "CAS_ZAP_1": "0:00", "CAS_VYP_1": "6:00", "CAS_ZAP_2": "10:00", - "CAS_VYP_2": "0:00", + "CAS_VYP_2": "23:59", "CAS_ZAP_3": None, "CAS_VYP_3": None, "CAS_ZAP_4": None, @@ -535,7 +535,7 @@ def getCode(code: str) -> dict: "CAS_ZAP_1": "0:00", "CAS_VYP_1": "3:00", "CAS_ZAP_2": "7:00", - "CAS_VYP_2": "0:00", + "CAS_VYP_2": "23:59", "CAS_ZAP_3": None, "CAS_VYP_3": None, "CAS_ZAP_4": None, @@ -579,7 +579,7 @@ def getCode(code: str) -> dict: VIKV1_1: dict = { "PLATNOST": "Pa - Pa", "CAS_ZAP_1": "12:00", - "CAS_VYP_1": "0:00", + "CAS_VYP_1": "23:59", "CAS_ZAP_2": None, "CAS_VYP_2": None, "CAS_ZAP_3": None, @@ -652,7 +652,7 @@ def getCode(code: str) -> dict: "CAS_ZAP_2": "10:00", "CAS_VYP_2": "16:00", "CAS_ZAP_3": "20:00", - "CAS_VYP_3": "0:00", + "CAS_VYP_3": "23:59", "CAS_ZAP_4": None, "CAS_VYP_4": None, "CAS_ZAP_5": None, @@ -673,7 +673,7 @@ def getCode(code: str) -> dict: "CAS_ZAP_1": "0:00", "CAS_VYP_1": "7:00", "CAS_ZAP_2": "15:00", - "CAS_VYP_2": "0:00", + "CAS_VYP_2": "23:59", "CAS_ZAP_3": None, "CAS_VYP_3": None, "CAS_ZAP_4": None, @@ -698,7 +698,7 @@ def getCode(code: str) -> dict: "CAS_ZAP_2": "10:00", "CAS_VYP_2": "18:00", "CAS_ZAP_3": "23:00", - "CAS_VYP_3": "0:00", + "CAS_VYP_3": "23:59", "CAS_ZAP_4": None, "CAS_VYP_4": None, "CAS_ZAP_5": None, From 64ed936816d3ab841be68a1a222056ecdaa2593e Mon Sep 17 00:00:00 2001 From: pokornyIt <8665714+pokornyit@users.noreply.github.com> Date: Sat, 11 May 2024 13:43:59 +0200 Subject: [PATCH 3/4] Fix read data from the local store Solves issues: #32 and #34 --- .gitignore | 56 +------------------ README.md | 2 +- .../cezdistribuce/continuous_measurement.py | 3 + 3 files changed, 5 insertions(+), 56 deletions(-) diff --git a/.gitignore b/.gitignore index 19571c5..d363c2d 100644 --- a/.gitignore +++ b/.gitignore @@ -173,54 +173,9 @@ cython_debug/ # Built Visual Studio Code Extensions *.vsix -# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider -# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 - -# User-specific stuff -.idea/**/workspace.xml -.idea/**/tasks.xml -.idea/**/usage.statistics.xml -.idea/**/dictionaries -.idea/**/shelf - -# AWS User-specific -.idea/**/aws.xml - -# Generated files -.idea/**/contentModel.xml - -# Sensitive or high-churn files -.idea/**/dataSources/ -.idea/**/dataSources.ids -.idea/**/dataSources.local.xml -.idea/**/sqlDataSources.xml -.idea/**/dynamic.xml -.idea/**/uiDesigner.xml -.idea/**/dbnavigator.xml - -# Gradle -.idea/**/gradle.xml -.idea/**/libraries - -# Gradle and Maven with auto-import -# When using Gradle or Maven with auto-import, you should exclude module files, -# since they will be recreated, and may cause churn. Uncomment if using -# auto-import. -# .idea/artifacts -# .idea/compiler.xml -# .idea/jarRepositories.xml -# .idea/modules.xml -# .idea/*.iml -# .idea/modules -# *.iml -# *.ipr - # CMake cmake-build-*/ -# Mongo Explorer plugin -.idea/**/mongoSettings.xml - # File-based project format *.iws @@ -233,11 +188,6 @@ out/ # JIRA plugin atlassian-ide-plugin.xml -# Cursive Clojure plugin -.idea/replstate.xml - -# SonarLint plugin -.idea/sonarlint/ # Crashlytics plugin (for Android Studio and IntelliJ) com_crashlytics_export_strings.xml @@ -245,8 +195,4 @@ crashlytics.properties crashlytics-build.properties fabric.properties -# Editor-based Rest Client -.idea/httpRequests - -# Android studio 3.1+ serialized cache file -.idea/caches/build_file_checksums.ser +.idea/ diff --git a/README.md b/README.md index af6a49a..a4a2dd6 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ Add the following to your `configuration.yaml` file: # Example configuration.yaml entry for showing current HDO state binary_sensor: - platform: cezdistribuce - name: nizky tarif + name: stred_a1b5dp6 region: stred code: A1B5DP6 ``` diff --git a/custom_components/cezdistribuce/continuous_measurement.py b/custom_components/cezdistribuce/continuous_measurement.py index ff41cac..e181018 100644 --- a/custom_components/cezdistribuce/continuous_measurement.py +++ b/custom_components/cezdistribuce/continuous_measurement.py @@ -20,6 +20,9 @@ def isContinuousCode() -> list: @staticmethod def getCode(code: str) -> dict: "return specific dict for code or empty dict if code not exists" + data = ContinuousMeasurement.CODES.get(code) + if len(data) == 1: + data = data[0] to_response = {"data": ContinuousMeasurement.CODES.get(code)} _LOGGER.debug("select data for code %s: %s", code, to_response) return to_response From 0257fb71a234c84240f6947a715a0e40845ab96c Mon Sep 17 00:00:00 2001 From: pokornyIt <8665714+pokornyit@users.noreply.github.com> Date: Sat, 11 May 2024 13:46:07 +0200 Subject: [PATCH 4/4] Update version Solves issues: #32 and #34 --- custom_components/cezdistribuce/manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/custom_components/cezdistribuce/manifest.json b/custom_components/cezdistribuce/manifest.json index 76a8ae0..026e155 100644 --- a/custom_components/cezdistribuce/manifest.json +++ b/custom_components/cezdistribuce/manifest.json @@ -1,7 +1,7 @@ { "domain": "cezdistribuce", "name": "CEZ Distribuce", - "version": "0.4.9", + "version": "0.5.0", "documentation": "https://github.com/zigul/HomeAssistant-CEZdistribuce", "issue_tracker": "https://github.com/zigul/HomeAssistant-CEZdistribuce/issues", "dependencies": [],