Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions homeassistant/components/alarm_control_panel/trigger.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@


def supports_feature(hass: HomeAssistant, entity_id: str, features: int) -> bool:
"""Get the device class of an entity or UNDEFINED if not found."""
"""Test if an entity supports the specified features."""
try:
return bool(get_supported_features(hass, entity_id) & features)
except HomeAssistantError:
Expand All @@ -39,7 +39,7 @@ def entity_filter(self, entities: set[str]) -> set[str]:
def make_entity_state_trigger_required_features(
domain: str, to_state: str, required_features: int
) -> type[EntityTargetStateTriggerBase]:
"""Create an entity state trigger class."""
"""Create an entity state trigger class with required feature filtering."""

class CustomTrigger(EntityStateTriggerRequiredFeatures):
"""Trigger for entity state changes."""
Expand Down
19 changes: 4 additions & 15 deletions homeassistant/components/light/conditions.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,4 @@
is_off:
target:
entity:
domain: light
fields:
behavior:
required: true
default: any
selector:
select:
translation_key: condition_behavior
options:
- all
- any
is_on:
.condition_common: &condition_common
target:
entity:
domain: light
Expand All @@ -26,3 +12,6 @@ is_on:
options:
- all
- any

is_off: *condition_common
is_on: *condition_common
2 changes: 1 addition & 1 deletion homeassistant/components/opower/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
"iot_class": "cloud_polling",
"loggers": ["opower"],
"quality_scale": "bronze",
"requirements": ["opower==0.16.2"]
"requirements": ["opower==0.16.3"]
}
2 changes: 1 addition & 1 deletion homeassistant/components/sunricher_dali/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
"documentation": "https://www.home-assistant.io/integrations/sunricher_dali",
"iot_class": "local_push",
"quality_scale": "silver",
"requirements": ["PySrDaliGateway==0.18.0"]
"requirements": ["PySrDaliGateway==0.19.3"]
}
30 changes: 4 additions & 26 deletions homeassistant/components/utility_meter/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
from homeassistant.components.select import DOMAIN as SELECT_DOMAIN
from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ATTR_ENTITY_ID, CONF_NAME, CONF_UNIQUE_ID, Platform
from homeassistant.core import HomeAssistant, split_entity_id
from homeassistant.const import CONF_NAME, CONF_UNIQUE_ID, Platform
from homeassistant.core import HomeAssistant
from homeassistant.helpers import (
config_validation as cv,
discovery,
Expand All @@ -20,7 +20,6 @@
async_entity_id_to_device_id,
async_remove_stale_devices_links_keep_entity_device,
)
from homeassistant.helpers.dispatcher import async_dispatcher_send
from homeassistant.helpers.helper_integration import (
async_handle_source_entity_changes,
async_remove_helper_config_entry_from_source_device,
Expand All @@ -44,9 +43,8 @@
DATA_UTILITY,
DOMAIN,
METER_TYPES,
SERVICE_RESET,
SIGNAL_RESET_METER,
)
from .services import async_setup_services

_LOGGER = logging.getLogger(__name__)

Expand Down Expand Up @@ -120,27 +118,7 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up an Utility Meter."""
hass.data[DATA_UTILITY] = {}

async def async_reset_meters(service_call):
"""Reset all sensors of a meter."""
meters = service_call.data["entity_id"]

for meter in meters:
_LOGGER.debug("resetting meter %s", meter)
domain, entity = split_entity_id(meter)
# backward compatibility up to 2022.07:
if domain == DOMAIN:
async_dispatcher_send(
hass, SIGNAL_RESET_METER, f"{SELECT_DOMAIN}.{entity}"
)
else:
async_dispatcher_send(hass, SIGNAL_RESET_METER, meter)

hass.services.async_register(
DOMAIN,
SERVICE_RESET,
async_reset_meters,
vol.Schema({ATTR_ENTITY_ID: vol.All(cv.ensure_list, [cv.entity_id])}),
)
async_setup_services(hass)

if DOMAIN not in config:
return True
Expand Down
43 changes: 43 additions & 0 deletions homeassistant/components/utility_meter/services.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
"""Support for tracking consumption over given periods of time."""

import logging

import voluptuous as vol

from homeassistant.components.select import DOMAIN as SELECT_DOMAIN
from homeassistant.const import ATTR_ENTITY_ID
from homeassistant.core import HomeAssistant, ServiceCall, callback, split_entity_id
from homeassistant.helpers import config_validation as cv
from homeassistant.helpers.dispatcher import async_dispatcher_send

from .const import DOMAIN, SERVICE_RESET, SIGNAL_RESET_METER

_LOGGER = logging.getLogger(__name__)


async def async_reset_meters(service_call: ServiceCall) -> None:
"""Reset all sensors of a meter."""
meters = service_call.data["entity_id"]

for meter in meters:
_LOGGER.debug("resetting meter %s", meter)
domain, entity = split_entity_id(meter)
# backward compatibility up to 2022.07:
if domain == DOMAIN:
async_dispatcher_send(
service_call.hass, SIGNAL_RESET_METER, f"{SELECT_DOMAIN}.{entity}"
)
else:
async_dispatcher_send(service_call.hass, SIGNAL_RESET_METER, meter)


@callback
def async_setup_services(hass: HomeAssistant) -> None:
"""Set up the services."""

hass.services.async_register(
DOMAIN,
SERVICE_RESET,
async_reset_meters,
vol.Schema({ATTR_ENTITY_ID: vol.All(cv.ensure_list, [cv.entity_id])}),
)
4 changes: 2 additions & 2 deletions requirements_all.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions requirements_test_all.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions tests/components/sunricher_dali/snapshots/test_button.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
'labels': set({
}),
'name': None,
'object_id_base': None,
'options': dict({
}),
'original_device_class': <ButtonDeviceClass.IDENTIFY: 'identify'>,
Expand Down Expand Up @@ -69,6 +70,7 @@
'labels': set({
}),
'name': None,
'object_id_base': None,
'options': dict({
}),
'original_device_class': <ButtonDeviceClass.IDENTIFY: 'identify'>,
Expand Down Expand Up @@ -118,6 +120,7 @@
'labels': set({
}),
'name': None,
'object_id_base': None,
'options': dict({
}),
'original_device_class': <ButtonDeviceClass.IDENTIFY: 'identify'>,
Expand Down Expand Up @@ -167,6 +170,7 @@
'labels': set({
}),
'name': None,
'object_id_base': None,
'options': dict({
}),
'original_device_class': <ButtonDeviceClass.IDENTIFY: 'identify'>,
Expand Down
Loading