mirror of
https://github.com/home-assistant/core.git
synced 2025-07-24 21:57:51 +00:00
Add account type to Forecast.Solar integration (#55175)
This commit is contained in:
parent
db5e159b6d
commit
49041b1469
@ -5,7 +5,12 @@ from datetime import datetime
|
|||||||
|
|
||||||
from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN, SensorEntity
|
from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN, SensorEntity
|
||||||
from homeassistant.config_entries import ConfigEntry
|
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.core import HomeAssistant
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
from homeassistant.helpers.typing import StateType
|
from homeassistant.helpers.typing import StateType
|
||||||
@ -56,6 +61,7 @@ class ForecastSolarSensorEntity(CoordinatorEntity, SensorEntity):
|
|||||||
ATTR_IDENTIFIERS: {(DOMAIN, entry_id)},
|
ATTR_IDENTIFIERS: {(DOMAIN, entry_id)},
|
||||||
ATTR_NAME: "Solar Production Forecast",
|
ATTR_NAME: "Solar Production Forecast",
|
||||||
ATTR_MANUFACTURER: "Forecast.Solar",
|
ATTR_MANUFACTURER: "Forecast.Solar",
|
||||||
|
ATTR_MODEL: coordinator.data.account_type.value,
|
||||||
ATTR_ENTRY_TYPE: ENTRY_TYPE_SERVICE,
|
ATTR_ENTRY_TYPE: ENTRY_TYPE_SERVICE,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,6 +61,7 @@ def mock_forecast_solar() -> Generator[None, MagicMock, None]:
|
|||||||
estimate = MagicMock(spec=models.Estimate)
|
estimate = MagicMock(spec=models.Estimate)
|
||||||
estimate.now.return_value = now
|
estimate.now.return_value = now
|
||||||
estimate.timezone = "Europe/Amsterdam"
|
estimate.timezone = "Europe/Amsterdam"
|
||||||
|
estimate.account_type.value = "public"
|
||||||
estimate.energy_production_today = 100000
|
estimate.energy_production_today = 100000
|
||||||
estimate.energy_production_tomorrow = 200000
|
estimate.energy_production_tomorrow = 200000
|
||||||
estimate.power_production_now = 300000
|
estimate.power_production_now = 300000
|
||||||
|
@ -142,7 +142,7 @@ async def test_sensors(
|
|||||||
assert device_entry.manufacturer == "Forecast.Solar"
|
assert device_entry.manufacturer == "Forecast.Solar"
|
||||||
assert device_entry.name == "Solar Production Forecast"
|
assert device_entry.name == "Solar Production Forecast"
|
||||||
assert device_entry.entry_type == ENTRY_TYPE_SERVICE
|
assert device_entry.entry_type == ENTRY_TYPE_SERVICE
|
||||||
assert not device_entry.model
|
assert device_entry.model == "public"
|
||||||
assert not device_entry.sw_version
|
assert not device_entry.sw_version
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user