Restore control4 integration (#124750)

* Revert "Disable control4 integration (#124746)"

This reverts commit 16dd6b1712.

* Restore control4 integration

reverts #124746 and updates the lib instead

changelog: https://github.com/lawtancool/pyControl4/compare/v1.1.0...v1.1.3

Note that there is no release yet, see https://github.com/lawtancool/pyControl4/pull/32

* Apply suggestions from code review
This commit is contained in:
J. Nick Koston
2024-08-27 19:54:28 -10:00
committed by GitHub
parent e720a14dc4
commit 42388450e1
11 changed files with 27 additions and 41 deletions

View File

@ -1,7 +1,5 @@
"""The Control4 integration."""
# mypy: ignore-errors
from __future__ import annotations
import json
@ -9,10 +7,10 @@ import logging
from typing import Any
from aiohttp import client_exceptions
from pyControl4.account import C4Account
from pyControl4.director import C4Director
from pyControl4.error_handling import BadCredentials
# from pyControl4.account import C4Account
# from pyControl4.director import C4Director
# from pyControl4.error_handling import BadCredentials
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import (
CONF_HOST,

View File

@ -1,17 +1,14 @@
"""Config flow for Control4 integration."""
# mypy: ignore-errors
from __future__ import annotations
import logging
from typing import Any
from aiohttp.client_exceptions import ClientError
# from pyControl4.account import C4Account
# from pyControl4.director import C4Director
# from pyControl4.error_handling import NotFound, Unauthorized
from pyControl4.account import C4Account
from pyControl4.director import C4Director
from pyControl4.error_handling import NotFound, Unauthorized
import voluptuous as vol
from homeassistant.config_entries import (

View File

@ -1,13 +1,13 @@
"""Provides data updates from the Control4 controller for platforms."""
# mypy: ignore-errors
from collections import defaultdict
import logging
from typing import Any
# from pyControl4.account import C4Account
# from pyControl4.director import C4Director
# from pyControl4.error_handling import BadToken
from pyControl4.account import C4Account
from pyControl4.director import C4Director
from pyControl4.error_handling import BadToken
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_TOKEN, CONF_USERNAME
from homeassistant.core import HomeAssistant

View File

@ -1,7 +1,5 @@
"""Platform for Control4 Lights."""
# mypy: ignore-errors
from __future__ import annotations
import asyncio
@ -9,8 +7,9 @@ from datetime import timedelta
import logging
from typing import Any
# from pyControl4.error_handling import C4Exception
# from pyControl4.light import C4Light
from pyControl4.error_handling import C4Exception
from pyControl4.light import C4Light
from homeassistant.components.light import (
ATTR_BRIGHTNESS,
ATTR_TRANSITION,

View File

@ -3,11 +3,10 @@
"name": "Control4",
"codeowners": ["@lawtancool"],
"config_flow": true,
"disabled": "This integration is disabled because it uses an old version of socketio.",
"documentation": "https://www.home-assistant.io/integrations/control4",
"iot_class": "local_polling",
"loggers": ["pyControl4"],
"requirements": ["pyControl4==1.1.0"],
"requirements": ["pyControl4==1.2.0"],
"ssdp": [
{
"st": "c4:director"

View File

@ -1,7 +1,5 @@
"""Platform for Control4 Rooms Media Players."""
# mypy: ignore-errors
from __future__ import annotations
from dataclasses import dataclass
@ -10,8 +8,9 @@ import enum
import logging
from typing import Any
# from pyControl4.error_handling import C4Exception
# from pyControl4.room import C4Room
from pyControl4.error_handling import C4Exception
from pyControl4.room import C4Room
from homeassistant.components.media_player import (
MediaPlayerDeviceClass,
MediaPlayerEntity,

View File

@ -1,5 +0,0 @@
extend = "../../../pyproject.toml"
lint.extend-ignore = [
"F821"
]

View File

@ -1685,6 +1685,9 @@ pyAtome==0.1.1
# homeassistant.components.hdmi_cec
pyCEC==0.5.2
# homeassistant.components.control4
pyControl4==1.2.0
# homeassistant.components.duotecno
pyDuotecno==2024.5.1

View File

@ -1368,6 +1368,9 @@ py-synologydsm-api==2.5.2
# homeassistant.components.hdmi_cec
pyCEC==0.5.2
# homeassistant.components.control4
pyControl4==1.2.0
# homeassistant.components.duotecno
pyDuotecno==2024.5.1

View File

@ -1,5 +0,0 @@
extend = "../../../pyproject.toml"
lint.extend-ignore = [
"F821"
]

View File

@ -1,13 +1,11 @@
"""Test the Control4 config flow."""
# mypy: ignore-errors
from unittest.mock import AsyncMock, patch
import pytest
from pyControl4.account import C4Account
from pyControl4.director import C4Director
from pyControl4.error_handling import Unauthorized
# from pyControl4.account import C4Account
# from pyControl4.director import C4Director
# from pyControl4.error_handling import Unauthorized
from homeassistant import config_entries
from homeassistant.components.control4.const import DEFAULT_SCAN_INTERVAL, DOMAIN
from homeassistant.const import (
@ -18,6 +16,7 @@ from homeassistant.const import (
)
from homeassistant.core import HomeAssistant
from homeassistant.data_entry_flow import FlowResultType
from tests.common import MockConfigEntry
@ -42,7 +41,6 @@ def _get_mock_c4_director():
return c4_director_mock
@pytest.skip(allow_module_level=True)
async def test_form(hass: HomeAssistant) -> None:
"""Test we get the form."""