Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/dev' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
madpilot committed Jul 6, 2024
2 parents b282aaa + f46c127 commit 1a0b281
Show file tree
Hide file tree
Showing 494 changed files with 13,292 additions and 7,348 deletions.
1 change: 1 addition & 0 deletions .core_files.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ base_platforms: &base_platforms
- homeassistant/components/tts/**
- homeassistant/components/update/**
- homeassistant/components/vacuum/**
- homeassistant/components/valve/**
- homeassistant/components/water_heater/**
- homeassistant/components/weather/**

Expand Down
1,729 changes: 0 additions & 1,729 deletions .coveragerc

This file was deleted.

1 change: 0 additions & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ If the code communicates with devices, web services, or third-party tools:
- [ ] New or updated dependencies have been added to `requirements_all.txt`.
Updated by running `python3 -m script.gen_requirements_all`.
- [ ] For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.
- [ ] Untested files have been added to `.coveragerc`.

<!--
This project is very active and we have a high turnover of pull requests.
Expand Down
40 changes: 40 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,46 @@ jobs:
. venv/bin/activate
python -m script.gen_requirements_all validate
audit-licenses:
name: Audit licenses
runs-on: ubuntu-22.04
needs:
- info
- base
if: |
needs.info.outputs.requirements == 'true'
steps:
- name: Check out code from GitHub
uses: actions/[email protected]
- name: Set up Python ${{ env.DEFAULT_PYTHON }}
id: python
uses: actions/[email protected]
with:
python-version: ${{ env.DEFAULT_PYTHON }}
check-latest: true
- name: Restore full Python ${{ env.DEFAULT_PYTHON }} virtual environment
id: cache-venv
uses: actions/cache/[email protected]
with:
path: venv
fail-on-cache-miss: true
key: >-
${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
needs.info.outputs.python_cache_key }}
- name: Run pip-licenses
run: |
. venv/bin/activate
pip-licenses --format=json --output-file=licenses.json
- name: Upload licenses
uses: actions/[email protected]
with:
name: licenses
path: licenses.json
- name: Process licenses
run: |
. venv/bin/activate
python -m script.licenses
pylint:
name: Check pylint
runs-on: ubuntu-22.04
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.5.0
rev: v0.5.1
hooks:
- id: ruff
args:
Expand Down Expand Up @@ -83,7 +83,7 @@ repos:
pass_filenames: false
language: script
types: [text]
files: ^(homeassistant/.+/(icons|manifest|strings)\.json|homeassistant/brands/.*\.json|\.coveragerc|homeassistant/.+/services\.yaml|script/hassfest/(?!metadata|mypy_config).+\.py|requirements_test.txt)$
files: ^(homeassistant/.+/(icons|manifest|strings)\.json|homeassistant/brands/.*\.json|homeassistant/.+/services\.yaml|script/hassfest/(?!metadata|mypy_config).+\.py|requirements_test.txt)$
- id: hassfest-metadata
name: hassfest-metadata
entry: script/run-in-env.sh python3 -m script.hassfest -p metadata
Expand Down
42 changes: 29 additions & 13 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,38 +6,52 @@
"configurations": [
{
"name": "Home Assistant",
"type": "python",
"type": "debugpy",
"request": "launch",
"module": "homeassistant",
"justMyCode": false,
"args": ["--debug", "-c", "config"],
"args": [
"--debug",
"-c",
"config"
],
"preLaunchTask": "Compile English translations"
},
{
"name": "Home Assistant (skip pip)",
"type": "python",
"type": "debugpy",
"request": "launch",
"module": "homeassistant",
"justMyCode": false,
"args": ["--debug", "-c", "config", "--skip-pip"],
"args": [
"--debug",
"-c",
"config",
"--skip-pip"
],
"preLaunchTask": "Compile English translations"
},
{
"name": "Home Assistant: Changed tests",
"type": "python",
"type": "debugpy",
"request": "launch",
"module": "pytest",
"justMyCode": false,
"args": ["--timeout=10", "--picked"],
"args": [
"--timeout=10",
"--picked"
],
},
{
// Debug by attaching to local Home Assistant server using Remote Python Debugger.
// See https://www.home-assistant.io/integrations/debugpy/
"name": "Home Assistant: Attach Local",
"type": "python",
"type": "debugpy",
"request": "attach",
"port": 5678,
"host": "localhost",
"connect": {
"port": 5678,
"host": "localhost"
},
"pathMappings": [
{
"localRoot": "${workspaceFolder}",
Expand All @@ -49,10 +63,12 @@
// Debug by attaching to remote Home Assistant server using Remote Python Debugger.
// See https://www.home-assistant.io/integrations/debugpy/
"name": "Home Assistant: Attach Remote",
"type": "python",
"type": "debugpy",
"request": "attach",
"port": 5678,
"host": "homeassistant.local",
"connect": {
"port": 5678,
"host": "homeassistant.local"
},
"pathMappings": [
{
"localRoot": "${workspaceFolder}",
Expand All @@ -61,4 +77,4 @@
]
}
]
}
}
4 changes: 4 additions & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,8 @@ build.json @home-assistant/supervisor
/tests/components/ccm15/ @ocalvo
/homeassistant/components/cert_expiry/ @jjlawren
/tests/components/cert_expiry/ @jjlawren
/homeassistant/components/chacon_dio/ @cnico
/tests/components/chacon_dio/ @cnico
/homeassistant/components/cisco_ios/ @fbradyirl
/homeassistant/components/cisco_mobility_express/ @fbradyirl
/homeassistant/components/cisco_webex_teams/ @fbradyirl
Expand Down Expand Up @@ -777,6 +779,8 @@ build.json @home-assistant/supervisor
/tests/components/lg_netcast/ @Drafteed @splinter98
/homeassistant/components/lidarr/ @tkdrob
/tests/components/lidarr/ @tkdrob
/homeassistant/components/lifx/ @Djelibeybi
/tests/components/lifx/ @Djelibeybi
/homeassistant/components/light/ @home-assistant/core
/tests/components/light/ @home-assistant/core
/homeassistant/components/linear_garage_door/ @IceBotYT
Expand Down
2 changes: 1 addition & 1 deletion codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ coverage:
status:
project:
default:
target: 90
target: auto
threshold: 0.09
required:
target: auto
Expand Down
8 changes: 6 additions & 2 deletions homeassistant/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
)
from .helpers.dispatcher import async_dispatcher_send_internal
from .helpers.storage import get_internal_store_manager
from .helpers.system_info import async_get_system_info
from .helpers.system_info import async_get_system_info, is_official_image
from .helpers.typing import ConfigType
from .setup import (
# _setup_started is marked as protected to make it clear
Expand All @@ -104,7 +104,7 @@
from .util.async_ import create_eager_task
from .util.hass_dict import HassKey
from .util.logging import async_activate_log_queue_handler
from .util.package import async_get_user_site, is_virtual_env
from .util.package import async_get_user_site, is_docker_env, is_virtual_env

with contextlib.suppress(ImportError):
# Ensure anyio backend is imported to avoid it being imported in the event loop
Expand Down Expand Up @@ -407,6 +407,10 @@ def _init_blocking_io_modules_in_executor() -> None:
# Initialize the mimetypes module to avoid blocking calls
# to the filesystem to load the mime.types file.
mimetypes.init()
# Initialize is_official_image and is_docker_env to avoid blocking calls
# to the filesystem.
is_official_image()
is_docker_env()


async def async_load_base_functionality(hass: core.HomeAssistant) -> None:
Expand Down
22 changes: 21 additions & 1 deletion homeassistant/components/amberelectric/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,18 @@ def extra_state_attributes(self) -> dict[str, Any]:
}


class AmberDemandWindowBinarySensor(AmberPriceGridSensor):
"""Sensor to show whether demand window is active."""

@property
def is_on(self) -> bool | None:
"""Return true if the binary sensor is on."""
grid = self.coordinator.data["grid"]
if "demand_window" in grid:
return grid["demand_window"] # type: ignore[no-any-return]
return None


async def async_setup_entry(
hass: HomeAssistant,
entry: ConfigEntry,
Expand All @@ -83,6 +95,14 @@ async def async_setup_entry(
key="price_spike",
name=f"{entry.title} - Price Spike",
)
demand_window_description = BinarySensorEntityDescription(
key="demand_window",
name=f"{entry.title} - Demand Window",
translation_key="demand_window",
)
async_add_entities(
[AmberPriceSpikeBinarySensor(coordinator, price_spike_description)]
[
AmberPriceSpikeBinarySensor(coordinator, price_spike_description),
AmberDemandWindowBinarySensor(coordinator, demand_window_description),
]
)
3 changes: 3 additions & 0 deletions homeassistant/components/amberelectric/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ def update_price_data(self) -> dict[str, dict[str, Any]]:
]
result["grid"]["renewables"] = round(general[0].renewables)
result["grid"]["price_spike"] = general[0].spike_status.value
tariff_information = general[0].tariff_information
if tariff_information:
result["grid"]["demand_window"] = tariff_information.demand_window

controlled_load = [
interval for interval in current if is_controlled_load(interval)
Expand Down
8 changes: 8 additions & 0 deletions homeassistant/components/amberelectric/icons.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@
"renewables": {
"default": "mdi:solar-power"
}
},
"binary_sensor": {
"demand_window": {
"default": "mdi:meter-electric",
"state": {
"off": "mdi:meter-electric-outline"
}
}
}
}
}
2 changes: 1 addition & 1 deletion homeassistant/components/anova/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
"documentation": "https://www.home-assistant.io/integrations/anova",
"iot_class": "cloud_push",
"loggers": ["anova_wifi"],
"requirements": ["anova-wifi==0.14.0"]
"requirements": ["anova-wifi==0.17.0"]
}
1 change: 1 addition & 0 deletions homeassistant/components/aprilaire/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

PLATFORMS: list[Platform] = [
Platform.CLIMATE,
Platform.HUMIDIFIER,
Platform.SELECT,
Platform.SENSOR,
]
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/aprilaire/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ async def ready_callback(ready: bool):

self._abort_if_unique_id_configured()

return self.async_create_entry(title="Aprilaire", data=user_input)
return self.async_create_entry(title="AprilAire", data=user_input)

return self.async_show_form(
step_id="user",
Expand Down
Loading

0 comments on commit 1a0b281

Please sign in to comment.