Home Assistant Unofficial Reference 2024.12.1
homeassistant.components.utility_meter Namespace Reference

Namespaces

 config_flow
 
 const
 
 diagnostics
 
 select
 
 sensor
 

Functions

bool async_migrate_entry (HomeAssistant hass, ConfigEntry config_entry)
 
bool async_setup (HomeAssistant hass, ConfigType config)
 
bool async_setup_entry (HomeAssistant hass, ConfigEntry entry)
 
bool async_unload_entry (HomeAssistant hass, ConfigEntry entry)
 
None config_entry_update_listener (HomeAssistant hass, ConfigEntry entry)
 
def max_28_days (config)
 
def period_or_cron (config)
 
def validate_cron_pattern (pattern)
 

Variables

 _LOGGER = logging.getLogger(__name__)
 
 CONFIG_SCHEMA
 
 DEFAULT_OFFSET = timedelta(hours=0)
 
 METER_CONFIG_SCHEMA
 

Detailed Description

Support for tracking consumption over given periods of time.

Function Documentation

◆ async_migrate_entry()

bool homeassistant.components.utility_meter.async_migrate_entry ( HomeAssistant  hass,
ConfigEntry  config_entry 
)
Migrate old entry.

Definition at line 259 of file __init__.py.

◆ async_setup()

bool homeassistant.components.utility_meter.async_setup ( HomeAssistant  hass,
ConfigType  config 
)
Set up an Utility Meter.

Definition at line 111 of file __init__.py.

◆ async_setup_entry()

bool homeassistant.components.utility_meter.async_setup_entry ( HomeAssistant  hass,
ConfigEntry  entry 
)
Set up Utility Meter from a config entry.

Definition at line 194 of file __init__.py.

◆ async_unload_entry()

bool homeassistant.components.utility_meter.async_unload_entry ( HomeAssistant  hass,
ConfigEntry  entry 
)
Unload a config entry.

Definition at line 244 of file __init__.py.

◆ config_entry_update_listener()

None homeassistant.components.utility_meter.config_entry_update_listener ( HomeAssistant  hass,
ConfigEntry  entry 
)
Update listener, called when the config entry options are changed.

Definition at line 238 of file __init__.py.

◆ max_28_days()

def homeassistant.components.utility_meter.max_28_days (   config)
Check that time period does not include more than 28 days.

Definition at line 73 of file __init__.py.

◆ period_or_cron()

def homeassistant.components.utility_meter.period_or_cron (   config)
Check that if cron pattern is used, then meter type and offsite must be removed.

Definition at line 58 of file __init__.py.

◆ validate_cron_pattern()

def homeassistant.components.utility_meter.validate_cron_pattern (   pattern)
Check that the pattern is well-formed.

Definition at line 48 of file __init__.py.

Variable Documentation

◆ _LOGGER

homeassistant.components.utility_meter._LOGGER = logging.getLogger(__name__)
private

Definition at line 43 of file __init__.py.

◆ CONFIG_SCHEMA

homeassistant.components.utility_meter.CONFIG_SCHEMA
Initial value:
1 = vol.Schema(
2  {DOMAIN: vol.Schema({cv.slug: METER_CONFIG_SCHEMA})}, extra=vol.ALLOW_EXTRA
3 )

Definition at line 106 of file __init__.py.

◆ DEFAULT_OFFSET

homeassistant.components.utility_meter.DEFAULT_OFFSET = timedelta(hours=0)

Definition at line 45 of file __init__.py.

◆ METER_CONFIG_SCHEMA

homeassistant.components.utility_meter.METER_CONFIG_SCHEMA
Initial value:
1 = vol.Schema(
2  vol.All(
3  {
4  vol.Required(CONF_SOURCE_SENSOR): cv.entity_id,
5  vol.Optional(CONF_NAME): cv.string,
6  vol.Optional(CONF_UNIQUE_ID): cv.string,
7  vol.Optional(CONF_METER_TYPE): vol.In(METER_TYPES),
8  vol.Optional(CONF_METER_OFFSET, default=DEFAULT_OFFSET): vol.All(
9  cv.time_period, cv.positive_timedelta, max_28_days
10  ),
11  vol.Optional(CONF_METER_DELTA_VALUES, default=False): cv.boolean,
12  vol.Optional(CONF_METER_NET_CONSUMPTION, default=False): cv.boolean,
13  vol.Optional(CONF_METER_PERIODICALLY_RESETTING, default=True): cv.boolean,
14  vol.Optional(CONF_TARIFFS, default=[]): vol.All(
15  cv.ensure_list, vol.Unique(), [cv.string]
16  ),
17  vol.Optional(CONF_CRON_PATTERN): validate_cron_pattern,
18  vol.Optional(CONF_SENSOR_ALWAYS_AVAILABLE, default=False): cv.boolean,
19  },
20  period_or_cron,
21  )
22 )

Definition at line 83 of file __init__.py.