mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 19:27:45 +00:00
Add entity translations to Forecast Solar (#96476)
This commit is contained in:
parent
46675560d2
commit
fa59b7f8ac
@ -38,7 +38,7 @@ class ForecastSolarSensorEntityDescription(SensorEntityDescription):
|
||||
SENSORS: tuple[ForecastSolarSensorEntityDescription, ...] = (
|
||||
ForecastSolarSensorEntityDescription(
|
||||
key="energy_production_today",
|
||||
name="Estimated energy production - today",
|
||||
translation_key="energy_production_today",
|
||||
state=lambda estimate: estimate.energy_production_today,
|
||||
device_class=SensorDeviceClass.ENERGY,
|
||||
native_unit_of_measurement=UnitOfEnergy.WATT_HOUR,
|
||||
@ -47,7 +47,7 @@ SENSORS: tuple[ForecastSolarSensorEntityDescription, ...] = (
|
||||
),
|
||||
ForecastSolarSensorEntityDescription(
|
||||
key="energy_production_today_remaining",
|
||||
name="Estimated energy production - remaining today",
|
||||
translation_key="energy_production_today_remaining",
|
||||
state=lambda estimate: estimate.energy_production_today_remaining,
|
||||
device_class=SensorDeviceClass.ENERGY,
|
||||
native_unit_of_measurement=UnitOfEnergy.WATT_HOUR,
|
||||
@ -56,7 +56,7 @@ SENSORS: tuple[ForecastSolarSensorEntityDescription, ...] = (
|
||||
),
|
||||
ForecastSolarSensorEntityDescription(
|
||||
key="energy_production_tomorrow",
|
||||
name="Estimated energy production - tomorrow",
|
||||
translation_key="energy_production_tomorrow",
|
||||
state=lambda estimate: estimate.energy_production_tomorrow,
|
||||
device_class=SensorDeviceClass.ENERGY,
|
||||
native_unit_of_measurement=UnitOfEnergy.WATT_HOUR,
|
||||
@ -65,17 +65,17 @@ SENSORS: tuple[ForecastSolarSensorEntityDescription, ...] = (
|
||||
),
|
||||
ForecastSolarSensorEntityDescription(
|
||||
key="power_highest_peak_time_today",
|
||||
name="Highest power peak time - today",
|
||||
translation_key="power_highest_peak_time_today",
|
||||
device_class=SensorDeviceClass.TIMESTAMP,
|
||||
),
|
||||
ForecastSolarSensorEntityDescription(
|
||||
key="power_highest_peak_time_tomorrow",
|
||||
name="Highest power peak time - tomorrow",
|
||||
translation_key="power_highest_peak_time_tomorrow",
|
||||
device_class=SensorDeviceClass.TIMESTAMP,
|
||||
),
|
||||
ForecastSolarSensorEntityDescription(
|
||||
key="power_production_now",
|
||||
name="Estimated power production - now",
|
||||
translation_key="power_production_now",
|
||||
device_class=SensorDeviceClass.POWER,
|
||||
state=lambda estimate: estimate.power_production_now,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
@ -83,37 +83,37 @@ SENSORS: tuple[ForecastSolarSensorEntityDescription, ...] = (
|
||||
),
|
||||
ForecastSolarSensorEntityDescription(
|
||||
key="power_production_next_hour",
|
||||
translation_key="power_production_next_hour",
|
||||
state=lambda estimate: estimate.power_production_at_time(
|
||||
estimate.now() + timedelta(hours=1)
|
||||
),
|
||||
name="Estimated power production - next hour",
|
||||
device_class=SensorDeviceClass.POWER,
|
||||
entity_registry_enabled_default=False,
|
||||
native_unit_of_measurement=UnitOfPower.WATT,
|
||||
),
|
||||
ForecastSolarSensorEntityDescription(
|
||||
key="power_production_next_12hours",
|
||||
translation_key="power_production_next_12hours",
|
||||
state=lambda estimate: estimate.power_production_at_time(
|
||||
estimate.now() + timedelta(hours=12)
|
||||
),
|
||||
name="Estimated power production - next 12 hours",
|
||||
device_class=SensorDeviceClass.POWER,
|
||||
entity_registry_enabled_default=False,
|
||||
native_unit_of_measurement=UnitOfPower.WATT,
|
||||
),
|
||||
ForecastSolarSensorEntityDescription(
|
||||
key="power_production_next_24hours",
|
||||
translation_key="power_production_next_24hours",
|
||||
state=lambda estimate: estimate.power_production_at_time(
|
||||
estimate.now() + timedelta(hours=24)
|
||||
),
|
||||
name="Estimated power production - next 24 hours",
|
||||
device_class=SensorDeviceClass.POWER,
|
||||
entity_registry_enabled_default=False,
|
||||
native_unit_of_measurement=UnitOfPower.WATT,
|
||||
),
|
||||
ForecastSolarSensorEntityDescription(
|
||||
key="energy_current_hour",
|
||||
name="Estimated energy production - this hour",
|
||||
translation_key="energy_current_hour",
|
||||
state=lambda estimate: estimate.energy_current_hour,
|
||||
device_class=SensorDeviceClass.ENERGY,
|
||||
native_unit_of_measurement=UnitOfEnergy.WATT_HOUR,
|
||||
@ -122,8 +122,8 @@ SENSORS: tuple[ForecastSolarSensorEntityDescription, ...] = (
|
||||
),
|
||||
ForecastSolarSensorEntityDescription(
|
||||
key="energy_next_hour",
|
||||
translation_key="energy_next_hour",
|
||||
state=lambda estimate: estimate.sum_energy_production(1),
|
||||
name="Estimated energy production - next hour",
|
||||
device_class=SensorDeviceClass.ENERGY,
|
||||
native_unit_of_measurement=UnitOfEnergy.WATT_HOUR,
|
||||
suggested_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
|
||||
|
@ -31,5 +31,42 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"entity": {
|
||||
"sensor": {
|
||||
"energy_production_today": {
|
||||
"name": "Estimated energy production - today"
|
||||
},
|
||||
"energy_production_today_remaining": {
|
||||
"name": "Estimated energy production - remaining today"
|
||||
},
|
||||
"energy_production_tomorrow": {
|
||||
"name": "Estimated energy production - tomorrow"
|
||||
},
|
||||
"power_highest_peak_time_today": {
|
||||
"name": "Highest power peak time - today"
|
||||
},
|
||||
"power_highest_peak_time_tomorrow": {
|
||||
"name": "Highest power peak time - tomorrow"
|
||||
},
|
||||
"power_production_now": {
|
||||
"name": "Estimated power production - now"
|
||||
},
|
||||
"power_production_next_hour": {
|
||||
"name": "Estimated power production - next hour"
|
||||
},
|
||||
"power_production_next_12hours": {
|
||||
"name": "Estimated power production - next 12 hours"
|
||||
},
|
||||
"power_production_next_24hours": {
|
||||
"name": "Estimated power production - next 24 hours"
|
||||
},
|
||||
"energy_current_hour": {
|
||||
"name": "Estimated energy production - this hour"
|
||||
},
|
||||
"energy_next_hour": {
|
||||
"name": "Estimated energy production - next hour"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user