Skip to content
This repository was archived by the owner on Oct 3, 2023. It is now read-only.

Commit 5763137

Browse files
Merge pull request #7 from PePeLLee/master
Time of next flip of PSE limitation
2 parents b54d7d1 + 5eff74d commit 5763137

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

custom_components/pse/binary_sensor.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ def extra_state_attributes(self):
2828
output = dict()
2929
if self.data is not None:
3030
output["demand"] = float(self.data[2].replace(",","."))
31+
if self.change is not None:
32+
output["change"] = float(self.change[1])
3133
return output
3234

3335
@property
@@ -42,4 +44,9 @@ def update(self):
4244
response = requests.get(f"https://www.pse.pl/getcsv/-/export/csv/PL_GS/data/{now.strftime('%Y%m%d')}")
4345
csv_output = csv.reader(response.text.splitlines(), delimiter=";")
4446
self.data = next(filter(lambda r: r[1] == now_hour, csv_output))
45-
47+
try:
48+
self.change = next(filter(lambda r: r[3] != self.data[3], csv_output))
49+
except StopIteration as e:
50+
pass
51+
52+

custom_components/pse/manifest.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@
1111
"requirements": [
1212
"requests"
1313
],
14-
"version": "2023.1.0"
15-
}
14+
"version": "2023.2.1"
15+
}

0 commit comments

Comments
 (0)