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
3 changes: 3 additions & 0 deletions homeassistant/components/fritz/diagnostics.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ async def async_get_config_entry_diagnostics(
}
for _, device in avm_wrapper.devices.items()
],
"cpu_temperatures": await hass.async_add_executor_job(
avm_wrapper.fritz_status.get_cpu_temperatures
),
"wan_link_properties": await avm_wrapper.async_get_wan_link_properties(),
},
}
21 changes: 20 additions & 1 deletion homeassistant/components/mcp/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,18 @@
"url": "The remote MCP server URL for the SSE endpoint, for example http://example/sse"
}
},
"credentials_choice": {
"title": "Choose how to authenticate with the MCP server",
"description": "You can either use existing credentials from another integration or set up new credentials.",
"menu_options": {
"new_credentials": "Set up new credentials",
"pick_implementation": "Use existing credentials"
},
"menu_option_descriptions": {
"new_credentials": "You will be guided through setting up a new OAuth Client ID and secret.",
"pick_implementation": "You may use previously entered OAuth credentials."
}
},
"pick_implementation": {
"title": "[%key:common::config_flow::title::oauth2_pick_implementation%]",
"data": {
Expand All @@ -27,14 +39,21 @@
},
"abort": {
"already_configured": "[%key:common::config_flow::abort::already_configured_device%]",
"authorize_url_timeout": "[%key:common::config_flow::abort::oauth2_authorize_url_timeout%]",
"cannot_connect": "[%key:common::config_flow::error::cannot_connect%]",
"invalid_auth": "[%key:common::config_flow::error::invalid_auth%]",
"missing_capabilities": "The MCP server does not support a required capability (Tools)",
"missing_credentials": "[%key:common::config_flow::abort::oauth2_missing_credentials%]",
"no_url_available": "[%key:common::config_flow::abort::oauth2_no_url_available%]",
"reauth_account_mismatch": "The authenticated user does not match the MCP Server user that needed re-authentication.",
"reauth_successful": "[%key:common::config_flow::abort::reauth_successful%]",
"oauth_error": "[%key:common::config_flow::abort::oauth2_error%]",
"oauth_timeout": "[%key:common::config_flow::abort::oauth2_timeout%]",
"oauth_unauthorized": "[%key:common::config_flow::abort::oauth2_unauthorized%]",
"oauth_failed": "[%key:common::config_flow::abort::oauth2_failed%]",
"timeout_connect": "[%key:common::config_flow::error::timeout_connect%]",
"unknown": "[%key:common::config_flow::error::unknown%]"
"unknown": "[%key:common::config_flow::error::unknown%]",
"user_rejected_authorize": "[%key:common::config_flow::abort::oauth2_user_rejected_authorize%]"
}
}
}
19 changes: 13 additions & 6 deletions homeassistant/components/reolink/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,21 +74,28 @@ class ReolinkSmartAIBinarySensorEntityDescription(
),
ReolinkBinarySensorEntityDescription(
key=PERSON_DETECTION_TYPE,
cmd_id=[33, 600],
cmd_id=[33, 600, 696],
translation_key="person",
value=lambda api, ch: api.ai_detected(ch, PERSON_DETECTION_TYPE),
supported=lambda api, ch: api.ai_supported(ch, PERSON_DETECTION_TYPE),
),
ReolinkBinarySensorEntityDescription(
key=VEHICLE_DETECTION_TYPE,
cmd_id=[33, 600],
cmd_id=[33, 600, 696],
translation_key="vehicle",
value=lambda api, ch: api.ai_detected(ch, VEHICLE_DETECTION_TYPE),
supported=lambda api, ch: api.ai_supported(ch, VEHICLE_DETECTION_TYPE),
),
ReolinkBinarySensorEntityDescription(
key="non-motor_vehicle",
cmd_id=[600, 696],
translation_key="non-motor_vehicle",
value=lambda api, ch: api.ai_detected(ch, "non-motor vehicle"),
supported=lambda api, ch: api.supported(ch, "ai_non-motor vehicle"),
),
ReolinkBinarySensorEntityDescription(
key=PET_DETECTION_TYPE,
cmd_id=[33, 600],
cmd_id=[33, 600, 696],
translation_key="pet",
value=lambda api, ch: api.ai_detected(ch, PET_DETECTION_TYPE),
supported=lambda api, ch: (
Expand All @@ -98,14 +105,14 @@ class ReolinkSmartAIBinarySensorEntityDescription(
),
ReolinkBinarySensorEntityDescription(
key=PET_DETECTION_TYPE,
cmd_id=[33, 600],
cmd_id=[33, 600, 696],
translation_key="animal",
value=lambda api, ch: api.ai_detected(ch, PET_DETECTION_TYPE),
supported=lambda api, ch: api.supported(ch, "ai_animal"),
),
ReolinkBinarySensorEntityDescription(
key=PACKAGE_DETECTION_TYPE,
cmd_id=[33, 600],
cmd_id=[33, 600, 696],
translation_key="package",
value=lambda api, ch: api.ai_detected(ch, PACKAGE_DETECTION_TYPE),
supported=lambda api, ch: api.ai_supported(ch, PACKAGE_DETECTION_TYPE),
Expand All @@ -120,7 +127,7 @@ class ReolinkSmartAIBinarySensorEntityDescription(
),
ReolinkBinarySensorEntityDescription(
key="cry",
cmd_id=[33, 600],
cmd_id=[33],
translation_key="cry",
value=lambda api, ch: api.ai_detected(ch, "cry"),
supported=lambda api, ch: api.ai_supported(ch, "cry"),
Expand Down
6 changes: 6 additions & 0 deletions homeassistant/components/reolink/icons.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@
"on": "mdi:car"
}
},
"non-motor_vehicle": {
"default": "mdi:motorbike-off",
"state": {
"on": "mdi:motorbike"
}
},
"pet": {
"default": "mdi:dog-side-off",
"state": {
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/reolink/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@
"iot_class": "local_push",
"loggers": ["reolink_aio"],
"quality_scale": "platinum",
"requirements": ["reolink-aio==0.15.2"]
"requirements": ["reolink-aio==0.16.0"]
}
7 changes: 7 additions & 0 deletions homeassistant/components/reolink/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,13 @@
"on": "[%key:component::binary_sensor::entity_component::gas::state::on%]"
}
},
"non-motor_vehicle": {
"name": "Bicycle",
"state": {
"off": "[%key:component::binary_sensor::entity_component::gas::state::off%]",
"on": "[%key:component::binary_sensor::entity_component::gas::state::on%]"
}
},
"pet": {
"name": "Pet",
"state": {
Expand Down
3 changes: 3 additions & 0 deletions homeassistant/components/shelly/icons.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
}
},
"sensor": {
"charger_state": {
"default": "mdi:ev-station"
},
"detected_objects": {
"default": "mdi:account-group"
},
Expand Down
36 changes: 36 additions & 0 deletions homeassistant/components/shelly/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
UnitOfPower,
UnitOfPressure,
UnitOfTemperature,
UnitOfTime,
UnitOfVolume,
UnitOfVolumeFlowRate,
)
Expand Down Expand Up @@ -1489,6 +1490,41 @@ def __init__(
state_class=SensorStateClass.MEASUREMENT,
role="water_temperature",
),
"number_work_state": RpcSensorDescription(
key="number",
sub_key="value",
translation_key="charger_state",
device_class=SensorDeviceClass.ENUM,
options=[
"charger_charging",
"charger_end",
"charger_fault",
"charger_free",
"charger_free_fault",
"charger_insert",
"charger_pause",
"charger_wait",
],
role="work_state",
),
"number_energy_charge": RpcSensorDescription(
key="number",
sub_key="value",
native_unit_of_measurement=UnitOfEnergy.WATT_HOUR,
suggested_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
suggested_display_precision=2,
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL,
role="energy_charge",
),
"number_time_charge": RpcSensorDescription(
key="number",
sub_key="value",
native_unit_of_measurement=UnitOfTime.MINUTES,
suggested_display_precision=0,
device_class=SensorDeviceClass.DURATION,
role="time_charge",
),
"presence_num_objects": RpcSensorDescription(
key="presence",
sub_key="num_objects",
Expand Down
12 changes: 12 additions & 0 deletions homeassistant/components/shelly/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,18 @@
}
},
"sensor": {
"charger_state": {
"state": {
"charger_charging": "[%key:common::state::charging%]",
"charger_end": "Charge completed",
"charger_fault": "Error while charging",
"charger_free": "[%key:component::binary_sensor::entity_component::plug::state::off%]",
"charger_free_fault": "Can not release plug",
"charger_insert": "[%key:component::binary_sensor::entity_component::plug::state::on%]",
"charger_pause": "Charging paused by charger",
"charger_wait": "Charging paused by vehicle"
}
},
"detected_objects": {
"unit_of_measurement": "objects"
},
Expand Down
15 changes: 1 addition & 14 deletions homeassistant/components/sql/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import logging
from typing import Any

import sqlparse
import voluptuous as vol

from homeassistant.components.recorder import CONF_DB_URL, get_instance
Expand Down Expand Up @@ -40,23 +39,11 @@
DOMAIN,
PLATFORMS,
)
from .util import redact_credentials
from .util import redact_credentials, validate_sql_select

_LOGGER = logging.getLogger(__name__)


def validate_sql_select(value: str) -> str:
"""Validate that value is a SQL SELECT query."""
if len(query := sqlparse.parse(value.lstrip().lstrip(";"))) > 1:
raise vol.Invalid("Multiple SQL queries are not supported")
if len(query) == 0 or (query_type := query[0].get_type()) == "UNKNOWN":
raise vol.Invalid("Invalid SQL query")
if query_type != "SELECT":
_LOGGER.debug("The SQL query %s is of type %s", query, query_type)
raise vol.Invalid("Only SELECT queries allowed")
return str(query[0])


QUERY_SCHEMA = vol.Schema(
{
vol.Required(CONF_COLUMN_NAME): cv.string,
Expand Down
Loading
Loading