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
8 changes: 4 additions & 4 deletions homeassistant/components/home_connect/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,31 +226,31 @@ class HomeConnectSensorEntityDescription(
options=EVENT_OPTIONS,
default_value="off",
translation_key="alarm_clock_elapsed",
appliance_types=("Oven", "Cooktop"),
appliance_types=("Oven", "Cooktop", "Hob"),
),
HomeConnectSensorEntityDescription(
key=EventKey.BSH_COMMON_EVENT_FAVORITE_001_EXTERNAL_TRIGGER,
device_class=SensorDeviceClass.ENUM,
options=EVENT_OPTIONS,
default_value="off",
translation_key="favorite_short_press",
appliance_types=("Hood", "Cooktop"),
appliance_types=("Hood", "Cooktop", "Hob"),
),
HomeConnectSensorEntityDescription(
key=EventKey.BSH_COMMON_EVENT_FAVORITE_002_EXTERNAL_TRIGGER,
device_class=SensorDeviceClass.ENUM,
options=EVENT_OPTIONS,
default_value="off",
translation_key="favorite_long_press",
appliance_types=("Hood", "Cooktop"),
appliance_types=("Hood", "Cooktop", "Hob"),
),
HomeConnectSensorEntityDescription(
key=EventKey.COOKING_OVEN_EVENT_PREHEAT_FINISHED,
device_class=SensorDeviceClass.ENUM,
options=EVENT_OPTIONS,
default_value="off",
translation_key="preheat_finished",
appliance_types=("Oven", "Cooktop"),
appliance_types=("Oven", "Cooktop", "Hob"),
),
HomeConnectSensorEntityDescription(
key=EventKey.COOKING_OVEN_EVENT_REGULAR_PREHEAT_FINISHED,
Expand Down
5 changes: 3 additions & 2 deletions homeassistant/components/powerwall/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ class PowerWallChargeSensor(PowerWallEntity, SensorEntity):
_attr_state_class = SensorStateClass.MEASUREMENT
_attr_native_unit_of_measurement = PERCENTAGE
_attr_device_class = SensorDeviceClass.BATTERY
_attr_suggested_display_precision = 0

@property
@override
Expand All @@ -295,9 +296,9 @@ def unique_id(self) -> str:

@property
@override
def native_value(self) -> int:
def native_value(self) -> float:
"""Get the current value in percentage."""
return round(self.data.charge)
return self.data.charge


class PowerWallEnergySensor(PowerWallEntity, SensorEntity):
Expand Down
1 change: 1 addition & 0 deletions homeassistant/components/scorpiontrack/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ async def async_setup_entry(
@callback
def async_add_new_vehicles() -> None:
"""Add ignition sensors for vehicles newly included in the share."""
known_vehicles.intersection_update(coordinator.vehicles_by_id)
new_vehicles = coordinator.vehicles_by_id.keys() - known_vehicles
if not new_vehicles:
return
Expand Down
13 changes: 13 additions & 0 deletions homeassistant/components/scorpiontrack/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import ConfigEntryError
from homeassistant.helpers import device_registry as dr
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed

from .const import DEFAULT_SCAN_INTERVAL, DOMAIN
Expand All @@ -28,6 +29,8 @@
class ScorpionTrackCoordinator(DataUpdateCoordinator[ScorpionTrackShare]):
"""Coordinate shared-location updates."""

config_entry: ScorpionTrackConfigEntry

def __init__(
self,
hass: HomeAssistant,
Expand Down Expand Up @@ -68,4 +71,14 @@ async def _async_update_data(self) -> ScorpionTrackShare:
) from err
else:
self.vehicles_by_id = {vehicle.id: vehicle for vehicle in share.vehicles}
device_registry = dr.async_get(self.hass)
vehicle_identifiers = {
(DOMAIN, f"{share.id}_{vehicle_id}")
for vehicle_id in self.vehicles_by_id
}
for device in dr.async_entries_for_config_entry(
device_registry, self.config_entry.entry_id
):
if device.identifiers.isdisjoint(vehicle_identifiers):
device_registry.async_remove_device(device.id)
return share
1 change: 1 addition & 0 deletions homeassistant/components/scorpiontrack/device_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ async def async_setup_entry(
@callback
def async_add_new_vehicles() -> None:
"""Add trackers for vehicles newly included in the share."""
known_vehicles.intersection_update(coordinator.vehicles_by_id)
new_vehicles = coordinator.vehicles_by_id.keys() - known_vehicles
if not new_vehicles:
return
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/scorpiontrack/quality_scale.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ rules:
icon-translations: done
reconfiguration-flow: todo
repair-issues: todo
stale-devices: todo
stale-devices: done

# Platinum
async-dependency: done
Expand Down
1 change: 1 addition & 0 deletions homeassistant/components/scorpiontrack/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ async def async_setup_entry(
@callback
def async_add_new_vehicles() -> None:
"""Add sensors for vehicles newly included in the share."""
known_vehicles.intersection_update(coordinator.vehicles_by_id)
new_vehicles = coordinator.vehicles_by_id.keys() - known_vehicles
if not new_vehicles:
return
Expand Down
13 changes: 12 additions & 1 deletion homeassistant/components/synology_dsm/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
from typing import cast

from synology_dsm.exceptions import SynologyDSMException
import voluptuous as vol

from homeassistant.core import HomeAssistant, ServiceCall, callback
from homeassistant.exceptions import HomeAssistantError
from homeassistant.helpers.service import async_register_admin_service

from .const import CONF_SERIAL, DOMAIN, SERVICE_REBOOT, SERVICE_SHUTDOWN, SERVICES
from .coordinator import SynologyDSMConfigEntry
Expand Down Expand Up @@ -86,4 +88,13 @@ def async_setup_services(hass: HomeAssistant) -> None:
"""Service handler setup."""

for service in SERVICES:
hass.services.async_register(DOMAIN, service, _service_handler)
# The call data is left as permissive as it has always been here, the
# helper would otherwise reject the optional serial with its default
# empty schema.
async_register_admin_service(
hass,
DOMAIN,
service,
_service_handler,
vol.Schema({}, extra=vol.ALLOW_EXTRA),
)
22 changes: 17 additions & 5 deletions homeassistant/components/teslemetry/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
from homeassistant.helpers.update_coordinator import UpdateFailed

from .const import (
BLE_DISCONNECT_TIMEOUT,
CLIENT_ID,
CONF_VIN,
DOMAIN,
Expand Down Expand Up @@ -905,12 +906,23 @@ async def async_unload_entry(hass: HomeAssistant, entry: TeslemetryConfigEntry)
for vehicle in entry.runtime_data.vehicles:
if isinstance(vehicle.api, VehicleRouter):
try:
await vehicle.api.primary.disconnect()
except (BleakError, TeslaFleetError, TimeoutError) as err:
# Swallowed so one stuck link cannot block the unload, but
# warn: a leaked BLE connection can keep the vehicle awake.
async with asyncio.timeout(BLE_DISCONNECT_TIMEOUT):
try:
await vehicle.api.primary.disconnect()
except (BleakError, TeslaFleetError, TimeoutError) as err:
# Swallowed so one stuck link cannot block the
# unload, but warn: a leaked BLE connection can
# keep the vehicle awake.
LOGGER.warning(
"Error disconnecting Bluetooth for %s: %s",
vehicle.vin,
err,
)
except TimeoutError:
LOGGER.warning(
"Error disconnecting Bluetooth for %s: %s", vehicle.vin, err
"Bluetooth disconnect for %s timed out after %ss",
vehicle.vin,
BLE_DISCONNECT_TIMEOUT,
)
return unloaded

Expand Down
1 change: 1 addition & 0 deletions homeassistant/components/teslemetry/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
VEHICLE_KEY_FILE = "tesla_vehicle.key"
BLE_PARENT_KEY = f"{DOMAIN}_ble_parent"
BLE_PARENT_LOCK_KEY = f"{DOMAIN}_ble_parent_lock"
BLE_DISCONNECT_TIMEOUT = 10

SUBENTRY_TYPE_ENERGY_SITE = "energy_site"
CONF_SITE_ID = "site_id"
Expand Down
8 changes: 4 additions & 4 deletions homeassistant/components/vicare/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,12 +220,12 @@ def update(self) -> None:
phase = None
with suppress(PyViCareNotSupportedFeatureError):
phase = compressor.getPhase()
# Devices do not agree on how to spell the phase, and
# some do not expose one at all, so a running compressor
# heats unless it says it is cooling.
if phase == "cooling":
cooling_active = True
elif phase == "heating" or phase is None:
# Phase is unset on hybrid devices that do not
# expose it: fall back to HEATING to match the
# pre-cooling-support behaviour.
else:
heating_active = True

if cooling_active:
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/xbox/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"iot_class": "cloud_polling",
"quality_scale": "platinum",

"requirements": ["python-xbox==0.2.1"],
"requirements": ["python-xbox==0.2.2"],
"ssdp": [
{
"manufacturer": "Microsoft Corporation",
Expand Down
16 changes: 12 additions & 4 deletions homeassistant/components/yardian/icons.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
"default": "mdi:pause-circle"
},
"watering_running": {
"default": "mdi:sprinkler",
"default": "mdi:play-circle",
"state": {
"off": "mdi:sprinkler-variant"
"off": "mdi:play-circle-outline"
}
},
"zone_enabled": {
Expand All @@ -20,6 +20,11 @@
}
}
},
"button": {
"stop_irrigation": {
"default": "mdi:stop-circle-outline"
}
},
"sensor": {
"active_zone_count": {
"default": "mdi:counter"
Expand All @@ -36,13 +41,16 @@
},
"switch": {
"switch": {
"default": "mdi:water"
"default": "mdi:toggle-switch-variant",
"state": {
"off": "mdi:toggle-switch-variant-off"
}
}
}
},
"services": {
"start_irrigation": {
"service": "mdi:water"
"service": "mdi:play-circle-outline"
}
}
}
6 changes: 3 additions & 3 deletions homeassistant/components/yardian/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"name": "Standby"
},
"watering_running": {
"name": "Watering running"
"name": "Water running"
},
"zone_enabled": {
"name": "Enabled"
Expand Down Expand Up @@ -58,14 +58,14 @@
},
"services": {
"start_irrigation": {
"description": "Starts the irrigation.",
"description": "Start a zone with a duration.",
"fields": {
"duration": {
"description": "Duration for the target to be turned on.",
"name": "Duration"
}
},
"name": "Start irrigation"
"name": "Start zone"
}
}
}
2 changes: 1 addition & 1 deletion requirements_all.txt

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

Loading
Loading