Skip to content

Commit

Permalink
Bump pyTibber to 0.30.4 (#129844)
Browse files Browse the repository at this point in the history
  • Loading branch information
Danielhiversen authored Nov 6, 2024
1 parent 4dbf335 commit 370d7d6
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 85 deletions.
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

0 comments on commit 370d7d6

Please sign in to comment.