Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump pyTibber to 0.30.4 #129844

Merged
merged 6 commits into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion homeassistant/components/tibber/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
"iot_class": "cloud_polling",
"loggers": ["tibber"],
"quality_scale": "silver",
"requirements": ["pyTibber==0.30.3"]
"requirements": ["pyTibber==0.30.4"]
}
12 changes: 4 additions & 8 deletions homeassistant/components/tibber/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,13 @@ async def __get_prices(call: ServiceCall, *, hass: HomeAssistant) -> ServiceResp
for tibber_home in tibber_connection.get_homes(only_active=True):
home_nickname = tibber_home.name

price_info = tibber_home.info["viewer"]["home"]["currentSubscription"][
"priceInfo"
]
price_data = [
{
"start_time": price["startsAt"],
"price": price["total"],
"level": price["level"],
"start_time": starts_at,
"price": price,
"level": tibber_home.price_level.get(starts_at),
}
for key in ("today", "tomorrow")
for price in price_info[key]
for starts_at, price in tibber_home.price_total.items()
]

selected_data = [
Expand Down
2 changes: 1 addition & 1 deletion requirements_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1738,7 +1738,7 @@ pyRFXtrx==0.31.1
pySDCP==1

# homeassistant.components.tibber
pyTibber==0.30.3
pyTibber==0.30.4

# homeassistant.components.dlink
pyW215==0.7.0
Expand Down
2 changes: 1 addition & 1 deletion requirements_test_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1415,7 +1415,7 @@ pyElectra==1.2.4
pyRFXtrx==0.31.1

# homeassistant.components.tibber
pyTibber==0.30.3
pyTibber==0.30.4

# homeassistant.components.dlink
pyW215==0.7.0
Expand Down
96 changes: 22 additions & 74 deletions tests/components/tibber/test_services.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,84 +20,32 @@ def generate_mock_home_data():
mock_homes = [
MagicMock(
name="first_home",
info={
"viewer": {
"home": {
"currentSubscription": {
"priceInfo": {
"today": [
{
"startsAt": START_TIME.isoformat(),
"total": 0.36914,
"level": "VERY_EXPENSIVE",
},
{
"startsAt": (
START_TIME + dt.timedelta(hours=1)
).isoformat(),
"total": 0.36914,
"level": "VERY_EXPENSIVE",
},
],
"tomorrow": [
{
"startsAt": tomorrow.isoformat(),
"total": 0.46914,
"level": "VERY_EXPENSIVE",
},
{
"startsAt": (
tomorrow + dt.timedelta(hours=1)
).isoformat(),
"total": 0.46914,
"level": "VERY_EXPENSIVE",
},
],
}
}
}
}
price_total={
START_TIME.isoformat(): 0.36914,
(START_TIME + dt.timedelta(hours=1)).isoformat(): 0.36914,
tomorrow.isoformat(): 0.46914,
(tomorrow + dt.timedelta(hours=1)).isoformat(): 0.46914,
},
price_level={
START_TIME.isoformat(): "VERY_EXPENSIVE",
(START_TIME + dt.timedelta(hours=1)).isoformat(): "VERY_EXPENSIVE",
tomorrow.isoformat(): "VERY_EXPENSIVE",
(tomorrow + dt.timedelta(hours=1)).isoformat(): "VERY_EXPENSIVE",
},
),
MagicMock(
name="second_home",
info={
"viewer": {
"home": {
"currentSubscription": {
"priceInfo": {
"today": [
{
"startsAt": START_TIME.isoformat(),
"total": 0.36914,
"level": "VERY_EXPENSIVE",
},
{
"startsAt": (
START_TIME + dt.timedelta(hours=1)
).isoformat(),
"total": 0.36914,
"level": "VERY_EXPENSIVE",
},
],
"tomorrow": [
{
"startsAt": tomorrow.isoformat(),
"total": 0.46914,
"level": "VERY_EXPENSIVE",
},
{
"startsAt": (
tomorrow + dt.timedelta(hours=1)
).isoformat(),
"total": 0.46914,
"level": "VERY_EXPENSIVE",
},
],
}
}
}
}
price_total={
START_TIME.isoformat(): 0.36914,
(START_TIME + dt.timedelta(hours=1)).isoformat(): 0.36914,
tomorrow.isoformat(): 0.46914,
(tomorrow + dt.timedelta(hours=1)).isoformat(): 0.46914,
},
price_level={
START_TIME.isoformat(): "VERY_EXPENSIVE",
(START_TIME + dt.timedelta(hours=1)).isoformat(): "VERY_EXPENSIVE",
tomorrow.isoformat(): "VERY_EXPENSIVE",
(tomorrow + dt.timedelta(hours=1)).isoformat(): "VERY_EXPENSIVE",
},
),
]
Expand Down