Skip to content

Commit

Permalink
Add account type to Forecast.Solar integration (home-assistant#55175)
Browse files Browse the repository at this point in the history
  • Loading branch information
klaasnicolaas authored Aug 25, 2021
1 parent db5e159 commit 49041b1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
8 changes: 7 additions & 1 deletion homeassistant/components/forecast_solar/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@

from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN, SensorEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ATTR_IDENTIFIERS, ATTR_MANUFACTURER, ATTR_NAME
from homeassistant.const import (
ATTR_IDENTIFIERS,
ATTR_MANUFACTURER,
ATTR_MODEL,
ATTR_NAME,
)
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.typing import StateType
Expand Down Expand Up @@ -56,6 +61,7 @@ def __init__(
ATTR_IDENTIFIERS: {(DOMAIN, entry_id)},
ATTR_NAME: "Solar Production Forecast",
ATTR_MANUFACTURER: "Forecast.Solar",
ATTR_MODEL: coordinator.data.account_type.value,
ATTR_ENTRY_TYPE: ENTRY_TYPE_SERVICE,
}

Expand Down
1 change: 1 addition & 0 deletions tests/components/forecast_solar/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ def mock_forecast_solar() -> Generator[None, MagicMock, None]:
estimate = MagicMock(spec=models.Estimate)
estimate.now.return_value = now
estimate.timezone = "Europe/Amsterdam"
estimate.account_type.value = "public"
estimate.energy_production_today = 100000
estimate.energy_production_tomorrow = 200000
estimate.power_production_now = 300000
Expand Down
2 changes: 1 addition & 1 deletion tests/components/forecast_solar/test_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ async def test_sensors(
assert device_entry.manufacturer == "Forecast.Solar"
assert device_entry.name == "Solar Production Forecast"
assert device_entry.entry_type == ENTRY_TYPE_SERVICE
assert not device_entry.model
assert device_entry.model == "public"
assert not device_entry.sw_version


Expand Down

0 comments on commit 49041b1

Please sign in to comment.