File tree Expand file tree Collapse file tree 3 files changed +12
-5
lines changed Expand file tree Collapse file tree 3 files changed +12
-5
lines changed Original file line number Diff line number Diff line change 1
1
# Changelog
2
2
3
+ ## [ v4.2.1] ( https://github.com/azogue/aiopvpc/tree/v4.2.1 ) - Fix injection price sensor attributes (2) (2023-05-29)
4
+
5
+ [ Full Changelog] ( https://github.com/azogue/aiopvpc/compare/v4.2.0...v4.2.1 )
6
+
7
+ - 🐛 Fix one-line conditional matching for 'not None' instead of positive value 🙈
8
+ - ✅ tests: Add unit test for price sensor attributes
9
+
3
10
## [ v4.2.0] ( https://github.com/azogue/aiopvpc/tree/v4.2.0 ) - Fix injection price sensor attributes (2023-05-29)
4
11
5
12
[ Full Changelog] ( https://github.com/azogue/aiopvpc/compare/v4.1.0...v4.2.0 )
Original file line number Diff line number Diff line change @@ -80,11 +80,11 @@ def _make_price_stats_attributes(
80
80
except ZeroDivisionError : # pragma: no cover
81
81
pass
82
82
attributes ["max_price" ] = max_price
83
- best_price_at = next (iter (prices_sorted )).astimezone (timezone ).hour
84
- worst_price_at = next (iter (reversed (prices_sorted ))).astimezone (timezone ).hour
85
- attributes ["max_price_at" ] = worst_price_at if sign_is_best else best_price_at
83
+ first_price_at = next (iter (prices_sorted )).astimezone (timezone ).hour
84
+ last_price_at = next (iter (reversed (prices_sorted ))).astimezone (timezone ).hour
85
+ attributes ["max_price_at" ] = last_price_at if sign_is_best == 1 else first_price_at
86
86
attributes ["min_price" ] = min_price
87
- attributes ["min_price_at" ] = best_price_at if sign_is_best else worst_price_at
87
+ attributes ["min_price_at" ] = first_price_at if sign_is_best == 1 else last_price_at
88
88
attributes ["next_best_at" ] = [
89
89
ts .astimezone (timezone ).hour for ts in prices_sorted .keys () if ts >= utc_time
90
90
]
Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ markers = [
40
40
41
41
[tool .poetry ]
42
42
name = " aiopvpc"
43
- version = " 4.2.0 "
43
+ version = " 4.2.1 "
44
44
description = " Retrieval of Spanish Electricity hourly prices (PVPC)"
45
45
authors = [
" Eugenio Panadero <[email protected] >" ]
46
46
license = " MIT"
You can’t perform that action at this time.
0 commit comments