mirror of
https://github.com/Electric-Special/ha-core.git
synced 2026-03-21 03:03:17 +01:00
Add forecast energy sensor to Imeon inverter integration (#152176)
Co-authored-by: TheBushBoy <theodavid@icloud.com>
This commit is contained in:
@@ -169,6 +169,12 @@
|
||||
},
|
||||
"energy_battery_consumed": {
|
||||
"default": "mdi:battery-arrow-down-outline"
|
||||
},
|
||||
"forecast_cons_remaining_today": {
|
||||
"default": "mdi:chart-line"
|
||||
},
|
||||
"forecast_prod_remaining_today": {
|
||||
"default": "mdi:chart-line"
|
||||
}
|
||||
},
|
||||
"select": {
|
||||
|
||||
@@ -417,6 +417,21 @@ SENSOR_DESCRIPTIONS = (
|
||||
state_class=SensorStateClass.TOTAL_INCREASING,
|
||||
suggested_display_precision=2,
|
||||
),
|
||||
# Forecast
|
||||
SensorEntityDescription(
|
||||
key="forecast_cons_remaining_today",
|
||||
translation_key="forecast_cons_remaining_today",
|
||||
native_unit_of_measurement=UnitOfEnergy.WATT_HOUR,
|
||||
device_class=SensorDeviceClass.ENERGY,
|
||||
suggested_display_precision=2,
|
||||
),
|
||||
SensorEntityDescription(
|
||||
key="forecast_prod_remaining_today",
|
||||
translation_key="forecast_prod_remaining_today",
|
||||
native_unit_of_measurement=UnitOfEnergy.WATT_HOUR,
|
||||
device_class=SensorDeviceClass.ENERGY,
|
||||
suggested_display_precision=2,
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -213,6 +213,12 @@
|
||||
},
|
||||
"energy_battery_consumed": {
|
||||
"name": "Today battery-consumed energy"
|
||||
},
|
||||
"forecast_cons_remaining_today": {
|
||||
"name": "Forecast remaining energy consumption for today"
|
||||
},
|
||||
"forecast_prod_remaining_today": {
|
||||
"name": "Forecast remaining energy production for today"
|
||||
}
|
||||
},
|
||||
"select": {
|
||||
|
||||
@@ -78,5 +78,9 @@
|
||||
"building_consumption": 15000.0,
|
||||
"battery_stored": 8000.0,
|
||||
"battery_consumed": 2000.0
|
||||
},
|
||||
"forecast": {
|
||||
"cons_remaining_today": 3000.0,
|
||||
"prod_remaining_today": 7000.0
|
||||
}
|
||||
}
|
||||
|
||||
@@ -504,6 +504,112 @@
|
||||
'state': '45.5',
|
||||
})
|
||||
# ---
|
||||
# name: test_sensors[sensor.imeon_inverter_forecast_remaining_energy_consumption_for_today-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'sensor',
|
||||
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
|
||||
'entity_id': 'sensor.imeon_inverter_forecast_remaining_energy_consumption_for_today',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
'sensor': dict({
|
||||
'suggested_display_precision': 2,
|
||||
}),
|
||||
}),
|
||||
'original_device_class': <SensorDeviceClass.ENERGY: 'energy'>,
|
||||
'original_icon': None,
|
||||
'original_name': 'Forecast remaining energy consumption for today',
|
||||
'platform': 'imeon_inverter',
|
||||
'previous_unique_id': None,
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'forecast_cons_remaining_today',
|
||||
'unique_id': '111111111111111_forecast_cons_remaining_today',
|
||||
'unit_of_measurement': <UnitOfEnergy.WATT_HOUR: 'Wh'>,
|
||||
})
|
||||
# ---
|
||||
# name: test_sensors[sensor.imeon_inverter_forecast_remaining_energy_consumption_for_today-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'device_class': 'energy',
|
||||
'friendly_name': 'Imeon inverter Forecast remaining energy consumption for today',
|
||||
'unit_of_measurement': <UnitOfEnergy.WATT_HOUR: 'Wh'>,
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'sensor.imeon_inverter_forecast_remaining_energy_consumption_for_today',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': '3000.0',
|
||||
})
|
||||
# ---
|
||||
# name: test_sensors[sensor.imeon_inverter_forecast_remaining_energy_production_for_today-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'sensor',
|
||||
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
|
||||
'entity_id': 'sensor.imeon_inverter_forecast_remaining_energy_production_for_today',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
'sensor': dict({
|
||||
'suggested_display_precision': 2,
|
||||
}),
|
||||
}),
|
||||
'original_device_class': <SensorDeviceClass.ENERGY: 'energy'>,
|
||||
'original_icon': None,
|
||||
'original_name': 'Forecast remaining energy production for today',
|
||||
'platform': 'imeon_inverter',
|
||||
'previous_unique_id': None,
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'forecast_prod_remaining_today',
|
||||
'unique_id': '111111111111111_forecast_prod_remaining_today',
|
||||
'unit_of_measurement': <UnitOfEnergy.WATT_HOUR: 'Wh'>,
|
||||
})
|
||||
# ---
|
||||
# name: test_sensors[sensor.imeon_inverter_forecast_remaining_energy_production_for_today-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'device_class': 'energy',
|
||||
'friendly_name': 'Imeon inverter Forecast remaining energy production for today',
|
||||
'unit_of_measurement': <UnitOfEnergy.WATT_HOUR: 'Wh'>,
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'sensor.imeon_inverter_forecast_remaining_energy_production_for_today',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': '7000.0',
|
||||
})
|
||||
# ---
|
||||
# name: test_sensors[sensor.imeon_inverter_grid_consumption-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
|
||||
Reference in New Issue
Block a user