Skip to content

Commit

Permalink
Merge pull request #35 from zigul/32-bug-problém-s-časy-pro-evv1
Browse files Browse the repository at this point in the history
Solves: #35 and #34 

- fixed bug in defined times
- fixed bug with invalid data if only one object is defined locally
  • Loading branch information
pokornyIt authored May 11, 2024
2 parents a6251d8 + 0257fb7 commit aa4441b
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 109 deletions.
56 changes: 1 addition & 55 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -233,20 +188,11 @@ 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
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/
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
Expand Down
107 changes: 55 additions & 52 deletions custom_components/cezdistribuce/continuous_measurement.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -54,7 +57,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,
Expand All @@ -77,7 +80,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,
Expand All @@ -98,7 +101,30 @@ 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,
"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,
Expand All @@ -116,31 +142,6 @@ 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,
},
)
AKU8V6: dict = {
"PLATNOST": "Po - Ne",
"CAS_ZAP_1": "3:00",
Expand Down Expand Up @@ -194,7 +195,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,
Expand All @@ -221,7 +222,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,
Expand All @@ -244,7 +245,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,
Expand All @@ -267,7 +268,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,
Expand All @@ -290,7 +291,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,
Expand All @@ -305,15 +306,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,
Expand All @@ -336,7 +337,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,
Expand All @@ -359,7 +360,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,
Expand All @@ -378,7 +379,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,
Expand Down Expand Up @@ -445,7 +446,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,
Expand All @@ -468,7 +469,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,
Expand All @@ -491,7 +492,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,
Expand All @@ -510,7 +511,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,
Expand All @@ -537,7 +538,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,
Expand All @@ -556,7 +557,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,
Expand All @@ -581,7 +582,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,
Expand Down Expand Up @@ -654,7 +655,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,
Expand All @@ -675,7 +676,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,
Expand All @@ -700,7 +701,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,
Expand Down Expand Up @@ -742,5 +743,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],
}
2 changes: 1 addition & 1 deletion custom_components/cezdistribuce/manifest.json
Original file line number Diff line number Diff line change
@@ -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": [],
Expand Down

0 comments on commit aa4441b

Please sign in to comment.