diff --git a/.github/workflows/auto-merge.yaml b/.github/workflows/auto-merge.yaml new file mode 100644 index 0000000..06f23ef --- /dev/null +++ b/.github/workflows/auto-merge.yaml @@ -0,0 +1,5 @@ +steps: + - uses: actions/checkout@v2 + - uses: ahmadnassri/action-dependabot-auto-merge@v2 + with: + github-token: ${{ secrets.mytoken }} \ No newline at end of file diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 511f9f0..73216e1 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,32 +1,8 @@ repos: - - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v3.3.0 + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.5.1 hooks: - - id: check-added-large-files - - id: check-yaml - - id: end-of-file-fixer - - id: trailing-whitespace - - repo: local - hooks: - - id: black - name: black - entry: black - language: system - types: [python] - require_serial: true - - id: flake8 - name: flake8 - entry: flake8 - language: system - types: [python] - require_serial: true - - id: reorder-python-imports - name: Reorder python imports - entry: reorder-python-imports - language: system - types: [python] - args: [--application-directories=custom_components] - - repo: https://github.com/pre-commit/mirrors-prettier - rev: v2.2.1 - hooks: - - id: prettier + - id: ruff + args: + - --fix + - id: ruff-format diff --git a/custom_components/southern_company/__init__.py b/custom_components/southern_company/__init__.py index 17200ea..50dbf8f 100644 --- a/custom_components/southern_company/__init__.py +++ b/custom_components/southern_company/__init__.py @@ -1,4 +1,5 @@ """The Southern Company integration.""" + from __future__ import annotations from homeassistant.config_entries import ConfigEntry diff --git a/custom_components/southern_company/config_flow.py b/custom_components/southern_company/config_flow.py index 1e55d4e..83acf6d 100644 --- a/custom_components/southern_company/config_flow.py +++ b/custom_components/southern_company/config_flow.py @@ -1,4 +1,5 @@ """Config flow for Southern Company integration.""" + from __future__ import annotations import logging diff --git a/custom_components/southern_company/coordinator.py b/custom_components/southern_company/coordinator.py index d17e8a7..74592a1 100644 --- a/custom_components/southern_company/coordinator.py +++ b/custom_components/southern_company/coordinator.py @@ -1,4 +1,5 @@ """Coordinator to handle southern Company connections.""" + import datetime import logging from datetime import timedelta diff --git a/custom_components/southern_company/sensor.py b/custom_components/southern_company/sensor.py index 4ec7394..becd5d1 100644 --- a/custom_components/southern_company/sensor.py +++ b/custom_components/southern_company/sensor.py @@ -1,4 +1,5 @@ """Support for Southern Company sensors.""" + from __future__ import annotations from collections.abc import Callable diff --git a/custom_components/southern_company_hacs/__init__.py b/custom_components/southern_company_hacs/__init__.py deleted file mode 100644 index 90a5854..0000000 --- a/custom_components/southern_company_hacs/__init__.py +++ /dev/null @@ -1,37 +0,0 @@ -"""The Southern Company integration.""" -from __future__ import annotations - -from homeassistant.config_entries import ConfigEntry, ConfigEntryChange -from homeassistant.const import CONF_PASSWORD -from homeassistant.const import CONF_USERNAME -from homeassistant.const import Platform -from homeassistant.core import HomeAssistant - -from .const import DOMAIN -import logging -PLATFORMS = [Platform.SENSOR] - -_LOGGER = logging.getLogger(__name__) - -async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: - """Set up Southern Company from a config entry.""" - _LOGGER.error("PLease set up with Southern Company instead of Southern Company HACS") - return False - - -async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: - """Unload a config entry.""" - if unload_ok := await hass.config_entries.async_unload_platforms(entry, PLATFORMS): - hass.data[DOMAIN].pop(entry.entry_id) - - return unload_ok - -async def async_migrate_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: - """""" - entry.domain = "southern_company" - hass.config_entries.async_update_entry( - entry, - ) - hass.config_entries._async_schedule_save() - hass.config_entries._async_dispatch(ConfigEntryChange.UPDATED, entry) - return True diff --git a/custom_components/southern_company_hacs/config_flow.py b/custom_components/southern_company_hacs/config_flow.py deleted file mode 100644 index 3738ebd..0000000 --- a/custom_components/southern_company_hacs/config_flow.py +++ /dev/null @@ -1,44 +0,0 @@ -"""Config flow for Southern Company integration.""" -from __future__ import annotations - -import logging -from collections.abc import Mapping -from typing import Any - -import voluptuous as vol -from homeassistant import config_entries -from homeassistant.const import CONF_PASSWORD -from homeassistant.const import CONF_USERNAME -from homeassistant.data_entry_flow import FlowResult -from homeassistant.helpers import aiohttp_client -from southern_company_api.parser import CantReachSouthernCompany -from southern_company_api.parser import InvalidLogin -from southern_company_api.parser import SouthernCompanyAPI - -from .const import DOMAIN - -_LOGGER = logging.getLogger(__name__) - -STEP_USER_DATA_SCHEMA = vol.Schema( - { - vol.Required(CONF_USERNAME): str, - vol.Required(CONF_PASSWORD): str, - } -) - - -class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): - """Handle a config flow for Southern Company.""" - - VERSION = 2 - - async def async_step_user( - self, user_input: dict[str, Any] | None = None - ) -> FlowResult: - """Handle the initial step.""" - _LOGGER.debug("Added user step") - errors: dict[str, str] = {} - errors["base"] = "unused" - return self.async_show_form( - step_id="user", data_schema=STEP_USER_DATA_SCHEMA, errors=errors - ) diff --git a/custom_components/southern_company_hacs/const.py b/custom_components/southern_company_hacs/const.py deleted file mode 100644 index 1febdd8..0000000 --- a/custom_components/southern_company_hacs/const.py +++ /dev/null @@ -1,3 +0,0 @@ -"""Constants for the Southern Company integration.""" - -DOMAIN = "southern_company_hacs" diff --git a/custom_components/southern_company_hacs/manifest.json b/custom_components/southern_company_hacs/manifest.json deleted file mode 100644 index 732d69c..0000000 --- a/custom_components/southern_company_hacs/manifest.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "domain": "southern_company_hacs", - "name": "Southern Company", - "codeowners": ["@Lash-L"], - "config_flow": true, - "dependencies": ["recorder"], - "documentation": "https://github.com/Lash-L/southern-company-hacs", - "iot_class": "cloud_polling", - "issue_tracker": "https://github.com/Lash-L/southern-company-hacs/issues", - "requirements": ["southern-company-api==0.6.5"], - "version": "0.1.9" -} diff --git a/custom_components/southern_company_hacs/strings.json b/custom_components/southern_company_hacs/strings.json deleted file mode 100644 index c934366..0000000 --- a/custom_components/southern_company_hacs/strings.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "config": { - "step": { - "user": { - "data": { - "username": "[%key:common::config_flow::data::username%]", - "password": "[%key:common::config_flow::data::password%]" - } - } - }, - "error": { - "cannot_connect": "[%key:common::config_flow::error::cannot_connect%]", - "invalid_auth": "[%key:common::config_flow::error::invalid_auth%]", - "unknown": "[%key:common::config_flow::error::unknown%]" - }, - "abort": { - "already_configured": "[%key:common::config_flow::abort::already_configured_service%]" - } - } -} diff --git a/custom_components/southern_company_hacs/translations/en.json b/custom_components/southern_company_hacs/translations/en.json deleted file mode 100644 index 69f05dd..0000000 --- a/custom_components/southern_company_hacs/translations/en.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "config": { - "abort": { - "already_configured": "Service is already configured" - }, - "error": { - "unused": "Please do not use this version of the integration - use Southern Company instead" - }, - "step": { - "user": { - "data": { - "password": "Password", - "username": "Username" - } - } - } - } -}