Home Assistant Unofficial Reference 2024.12.1
homeassistant.components.energy.validate Namespace Reference

Classes

class  EnergyPreferencesValidation
 
class  ValidationIssue
 
class  ValidationIssues
 

Functions

None _async_validate_auto_generated_cost_entity (HomeAssistant hass, str energy_entity_id, ValidationIssues issues)
 
None _async_validate_cost_stat (HomeAssistant hass, dict[str, tuple[int, recorder.models.StatisticMetaData]] metadata, str stat_id, ValidationIssues issues)
 
None _async_validate_price_entity (HomeAssistant hass, str entity_id, ValidationIssues issues, tuple[str,...] allowed_units, str unit_error)
 
None _async_validate_usage_stat (HomeAssistant hass, dict[str, tuple[int, recorder.models.StatisticMetaData]] metadata, str stat_id, Sequence[str] allowed_device_classes, Mapping[str, Sequence[str]] allowed_units, str unit_error, ValidationIssues issues)
 
dict[str, str]|None _get_placeholders (HomeAssistant hass, str issue_type)
 
EnergyPreferencesValidation async_validate (HomeAssistant hass)
 

Variables

string ENERGY_PRICE_UNIT_ERROR = "entity_unexpected_unit_energy_price"
 
 ENERGY_PRICE_UNITS
 
string ENERGY_UNIT_ERROR = "entity_unexpected_unit_energy"
 
tuple ENERGY_USAGE_DEVICE_CLASSES = (sensor.SensorDeviceClass.ENERGY,)
 
string GAS_PRICE_UNIT_ERROR = "entity_unexpected_unit_gas_price"
 
 GAS_PRICE_UNITS
 
string GAS_UNIT_ERROR = "entity_unexpected_unit_gas"
 
tuple GAS_USAGE_DEVICE_CLASSES
 
string WATER_PRICE_UNIT_ERROR = "entity_unexpected_unit_water_price"
 
 WATER_PRICE_UNITS
 
string WATER_UNIT_ERROR = "entity_unexpected_unit_water"
 
tuple WATER_USAGE_DEVICE_CLASSES = (sensor.SensorDeviceClass.WATER,)
 

Detailed Description

Validate the energy preferences provide valid data.

Function Documentation

◆ _async_validate_auto_generated_cost_entity()

None homeassistant.components.energy.validate._async_validate_auto_generated_cost_entity ( HomeAssistant  hass,
str  energy_entity_id,
ValidationIssues   issues 
)
private
Validate that the auto generated cost entity is correct.

Definition at line 305 of file validate.py.

◆ _async_validate_cost_stat()

None homeassistant.components.energy.validate._async_validate_cost_stat ( HomeAssistant  hass,
dict[str, tuple[int, recorder.models.StatisticMetaData]]  metadata,
str  stat_id,
ValidationIssues  issues 
)
private
Validate that the cost stat is correct.

Definition at line 265 of file validate.py.

◆ _async_validate_price_entity()

None homeassistant.components.energy.validate._async_validate_price_entity ( HomeAssistant  hass,
str  entity_id,
ValidationIssues  issues,
tuple[str, ...]  allowed_units,
str  unit_error 
)
private
Validate that the price entity is correct.

Definition at line 240 of file validate.py.

◆ _async_validate_usage_stat()

None homeassistant.components.energy.validate._async_validate_usage_stat ( HomeAssistant  hass,
dict[str, tuple[int, recorder.models.StatisticMetaData]]  metadata,
str  stat_id,
Sequence[str]  allowed_device_classes,
Mapping[str, Sequence[str]]  allowed_units,
str  unit_error,
ValidationIssues  issues 
)
private
Validate a statistic.

Definition at line 168 of file validate.py.

◆ _get_placeholders()

dict[str, str] | None homeassistant.components.energy.validate._get_placeholders ( HomeAssistant  hass,
str  issue_type 
)
private

Definition at line 77 of file validate.py.

◆ async_validate()

EnergyPreferencesValidation homeassistant.components.energy.validate.async_validate ( HomeAssistant  hass)
Validate the energy configuration.

Definition at line 318 of file validate.py.

Variable Documentation

◆ ENERGY_PRICE_UNIT_ERROR

string homeassistant.components.energy.validate.ENERGY_PRICE_UNIT_ERROR = "entity_unexpected_unit_energy_price"

Definition at line 36 of file validate.py.

◆ ENERGY_PRICE_UNITS

homeassistant.components.energy.validate.ENERGY_PRICE_UNITS
Initial value:
1 = tuple(
2  f"/{unit}" for units in ENERGY_USAGE_UNITS.values() for unit in units
3 )

Definition at line 32 of file validate.py.

◆ ENERGY_UNIT_ERROR

string homeassistant.components.energy.validate.ENERGY_UNIT_ERROR = "entity_unexpected_unit_energy"

Definition at line 35 of file validate.py.

◆ ENERGY_USAGE_DEVICE_CLASSES

tuple homeassistant.components.energy.validate.ENERGY_USAGE_DEVICE_CLASSES = (sensor.SensorDeviceClass.ENERGY,)

Definition at line 22 of file validate.py.

◆ GAS_PRICE_UNIT_ERROR

string homeassistant.components.energy.validate.GAS_PRICE_UNIT_ERROR = "entity_unexpected_unit_gas_price"

Definition at line 59 of file validate.py.

◆ GAS_PRICE_UNITS

homeassistant.components.energy.validate.GAS_PRICE_UNITS
Initial value:
1 = tuple(
2  f"/{unit}" for units in GAS_USAGE_UNITS.values() for unit in units
3 )

Definition at line 55 of file validate.py.

◆ GAS_UNIT_ERROR

string homeassistant.components.energy.validate.GAS_UNIT_ERROR = "entity_unexpected_unit_gas"

Definition at line 58 of file validate.py.

◆ GAS_USAGE_DEVICE_CLASSES

tuple homeassistant.components.energy.validate.GAS_USAGE_DEVICE_CLASSES
Initial value:
1 = (
2  sensor.SensorDeviceClass.ENERGY,
3  sensor.SensorDeviceClass.GAS,
4 )

Definition at line 37 of file validate.py.

◆ WATER_PRICE_UNIT_ERROR

string homeassistant.components.energy.validate.WATER_PRICE_UNIT_ERROR = "entity_unexpected_unit_water_price"

Definition at line 74 of file validate.py.

◆ WATER_PRICE_UNITS

homeassistant.components.energy.validate.WATER_PRICE_UNITS
Initial value:
1 = tuple(
2  f"/{unit}" for units in WATER_USAGE_UNITS.values() for unit in units
3 )

Definition at line 70 of file validate.py.

◆ WATER_UNIT_ERROR

string homeassistant.components.energy.validate.WATER_UNIT_ERROR = "entity_unexpected_unit_water"

Definition at line 73 of file validate.py.

◆ WATER_USAGE_DEVICE_CLASSES

tuple homeassistant.components.energy.validate.WATER_USAGE_DEVICE_CLASSES = (sensor.SensorDeviceClass.WATER,)

Definition at line 60 of file validate.py.