Skip to content

Commit

Permalink
Merge branch 'dev' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Caius-Bonus authored Sep 2, 2023
2 parents 8fb38ef + 1ab2e90 commit ab8118d
Show file tree
Hide file tree
Showing 44 changed files with 1,994 additions and 340 deletions.
3 changes: 2 additions & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,8 @@ omit =
homeassistant/components/mailgun/notify.py
homeassistant/components/map/*
homeassistant/components/mastodon/notify.py
homeassistant/components/matrix/*
homeassistant/components/matrix/__init__.py
homeassistant/components/matrix/notify.py
homeassistant/components/matter/__init__.py
homeassistant/components/meater/__init__.py
homeassistant/components/meater/sensor.py
Expand Down
2 changes: 2 additions & 0 deletions .strict-typing
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ homeassistant.components.lookin.*
homeassistant.components.luftdaten.*
homeassistant.components.mailbox.*
homeassistant.components.mastodon.*
homeassistant.components.matrix.*
homeassistant.components.matter.*
homeassistant.components.media_extractor.*
homeassistant.components.media_player.*
Expand Down Expand Up @@ -254,6 +255,7 @@ homeassistant.components.persistent_notification.*
homeassistant.components.pi_hole.*
homeassistant.components.ping.*
homeassistant.components.powerwall.*
homeassistant.components.private_ble_device.*
homeassistant.components.proximity.*
homeassistant.components.prusalink.*
homeassistant.components.pure_energie.*
Expand Down
4 changes: 4 additions & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -723,6 +723,8 @@ build.json @home-assistant/supervisor
/homeassistant/components/lyric/ @timmo001
/tests/components/lyric/ @timmo001
/homeassistant/components/mastodon/ @fabaff
/homeassistant/components/matrix/ @PaarthShah
/tests/components/matrix/ @PaarthShah
/homeassistant/components/matter/ @home-assistant/matter
/tests/components/matter/ @home-assistant/matter
/homeassistant/components/mazda/ @bdr99
Expand Down Expand Up @@ -949,6 +951,8 @@ build.json @home-assistant/supervisor
/tests/components/poolsense/ @haemishkyd
/homeassistant/components/powerwall/ @bdraco @jrester @daniel-simpson
/tests/components/powerwall/ @bdraco @jrester @daniel-simpson
/homeassistant/components/private_ble_device/ @Jc2k
/tests/components/private_ble_device/ @Jc2k
/homeassistant/components/profiler/ @bdraco
/tests/components/profiler/ @bdraco
/homeassistant/components/progettihwsw/ @ardaseremet
Expand Down
21 changes: 13 additions & 8 deletions homeassistant/components/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from aiohttp.web_exceptions import HTTPBadRequest
import voluptuous as vol

from homeassistant.auth.models import User
from homeassistant.auth.permissions.const import POLICY_READ
from homeassistant.bootstrap import DATA_LOGGING
from homeassistant.components.http import HomeAssistantView, require_admin
Expand Down Expand Up @@ -189,16 +190,20 @@ class APIStatesView(HomeAssistantView):
name = "api:states"

@ha.callback
def get(self, request):
def get(self, request: web.Request) -> web.Response:
"""Get current states."""
user = request["hass_user"]
user: User = request["hass_user"]
hass: HomeAssistant = request.app["hass"]
if user.is_admin:
return self.json([state.as_dict() for state in hass.states.async_all()])
entity_perm = user.permissions.check_entity
states = [
state
for state in request.app["hass"].states.async_all()
if entity_perm(state.entity_id, "read")
]
return self.json(states)
return self.json(
[
state.as_dict()
for state in hass.states.async_all()
if entity_perm(state.entity_id, "read")
]
)


class APIEntityStateView(HomeAssistantView):
Expand Down
13 changes: 2 additions & 11 deletions homeassistant/components/hlk_sw16/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,8 @@ def __init__(self, device_port, entry_id, client):
self._device_port = device_port
self._is_on = None
self._client = client
self._name = device_port

@property
def unique_id(self):
"""Return a unique ID."""
return f"{self._entry_id}_{self._device_port}"
self._attr_name = device_port
self._attr_unique_id = f"{self._entry_id}_{self._device_port}"

@callback
def handle_event_callback(self, event):
Expand All @@ -161,11 +157,6 @@ def handle_event_callback(self, event):
self._is_on = event
self.async_write_ha_state()

@property
def name(self):
"""Return a name for the device."""
return self._name

@property
def available(self):
"""Return True if entity is available."""
Expand Down
14 changes: 3 additions & 11 deletions homeassistant/components/isy994/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@
from homeassistant.core import CALLBACK_TYPE, HomeAssistant, callback
from homeassistant.helpers.device_registry import DeviceInfo
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.event import async_track_point_in_utc_time
from homeassistant.helpers.event import async_call_later
from homeassistant.helpers.restore_state import RestoreEntity
from homeassistant.util import dt as dt_util

from .const import (
_LOGGER,
Expand Down Expand Up @@ -496,15 +495,8 @@ def timer_elapsed(now: datetime) -> None:
self._heartbeat_timer = None
self.async_write_ha_state()

point_in_time = dt_util.utcnow() + timedelta(hours=25)
_LOGGER.debug(
"Heartbeat timer starting. Now: %s Then: %s",
dt_util.utcnow(),
point_in_time,
)

self._heartbeat_timer = async_track_point_in_utc_time(
self.hass, timer_elapsed, point_in_time
self._heartbeat_timer = async_call_later(
self.hass, timedelta(hours=25), timer_elapsed
)

@callback
Expand Down
Loading

0 comments on commit ab8118d

Please sign in to comment.