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
14 changes: 7 additions & 7 deletions .github/workflows/builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
publish: ${{ steps.version.outputs.publish }}
steps:
- name: Checkout the repository
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
with:
fetch-depth: 0

Expand Down Expand Up @@ -94,7 +94,7 @@ jobs:
- arch: i386
steps:
- name: Checkout the repository
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1

- name: Download nightly wheels of frontend
if: needs.init.outputs.channel == 'dev'
Expand Down Expand Up @@ -227,7 +227,7 @@ jobs:
- green
steps:
- name: Checkout the repository
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1

- name: Set build additional args
run: |
Expand Down Expand Up @@ -265,7 +265,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1

- name: Initialize git
uses: home-assistant/actions/helpers/git-init@master
Expand Down Expand Up @@ -309,7 +309,7 @@ jobs:
registry: ["ghcr.io/home-assistant", "docker.io/homeassistant"]
steps:
- name: Checkout the repository
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1

- name: Install Cosign
uses: sigstore/cosign-installer@faadad0cce49287aee09b3a48701e75088a2c6ad # v4.0.0
Expand Down Expand Up @@ -418,7 +418,7 @@ jobs:
if: github.repository_owner == 'home-assistant' && needs.init.outputs.publish == 'true'
steps:
- name: Checkout the repository
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1

- name: Set up Python ${{ env.DEFAULT_PYTHON }}
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
Expand Down Expand Up @@ -463,7 +463,7 @@ jobs:
HASSFEST_IMAGE_TAG: ghcr.io/home-assistant/hassfest:${{ needs.init.outputs.version }}
steps:
- name: Checkout repository
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1

- name: Login to GitHub Container Registry
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ jobs:
steps:
- &checkout
name: Check out code from GitHub
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
- name: Generate partial Python venv restore key
id: generate_python_cache_key
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:

steps:
- name: Check out code from GitHub
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1

- name: Initialize CodeQL
uses: github/codeql-action/init@014f16e7ab1402f30e7c3329d33797e7948572db # v4.31.3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/translations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1

- name: Set up Python ${{ env.DEFAULT_PYTHON }}
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
steps:
- &checkout
name: Checkout the repository
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1

