mirror of
https://github.com/home-assistant/core.git
synced 2025-07-25 14:17:45 +00:00
commit
4be9766498
@ -4,5 +4,6 @@
|
|||||||
"documentation": "https://www.home-assistant.io/integrations/dwd_weather_warnings",
|
"documentation": "https://www.home-assistant.io/integrations/dwd_weather_warnings",
|
||||||
"requirements": [],
|
"requirements": [],
|
||||||
"dependencies": [],
|
"dependencies": [],
|
||||||
|
"after_dependencies": ["rest"],
|
||||||
"codeowners": []
|
"codeowners": []
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
"documentation": "https://www.home-assistant.io/integrations/emulated_hue",
|
"documentation": "https://www.home-assistant.io/integrations/emulated_hue",
|
||||||
"requirements": ["aiohttp_cors==0.7.0"],
|
"requirements": ["aiohttp_cors==0.7.0"],
|
||||||
"dependencies": [],
|
"dependencies": [],
|
||||||
|
"after_dependencies": ["http"],
|
||||||
"codeowners": [],
|
"codeowners": [],
|
||||||
"quality_scale": "internal"
|
"quality_scale": "internal"
|
||||||
}
|
}
|
||||||
|
@ -199,6 +199,9 @@ def humanify(hass, events):
|
|||||||
"""
|
"""
|
||||||
domain_prefixes = tuple(f"{dom}." for dom in CONTINUOUS_DOMAINS)
|
domain_prefixes = tuple(f"{dom}." for dom in CONTINUOUS_DOMAINS)
|
||||||
|
|
||||||
|
# Track last states to filter out duplicates
|
||||||
|
last_state = {}
|
||||||
|
|
||||||
# Group events in batches of GROUP_BY_MINUTES
|
# Group events in batches of GROUP_BY_MINUTES
|
||||||
for _, g_events in groupby(
|
for _, g_events in groupby(
|
||||||
events, lambda event: event.time_fired.minute // GROUP_BY_MINUTES
|
events, lambda event: event.time_fired.minute // GROUP_BY_MINUTES
|
||||||
@ -236,9 +239,15 @@ def humanify(hass, events):
|
|||||||
# Yield entries
|
# Yield entries
|
||||||
for event in events_batch:
|
for event in events_batch:
|
||||||
if event.event_type == EVENT_STATE_CHANGED:
|
if event.event_type == EVENT_STATE_CHANGED:
|
||||||
|
|
||||||
to_state = State.from_dict(event.data.get("new_state"))
|
to_state = State.from_dict(event.data.get("new_state"))
|
||||||
|
|
||||||
|
# Filter out states that become same state again (force_update=True)
|
||||||
|
# or light becoming different color
|
||||||
|
if last_state.get(to_state.entity_id) == to_state.state:
|
||||||
|
continue
|
||||||
|
|
||||||
|
last_state[to_state.entity_id] = to_state.state
|
||||||
|
|
||||||
domain = to_state.domain
|
domain = to_state.domain
|
||||||
|
|
||||||
# Skip all but the last sensor state
|
# Skip all but the last sensor state
|
||||||
|
@ -61,7 +61,7 @@ class PushoverNotificationService(BaseNotificationService):
|
|||||||
url = data.get(ATTR_URL, None)
|
url = data.get(ATTR_URL, None)
|
||||||
url_title = data.get(ATTR_URL_TITLE, None)
|
url_title = data.get(ATTR_URL_TITLE, None)
|
||||||
priority = data.get(ATTR_PRIORITY, None)
|
priority = data.get(ATTR_PRIORITY, None)
|
||||||
retry = data.get(ATTR_PRIORITY, None)
|
retry = data.get(ATTR_RETRY, None)
|
||||||
expire = data.get(ATTR_EXPIRE, None)
|
expire = data.get(ATTR_EXPIRE, None)
|
||||||
callback_url = data.get(ATTR_CALLBACK_URL, None)
|
callback_url = data.get(ATTR_CALLBACK_URL, None)
|
||||||
timestamp = data.get(ATTR_TIMESTAMP, None)
|
timestamp = data.get(ATTR_TIMESTAMP, None)
|
||||||
|
@ -4,5 +4,6 @@
|
|||||||
"documentation": "https://www.home-assistant.io/integrations/pvoutput",
|
"documentation": "https://www.home-assistant.io/integrations/pvoutput",
|
||||||
"requirements": [],
|
"requirements": [],
|
||||||
"dependencies": [],
|
"dependencies": [],
|
||||||
|
"after_dependencies": ["rest"],
|
||||||
"codeowners": ["@fabaff"]
|
"codeowners": ["@fabaff"]
|
||||||
}
|
}
|
||||||
|
@ -68,3 +68,8 @@ class TeslaDeviceEntity(TeslaDevice, TrackerEntity):
|
|||||||
def source_type(self):
|
def source_type(self):
|
||||||
"""Return the source type, eg gps or router, of the device."""
|
"""Return the source type, eg gps or router, of the device."""
|
||||||
return SOURCE_TYPE_GPS
|
return SOURCE_TYPE_GPS
|
||||||
|
|
||||||
|
@property
|
||||||
|
def force_update(self):
|
||||||
|
"""All updates do not need to be written to the state machine."""
|
||||||
|
return False
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
"config_flow": true,
|
"config_flow": true,
|
||||||
"documentation": "https://www.home-assistant.io/integrations/unifi",
|
"documentation": "https://www.home-assistant.io/integrations/unifi",
|
||||||
"requirements": [
|
"requirements": [
|
||||||
"aiounifi==13"
|
"aiounifi==14"
|
||||||
],
|
],
|
||||||
"dependencies": [],
|
"dependencies": [],
|
||||||
"codeowners": [
|
"codeowners": [
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
"""Constants used by Home Assistant components."""
|
"""Constants used by Home Assistant components."""
|
||||||
MAJOR_VERSION = 0
|
MAJOR_VERSION = 0
|
||||||
MINOR_VERSION = 106
|
MINOR_VERSION = 106
|
||||||
PATCH_VERSION = "4"
|
PATCH_VERSION = "5"
|
||||||
__short_version__ = f"{MAJOR_VERSION}.{MINOR_VERSION}"
|
__short_version__ = f"{MAJOR_VERSION}.{MINOR_VERSION}"
|
||||||
__version__ = f"{__short_version__}.{PATCH_VERSION}"
|
__version__ = f"{__short_version__}.{PATCH_VERSION}"
|
||||||
REQUIRED_PYTHON_VER = (3, 7, 0)
|
REQUIRED_PYTHON_VER = (3, 7, 0)
|
||||||
|
@ -199,7 +199,7 @@ aiopylgtv==0.3.3
|
|||||||
aioswitcher==2019.4.26
|
aioswitcher==2019.4.26
|
||||||
|
|
||||||
# homeassistant.components.unifi
|
# homeassistant.components.unifi
|
||||||
aiounifi==13
|
aiounifi==14
|
||||||
|
|
||||||
# homeassistant.components.wwlln
|
# homeassistant.components.wwlln
|
||||||
aiowwlln==2.0.2
|
aiowwlln==2.0.2
|
||||||
|
@ -78,7 +78,7 @@ aiopylgtv==0.3.3
|
|||||||
aioswitcher==2019.4.26
|
aioswitcher==2019.4.26
|
||||||
|
|
||||||
# homeassistant.components.unifi
|
# homeassistant.components.unifi
|
||||||
aiounifi==13
|
aiounifi==14
|
||||||
|
|
||||||
# homeassistant.components.wwlln
|
# homeassistant.components.wwlln
|
||||||
aiowwlln==2.0.2
|
aiowwlln==2.0.2
|
||||||
|
@ -65,7 +65,7 @@ class ImportCollector(ast.NodeVisitor):
|
|||||||
|
|
||||||
# self.hass.components.hue.async_create()
|
# self.hass.components.hue.async_create()
|
||||||
# Name(id=self)
|
# Name(id=self)
|
||||||
# .Attribute(attr=hass)
|
# .Attribute(attr=hass) or .Attribute(attr=_hass)
|
||||||
# .Attribute(attr=hue)
|
# .Attribute(attr=hue)
|
||||||
# .Attribute(attr=async_create)
|
# .Attribute(attr=async_create)
|
||||||
if (
|
if (
|
||||||
@ -78,7 +78,7 @@ class ImportCollector(ast.NodeVisitor):
|
|||||||
)
|
)
|
||||||
or (
|
or (
|
||||||
isinstance(node.value.value, ast.Attribute)
|
isinstance(node.value.value, ast.Attribute)
|
||||||
and node.value.value.attr == "hass"
|
and node.value.value.attr in ("hass", "_hass")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
):
|
):
|
||||||
@ -89,20 +89,47 @@ class ImportCollector(ast.NodeVisitor):
|
|||||||
|
|
||||||
|
|
||||||
ALLOWED_USED_COMPONENTS = {
|
ALLOWED_USED_COMPONENTS = {
|
||||||
# This component will always be set up
|
# Internal integrations
|
||||||
"persistent_notification",
|
"alert",
|
||||||
# These allow to register things without being set up
|
|
||||||
"conversation",
|
|
||||||
"frontend",
|
|
||||||
"hassio",
|
|
||||||
"system_health",
|
|
||||||
"websocket_api",
|
|
||||||
"automation",
|
"automation",
|
||||||
|
"conversation",
|
||||||
"device_automation",
|
"device_automation",
|
||||||
"zone",
|
"frontend",
|
||||||
|
"group",
|
||||||
|
"hassio",
|
||||||
"homeassistant",
|
"homeassistant",
|
||||||
"system_log",
|
"input_boolean",
|
||||||
|
"input_datetime",
|
||||||
|
"input_number",
|
||||||
|
"input_select",
|
||||||
|
"input_text",
|
||||||
|
"persistent_notification",
|
||||||
"person",
|
"person",
|
||||||
|
"script",
|
||||||
|
"shopping_list",
|
||||||
|
"sun",
|
||||||
|
"system_health",
|
||||||
|
"system_log",
|
||||||
|
"timer",
|
||||||
|
"webhook",
|
||||||
|
"websocket_api",
|
||||||
|
"zone",
|
||||||
|
# Entity integrations with platforms
|
||||||
|
"alarm_control_panel",
|
||||||
|
"binary_sensor",
|
||||||
|
"climate",
|
||||||
|
"cover",
|
||||||
|
"device_tracker",
|
||||||
|
"fan",
|
||||||
|
"image_processing",
|
||||||
|
"light",
|
||||||
|
"lock",
|
||||||
|
"media_player",
|
||||||
|
"scene",
|
||||||
|
"sensor",
|
||||||
|
"switch",
|
||||||
|
"vacuum",
|
||||||
|
"water_heater",
|
||||||
# Other
|
# Other
|
||||||
"mjpeg", # base class, has no reqs or component to load.
|
"mjpeg", # base class, has no reqs or component to load.
|
||||||
"stream", # Stream cannot install on all systems, can be imported without reqs.
|
"stream", # Stream cannot install on all systems, can be imported without reqs.
|
||||||
@ -121,18 +148,7 @@ IGNORE_VIOLATIONS = {
|
|||||||
# This should become a helper method that integrations can submit data to
|
# This should become a helper method that integrations can submit data to
|
||||||
("websocket_api", "lovelace"),
|
("websocket_api", "lovelace"),
|
||||||
("websocket_api", "shopping_list"),
|
("websocket_api", "shopping_list"),
|
||||||
# Expose HA to external systems
|
|
||||||
"homekit",
|
|
||||||
"alexa",
|
|
||||||
"google_assistant",
|
|
||||||
"emulated_hue",
|
|
||||||
"prometheus",
|
|
||||||
"conversation",
|
|
||||||
"logbook",
|
"logbook",
|
||||||
"mobile_app",
|
|
||||||
# These should be extracted to external package
|
|
||||||
"pvoutput",
|
|
||||||
"dwd_weather_warnings",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1484,3 +1484,36 @@ async def test_humanify_script_started_event(hass):
|
|||||||
assert event2["domain"] == "script"
|
assert event2["domain"] == "script"
|
||||||
assert event2["message"] == "started"
|
assert event2["message"] == "started"
|
||||||
assert event2["entity_id"] == "script.bye"
|
assert event2["entity_id"] == "script.bye"
|
||||||
|
|
||||||
|
|
||||||
|
async def test_humanify_same_state(hass):
|
||||||
|
"""Test humanifying Script Run event."""
|
||||||
|
state_50 = ha.State("light.kitchen", "on", {"brightness": 50}).as_dict()
|
||||||
|
state_100 = ha.State("light.kitchen", "on", {"brightness": 100}).as_dict()
|
||||||
|
state_200 = ha.State("light.kitchen", "on", {"brightness": 200}).as_dict()
|
||||||
|
|
||||||
|
events = list(
|
||||||
|
logbook.humanify(
|
||||||
|
hass,
|
||||||
|
[
|
||||||
|
ha.Event(
|
||||||
|
EVENT_STATE_CHANGED,
|
||||||
|
{
|
||||||
|
"entity_id": "light.kitchen",
|
||||||
|
"old_state": state_50,
|
||||||
|
"new_state": state_100,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
ha.Event(
|
||||||
|
EVENT_STATE_CHANGED,
|
||||||
|
{
|
||||||
|
"entity_id": "light.kitchen",
|
||||||
|
"old_state": state_100,
|
||||||
|
"new_state": state_200,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
assert len(events) == 1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user