- name: Set up Python ${{ env.DEFAULT_PYTHON }}
id: python
Expand Down
1 change: 1 addition & 0 deletions homeassistant/components/cosori/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Virtual integration: Cosori."""
6 changes: 6 additions & 0 deletions homeassistant/components/cosori/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"domain": "cosori",
"name": "Cosori",
"integration_type": "virtual",
"supported_by": "vesync"
}
7 changes: 6 additions & 1 deletion homeassistant/components/cync/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import ConfigEntryAuthFailed, ConfigEntryNotReady
from homeassistant.helpers.aiohttp_client import async_get_clientsession
from homeassistant.util.ssl import get_default_context

from .const import (
CONF_AUTHORIZE_STRING,
Expand All @@ -31,9 +32,13 @@ async def async_setup_entry(hass: HomeAssistant, entry: CyncConfigEntry) -> bool
expires_at=entry.data[CONF_EXPIRES_AT],
)
cync_auth = Auth(async_get_clientsession(hass), user=user_info)
ssl_context = get_default_context()

try:
cync = await Cync.create(cync_auth)
cync = await Cync.create(
auth=cync_auth,
ssl_context=ssl_context,
)
except AuthFailedError as ex:
raise ConfigEntryAuthFailed("User token invalid") from ex
except CyncError as ex:
Expand Down
1 change: 1 addition & 0 deletions homeassistant/components/hvv_departures/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ async def async_update_data():
update_method=async_update_data,
# Polling interval. Will only be polled if there are subscribers.
update_interval=timedelta(hours=1),
config_entry=entry,
)

# Fetch initial data so we have data when entities subscribe
Expand Down
5 changes: 3 additions & 2 deletions homeassistant/components/lcn/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

from collections.abc import Callable

from pypck.device import DeviceConnection

from homeassistant.const import CONF_ADDRESS, CONF_DOMAIN, CONF_NAME
from homeassistant.helpers.device_registry import DeviceInfo
from homeassistant.helpers.entity import Entity
Expand All @@ -10,7 +12,6 @@
from .const import CONF_DOMAIN_DATA, DOMAIN
from .helpers import (
AddressType,
DeviceConnectionType,
InputType,
LcnConfigEntry,
generate_unique_id,
Expand All @@ -23,7 +24,7 @@ class LcnEntity(Entity):
"""Parent class for all entities associated with the LCN component."""

_attr_has_entity_name = True
device_connection: DeviceConnectionType
device_connection: DeviceConnection

def __init__(
self,
Expand Down
10 changes: 5 additions & 5 deletions homeassistant/components/lcn/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

import pypck
from pypck.connection import PchkConnectionManager
from pypck.device import DeviceConnection

from homeassistant.config_entries import ConfigEntry
from homeassistant.const import (
Expand Down Expand Up @@ -48,7 +49,7 @@ class LcnRuntimeData:
connection: PchkConnectionManager
"""Connection to PCHK host."""

device_connections: dict[str, DeviceConnectionType]
device_connections: dict[str, DeviceConnection]
"""Logical addresses of devices connected to the host."""

add_entities_callbacks: dict[str, Callable[[Iterable[ConfigType]], None]]
Expand All @@ -59,7 +60,6 @@ class LcnRuntimeData:
type LcnConfigEntry = ConfigEntry[LcnRuntimeData]

type AddressType = tuple[int, int, bool]
type DeviceConnectionType = pypck.module.ModuleConnection | pypck.module.GroupConnection

type InputType = type[pypck.inputs.Input]

Expand All @@ -82,11 +82,11 @@ class LcnRuntimeData:

def get_device_connection(
hass: HomeAssistant, address: AddressType, config_entry: LcnConfigEntry
) -> DeviceConnectionType:
) -> DeviceConnection:
"""Return a lcn device_connection."""
host_connection = config_entry.runtime_data.connection
addr = pypck.lcn_addr.LcnAddr(*address)
return host_connection.get_address_conn(addr)
return host_connection.get_device_connection(addr)


def get_resource(domain_name: str, domain_data: ConfigType) -> str:
Expand Down Expand Up @@ -246,7 +246,7 @@ def register_lcn_address_devices(


async def async_update_device_config(
device_connection: DeviceConnectionType, device_config: ConfigType
device_connection: DeviceConnection, device_config: ConfigType
) -> None:
"""Fill missing values in device_config with infos from LCN bus."""
# fetch serial info if device is module
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/lcn/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
"iot_class": "local_polling",
"loggers": ["pypck"],
"quality_scale": "bronze",
"requirements": ["pypck==0.9.2", "lcn-frontend==0.2.7"]
"requirements": ["pypck==0.9.3", "lcn-frontend==0.2.7"]
}
5 changes: 3 additions & 2 deletions homeassistant/components/lcn/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from enum import StrEnum, auto

import pypck
from pypck.device import DeviceConnection
import voluptuous as vol

from homeassistant.const import (
Expand Down Expand Up @@ -48,7 +49,7 @@
VAR_UNITS,
VARIABLES,
)
from .helpers import DeviceConnectionType, LcnConfigEntry, is_states_string
from .helpers import LcnConfigEntry, is_states_string


class LcnServiceCall:
Expand All @@ -65,7 +66,7 @@ def __init__(self, hass: HomeAssistant) -> None:
"""Initialize service call."""
self.hass = hass

def get_device_connection(self, service: ServiceCall) -> DeviceConnectionType:
def get_device_connection(self, service: ServiceCall) -> DeviceConnection:
"""Get address connection object."""
entries: list[LcnConfigEntry] = self.hass.config_entries.async_loaded_entries(
DOMAIN
Expand Down
6 changes: 3 additions & 3 deletions homeassistant/components/lcn/websocket.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from typing import Any, Final

import lcn_frontend as lcn_panel
from pypck.device import DeviceConnection
import voluptuous as vol

from homeassistant.components import panel_custom, websocket_api
Expand Down Expand Up @@ -37,7 +38,6 @@
DOMAIN,
)
from .helpers import (
DeviceConnectionType,
LcnConfigEntry,
async_update_device_config,
generate_unique_id,
Expand Down Expand Up @@ -182,7 +182,7 @@ async def websocket_scan_devices(
host_connection = config_entry.runtime_data.connection
await host_connection.scan_modules()

for device_connection in host_connection.address_conns.values():
for device_connection in host_connection.device_connections.values():
if not device_connection.is_group:
await async_create_or_update_device_in_config_entry(
hass, device_connection, config_entry
Expand Down Expand Up @@ -421,7 +421,7 @@ async def websocket_delete_entity(

async def async_create_or_update_device_in_config_entry(
hass: HomeAssistant,
device_connection: DeviceConnectionType,
device_connection: DeviceConnection,
config_entry: LcnConfigEntry,
) -> None:
"""Create or update device in config_entry according to given device_connection."""
Expand Down
3 changes: 3 additions & 0 deletions homeassistant/components/mobile_app/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,11 @@
DATA_CONFIG_ENTRIES,
DATA_DELETED_IDS,
DATA_DEVICES,
DATA_PENDING_UPDATES,
DATA_PUSH_CHANNEL,
DATA_STORE,
DOMAIN,
SENSOR_TYPES,
STORAGE_KEY,
STORAGE_VERSION,
)
Expand Down Expand Up @@ -75,6 +77,7 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
DATA_DEVICES: {},
DATA_PUSH_CHANNEL: {},
DATA_STORE: store,
DATA_PENDING_UPDATES: {sensor_type: {} for sensor_type in SENSOR_TYPES},
}

hass.http.register_view(RegistrationsView())
Expand Down
7 changes: 4 additions & 3 deletions homeassistant/components/mobile_app/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from homeassistant.components.binary_sensor import BinarySensorEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_WEBHOOK_ID, STATE_ON
from homeassistant.const import CONF_WEBHOOK_ID, STATE_ON, STATE_UNKNOWN
from homeassistant.core import HomeAssistant, State, callback
from homeassistant.helpers import entity_registry as er
from homeassistant.helpers.dispatcher import async_dispatcher_connect
Expand Down Expand Up @@ -75,8 +75,9 @@ class MobileAppBinarySensor(MobileAppEntity, BinarySensorEntity):

async def async_restore_last_state(self, last_state: State) -> None:
"""Restore previous state."""
await super().async_restore_last_state(last_state)
self._config[ATTR_SENSOR_STATE] = last_state.state == STATE_ON
if self._config[ATTR_SENSOR_STATE] in (None, STATE_UNKNOWN):
await super().async_restore_last_state(last_state)
self._config[ATTR_SENSOR_STATE] = last_state.state == STATE_ON
self._async_update_attr_from_config()

@callback
Expand Down
3 changes: 3 additions & 0 deletions homeassistant/components/mobile_app/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
DATA_STORE = "store"
DATA_NOTIFY = "notify"
DATA_PUSH_CHANNEL = "push_channel"
DATA_PENDING_UPDATES = "pending_updates"

ATTR_APP_DATA = "app_data"
ATTR_APP_ID = "app_id"
Expand Down Expand Up @@ -94,3 +95,5 @@
},
extra=vol.ALLOW_EXTRA,
)

SENSOR_TYPES = (ATTR_SENSOR_TYPE_BINARY_SENSOR, ATTR_SENSOR_TYPE_SENSOR)
Loading
Loading