From 0b5f0b2b1463313f1616f66313791eb7734187ec Mon Sep 17 00:00:00 2001 From: Mick Vleeshouwer Date: Sun, 7 Jan 2024 15:05:03 +0100 Subject: [PATCH 01/16] Update devcontainer --- .devcontainer/README.md | 17 +++++++++ .devcontainer/configuration.yaml | 3 ++ .devcontainer/devcontainer.json | 65 +++++++++++++++----------------- .vscode/launch.json | 15 ++++++++ .vscode/tasks.json | 22 +---------- scripts/run | 20 ++++++++++ 6 files changed, 88 insertions(+), 54 deletions(-) create mode 100644 .vscode/launch.json create mode 100644 scripts/run diff --git a/.devcontainer/README.md b/.devcontainer/README.md index 60458f6..e52fdf3 100644 --- a/.devcontainer/README.md +++ b/.devcontainer/README.md @@ -41,3 +41,20 @@ Run Home Assistant on port 9123 | Launch Home Assistant with your custom compone Run Home Assistant configuration against /config | Check the configuration. Upgrade Home Assistant to latest dev | Upgrade the Home Assistant core version in the container to the latest version of the `dev` branch. Install a specific version of Home Assistant | Install a specific version of Home Assistant core in the container. + +### Step by Step debugging + +With the development container, +you can test your custom component in Home Assistant with step by step debugging. + +You need to modify the `configuration.yaml` file in `.devcontainer` folder +by uncommenting the line: + +```yaml +# debugpy: +``` + +Then launch the task `Run Home Assistant on port 9123`, and launch the debugger +with the existing debugging configuration `Python: Attach Local`. + +For more information, look at [the Remote Python Debugger integration documentation](https://www.home-assistant.io/integrations/debugpy/). \ No newline at end of file diff --git a/.devcontainer/configuration.yaml b/.devcontainer/configuration.yaml index 7af7f06..9ff9d4b 100644 --- a/.devcontainer/configuration.yaml +++ b/.devcontainer/configuration.yaml @@ -4,3 +4,6 @@ logger: default: error logs: custom_components.sagemcom_fast: debug + +# If you need to debug uncomment the line below (doc: https://www.home-assistant.io/integrations/debugpy/) +# debugpy: diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 0bdbaad..33278f9 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,39 +1,36 @@ // See https://aka.ms/vscode-remote/devcontainer.json for format details. { - "image": "ghcr.io/ludeeus/devcontainer/integration:latest", + "image": "mcr.microsoft.com/devcontainers/python:1-3.11-bullseye", "name": "ha-sagemcom-fast", - "context": "..", - "appPort": [ - "8123:8123" - ], - "postCreateCommand": "container install && pip install -r requirements_dev.txt && pre-commit install && pre-commit install-hooks", - "extensions": [ - "ms-python.python", - "github.vscode-pull-request-github", - "github.copilot", - "ms-python.vscode-pylance" - ], - "settings": { - "files.eol": "\n", - "editor.tabSize": 4, - "terminal.integrated.defaultProfile.linux": "bash", - "terminal.integrated.profiles.linux": { - "zsh": { - "path": "/bin/bash" - } - }, - "python.analysis.autoSearchPaths": false, - "python.linting.pylintEnabled": true, - "python.linting.enabled": true, - "python.linting.pylintArgs": [ - "--disable", - "import-error" - ], - "python.formatting.provider": "black", - "editor.formatOnPaste": false, - "editor.formatOnSave": true, - "editor.formatOnType": true, - "files.trimTrailingWhitespace": true, - "python.linting.mypyEnabled": true, + "forwardPorts": [8123], + "portsAttributes": { + "8123": { + "label": "Home Assistant", + "onAutoForward": "openBrowserOnce" + } + }, + "postCreateCommand": "pip install -r requirements_dev.txt && pre-commit install && pre-commit install-hooks", + "containerEnv": { + "DEVCONTAINER": "1" + }, + "remoteUser": "vscode", + "customizations": { + "vscode": { + "extensions": [ + "ms-python.vscode-pylance", + "ms-python.python", + "redhat.vscode-yaml", + "esbenp.prettier-vscode", + "GitHub.vscode-pull-request-github", + "GitHub.copilot" + ], + "settings": { + "python.pythonPath": "/usr/local/bin/python", + "editor.formatOnPaste": false, + "editor.formatOnSave": true, + "editor.formatOnType": true, + "files.trimTrailingWhitespace": true + } + } } } \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..7af76d8 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,15 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Home Assistant with Sagemcom Fast", + "type": "python", + "request": "launch", + "python": "/usr/local/bin/python", + "module": "homeassistant", + "cwd": "${workspaceFolder}", + "justMyCode": false, + "args": ["--debug", "-c", "config"] + } + ] +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 7ab4ba8..3e2ff12 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -2,27 +2,9 @@ "version": "2.0.0", "tasks": [ { - "label": "Run Home Assistant on port 9123", + "label": "Run Home Assistant on port 8123", "type": "shell", - "command": "container start", - "problemMatcher": [] - }, - { - "label": "Run Home Assistant configuration against /config", - "type": "shell", - "command": "container check", - "problemMatcher": [] - }, - { - "label": "Upgrade Home Assistant to latest dev", - "type": "shell", - "command": "container install", - "problemMatcher": [] - }, - { - "label": "Install a specific version of Home Assistant", - "type": "shell", - "command": "container set-version", + "command": "bash scripts/run", "problemMatcher": [] } ] diff --git a/scripts/run b/scripts/run new file mode 100644 index 0000000..20366e8 --- /dev/null +++ b/scripts/run @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +set -e + +cd "$(dirname "$0")/.." + +# Create config dir if not present +if [[ ! -d "${PWD}/config" ]]; then + mkdir -p "${PWD}/config" + hass --config "${PWD}/config" --script ensure_config +fi + +# Set the path to custom_components +## This let's us have the structure we want /custom_components/integration_blueprint +## while at the same time have Home Assistant configuration inside /config +## without resulting to symlinks. +export PYTHONPATH="${PYTHONPATH}:${PWD}/custom_components" + +# Start Home Assistant +hass --config "${PWD}/config" --debug \ No newline at end of file From efb4e036bb66d5ed4d0aa202eed607b97cf98f97 Mon Sep 17 00:00:00 2001 From: Mick Vleeshouwer Date: Sun, 7 Jan 2024 15:08:10 +0100 Subject: [PATCH 02/16] Update requirements --- requirements_dev.txt | 4 ++-- requirements_test.txt | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/requirements_dev.txt b/requirements_dev.txt index 9fc4c8c..b81de54 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -1,4 +1,4 @@ -r requirements.txt -homeassistant==2022.3.3 -pre-commit==2.5.0 \ No newline at end of file +homeassistant==2023.8.2 +pre-commit \ No newline at end of file diff --git a/requirements_test.txt b/requirements_test.txt index b66ed17..509105c 100644 --- a/requirements_test.txt +++ b/requirements_test.txt @@ -1,5 +1,6 @@ -r requirements_dev.txt -pytest==7.0.1 -pytest-homeassistant-custom-component==0.7.2 # 2022.3.3 +pytest==7.3.1 +pytest-socket==0.6.0 +pytest-homeassistant-custom-component==0.13.51 # 2023.8.2 pytest-timeout==2.1.0 \ No newline at end of file From 86fb1a223f44b4adb49218a97a9b7e73b6f52eab Mon Sep 17 00:00:00 2001 From: Mick Date: Sun, 7 Jan 2024 14:20:16 +0000 Subject: [PATCH 03/16] Update pre-commit --- .pre-commit-config.yaml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 685e82b..c7d2431 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,11 +1,11 @@ repos: - repo: https://github.com/asottile/pyupgrade - rev: v2.7.2 + rev: v2.31.1 hooks: - id: pyupgrade args: [--py37-plus] - repo: https://github.com/psf/black - rev: 20.8b1 + rev: 22.3.0 hooks: - id: black args: @@ -13,7 +13,7 @@ repos: - --quiet files: ^((custom_components)/.+)?[^/]+\.py$ - repo: https://github.com/codespell-project/codespell - rev: v1.17.1 + rev: v2.1.0 hooks: - id: codespell args: @@ -21,8 +21,8 @@ repos: - --skip="./.*,*.csv,*.json,*.md" - --quiet-level=2 exclude_types: [csv, json] - - repo: https://gitlab.com/pycqa/flake8 - rev: 3.8.4 + - repo: https://github.com/PyCQA/flake8 + rev: 3.9.2 hooks: - id: flake8 additional_dependencies: @@ -30,10 +30,10 @@ repos: - pydocstyle==5.1.1 files: ^(custom_components)/.+\.py$ - repo: https://github.com/PyCQA/isort - rev: 5.5.3 + rev: 5.12.0 hooks: - id: isort - repo: https://github.com/adrienverge/yamllint.git - rev: v1.24.2 + rev: v1.26.3 hooks: - - id: yamllint + - id: yamllint \ No newline at end of file From e8b4d2af398302ebb6905693d8d4d8bdcf8ae560 Mon Sep 17 00:00:00 2001 From: Mick Date: Sun, 7 Jan 2024 16:28:45 +0000 Subject: [PATCH 04/16] Update gitignore --- .gitignore | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 5a725e4..cfdf845 100644 --- a/.gitignore +++ b/.gitignore @@ -131,7 +131,9 @@ dmypy.json # Pyre type checker .pyre/ -# HA Config directory for local testing -/Config/ - **/.DS_Store + +# DevContainer +config +!.vscode/tasks.json +!.vscode/launch.json \ No newline at end of file From 63d473104af81689ef71e3001305f22abb42acba Mon Sep 17 00:00:00 2001 From: Mick Date: Sun, 7 Jan 2024 16:29:00 +0000 Subject: [PATCH 05/16] Bump api version --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 5a0403f..88c06b9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1 @@ -sagemcom_api==1.0.8 \ No newline at end of file +sagemcom_api==1.1.0 \ No newline at end of file From 185fc7ec6d77fc8a113d46e68c6aeeb9b18142e8 Mon Sep 17 00:00:00 2001 From: Mick Date: Sun, 7 Jan 2024 16:29:10 +0000 Subject: [PATCH 06/16] Bump api version --- custom_components/sagemcom_fast/manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/custom_components/sagemcom_fast/manifest.json b/custom_components/sagemcom_fast/manifest.json index c0ee6ed..c05a696 100644 --- a/custom_components/sagemcom_fast/manifest.json +++ b/custom_components/sagemcom_fast/manifest.json @@ -6,7 +6,7 @@ "documentation": "https://github.com/imicknl/ha-sagemcom-fast", "issue_tracker": "https://github.com/imicknl/ha-sagemcom-fast/issues", "requirements": [ - "sagemcom_api===1.0.8" + "sagemcom_api===1.1.0" ], "ssdp": [ { From c34e92eebdae91ef633409b5c7b3bb8ce14f8d1a Mon Sep 17 00:00:00 2001 From: Mick Date: Sun, 7 Jan 2024 16:38:02 +0000 Subject: [PATCH 07/16] Update HACS.json --- hacs.json | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/hacs.json b/hacs.json index bd0b719..fc2d145 100644 --- a/hacs.json +++ b/hacs.json @@ -1,7 +1,6 @@ { "name": "Sagemcom F@st", "domains": ["device_tracker", "sensor"], - "homeassistant": "0.115.0", - "render_readme": "true", - "iot_class": "Local Polling" + "homeassistant": "2023.8.2", + "render_readme": true } \ No newline at end of file From 159d86645c88a452943d30204dac0e0cfd73dfdd Mon Sep 17 00:00:00 2001 From: Mick Date: Sun, 7 Jan 2024 16:57:48 +0000 Subject: [PATCH 08/16] Style fix and devcontainer --- .devcontainer/devcontainer.json | 2 +- hacs.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 33278f9..86bcdfb 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,6 +1,6 @@ // See https://aka.ms/vscode-remote/devcontainer.json for format details. { - "image": "mcr.microsoft.com/devcontainers/python:1-3.11-bullseye", + "image": "mcr.microsoft.com/vscode/devcontainers/python:0-3.11", "name": "ha-sagemcom-fast", "forwardPorts": [8123], "portsAttributes": { diff --git a/hacs.json b/hacs.json index fc2d145..e6f4a03 100644 --- a/hacs.json +++ b/hacs.json @@ -3,4 +3,4 @@ "domains": ["device_tracker", "sensor"], "homeassistant": "2023.8.2", "render_readme": true - } \ No newline at end of file +} \ No newline at end of file From 29d6c5ae361d2286e6c3c92be42767945082940e Mon Sep 17 00:00:00 2001 From: Mick Date: Sun, 7 Jan 2024 17:38:47 +0000 Subject: [PATCH 09/16] Bump requirements --- .devcontainer/devcontainer.json | 2 +- README.md | 8 ++++---- hacs.json | 2 +- requirements_dev.txt | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 86bcdfb..33278f9 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,6 +1,6 @@ // See https://aka.ms/vscode-remote/devcontainer.json for format details. { - "image": "mcr.microsoft.com/vscode/devcontainers/python:0-3.11", + "image": "mcr.microsoft.com/devcontainers/python:1-3.11-bullseye", "name": "ha-sagemcom-fast", "forwardPorts": [8123], "portsAttributes": { diff --git a/README.md b/README.md index ea6cb5e..eb07dc1 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,3 @@ - ![screenshot of a device detail page in Home Assistant](https://raw.githubusercontent.com/iMicknl/ha-sagemcom-fast/master/media/sagemcom_fast_device_page.png) [![GitHub release](https://img.shields.io/github/release/iMicknl/ha-sagemcom-fast.svg)](https://github.com/iMicknl/ha-sagemcom-fast/releases/) [![HA integration usage](https://img.shields.io/badge/dynamic/json?color=41BDF5&logo=home-assistant&label=integration%20usage&suffix=%20installs&cacheSeconds=15600&url=https://analytics.home-assistant.io/custom_integrations.json&query=$.sagemcom_fast.total)](https://analytics.home-assistant.io/custom_integrations.json) @@ -10,11 +9,13 @@ This integration adds support for Sagemcom F@st routers to Home Assistant. Curre Sagemcom F@st routers are used by many providers worldwide, but many of them did rebrand the router. Examples are the b-box from Proximus, Home Hub from bell and the Smart Hub from BT. ## Installation + ### Manual Copy the `custom_components/sagemcom_fast` to your `custom_components` folder. Reboot Home Assistant and install the Sagemcom F@st integration via the integrations config flow. ### HACS + Add this repository as a custom repository to HACS as described [here](https://hacs.xyz/docs/faq/custom_repositories), search for the `Sagemcom F@st` integration and choose install. Reboot Home Assistant and install the Sagemcom F@st integration via the integrations config flow. ``` @@ -23,7 +24,7 @@ https://github.com/imicknl/ha-sagemcom-fast ## Usage -This integration can only be confgured via the Config Flow. Go to `Configuration -> Integrations -> Add Integration` and choose Sagemcom F@st. The prompt will ask you for your credentials. Please note that some routers require authentication, where others can login with `guest` username and an empty password. +This integration can only be configured via the Config Flow. Go to `Configuration -> Integrations -> Add Integration` and choose Sagemcom F@st. The prompt will ask you for your credentials. Please note that some routers require authentication, where others can login with `guest` username and an empty password. The encryption method differs per device. Please refer to the table below to understand which option to select. If your device is not listed, please try both methods one by one. @@ -32,7 +33,7 @@ The encryption method differs per device. Please refer to the table below to und Have a look at the table below for more information about supported devices. | Router Model | Provider(s) | Authentication Method | Comments | -|-----------------------|----------------------|-----------------------|-------------------------------| +| --------------------- | -------------------- | --------------------- | ----------------------------- | | Sagemcom F@st 3864 | Optus | sha512 | username: guest, password: "" | | Sagemcom F@st 3865b | Proximus (b-box3) | md5 | | | Sagemcom F@st 3890V3 | Delta / Zeelandnet | md5 | | @@ -62,7 +63,6 @@ logger: custom_components.sagemcom_fast: debug ``` - ### Device not supported / working correctly If you are not able to use this integration with your Sagemcom F@st device, please create [an issue](https://github.com/iMicknl/ha-sagemcom-fast/issues/new) with as much information as possible. Turn on debug logging and share the logs in your issue description. diff --git a/hacs.json b/hacs.json index e6f4a03..ef467fc 100644 --- a/hacs.json +++ b/hacs.json @@ -1,6 +1,6 @@ { "name": "Sagemcom F@st", "domains": ["device_tracker", "sensor"], - "homeassistant": "2023.8.2", + "homeassistant": "2024.1.2", "render_readme": true } \ No newline at end of file diff --git a/requirements_dev.txt b/requirements_dev.txt index b81de54..b266e5c 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -1,4 +1,4 @@ -r requirements.txt -homeassistant==2023.8.2 +homeassistant==2024.1.2 pre-commit \ No newline at end of file From 6f1fa87fd144e805d4781fa8651171941ce86ab5 Mon Sep 17 00:00:00 2001 From: Mick Date: Sun, 7 Jan 2024 17:40:23 +0000 Subject: [PATCH 10/16] Use SourceType enum --- custom_components/sagemcom_fast/device_tracker.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/custom_components/sagemcom_fast/device_tracker.py b/custom_components/sagemcom_fast/device_tracker.py index 47e9b4e..1305f43 100644 --- a/custom_components/sagemcom_fast/device_tracker.py +++ b/custom_components/sagemcom_fast/device_tracker.py @@ -5,7 +5,7 @@ from typing import Any, Dict, Optional import async_timeout -from homeassistant.components.device_tracker import SOURCE_TYPE_ROUTER +from homeassistant.components.device_tracker import SourceType from homeassistant.components.device_tracker.config_entry import ScannerEntity from homeassistant.core import HomeAssistant from homeassistant.helpers.restore_state import RestoreEntity @@ -107,7 +107,7 @@ def unique_id(self) -> str: @property def source_type(self) -> str: """Return the source type, eg gps or router, of the device.""" - return SOURCE_TYPE_ROUTER + return SourceType.ROUTER @property def is_connected(self) -> bool: From 2c4f0fa6120fb3174b8f6e026096c1632e41aa55 Mon Sep 17 00:00:00 2001 From: Mick Date: Sun, 7 Jan 2024 17:43:38 +0000 Subject: [PATCH 11/16] Remove domains --- hacs.json | 1 - 1 file changed, 1 deletion(-) diff --git a/hacs.json b/hacs.json index ef467fc..971aa28 100644 --- a/hacs.json +++ b/hacs.json @@ -1,6 +1,5 @@ { "name": "Sagemcom F@st", - "domains": ["device_tracker", "sensor"], "homeassistant": "2024.1.2", "render_readme": true } \ No newline at end of file From aba28714ac8960e7ef7b506f2bde42e7843bf17f Mon Sep 17 00:00:00 2001 From: Mick Date: Sun, 7 Jan 2024 17:46:03 +0000 Subject: [PATCH 12/16] Bump test framework to 3.11/3.12 --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3232e35..55df554 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.9", "3.10"] + python-version: ["3.11", "3.12"] steps: - uses: actions/checkout@v2 - name: Set up Python From 557c578a536903514f47f164ab8e11f03d6942aa Mon Sep 17 00:00:00 2001 From: Mick Date: Sun, 7 Jan 2024 17:51:11 +0000 Subject: [PATCH 13/16] Remove testing and more --- .github/CODEOWNERS | 1 - .github/FUNDING.yml | 1 + .github/dependabot.yml | 15 +++++++++ .github/workflows/matchers/python.json | 18 ----------- .github/workflows/release-drafter.yml | 2 +- .github/workflows/test.yml | 43 -------------------------- README.md | 2 +- requirements_test.txt | 6 ---- 8 files changed, 18 insertions(+), 70 deletions(-) create mode 100644 .github/FUNDING.yml create mode 100644 .github/dependabot.yml delete mode 100644 .github/workflows/matchers/python.json delete mode 100644 .github/workflows/test.yml delete mode 100644 requirements_test.txt diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index b9b7614..9033f3e 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,2 +1 @@ * @iMicknl -* @arunpoudel \ No newline at end of file diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..8209473 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1 @@ +custom: ["https://paypal.me/imick"] diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..a782f40 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,15 @@ +version: 2 +updates: + - package-ecosystem: pip + directory: "/" + schedule: + interval: "daily" + time: "08:00" + open-pull-requests-limit: 10 + + - package-ecosystem: github-actions + directory: "/" + schedule: + interval: "daily" + time: "08:00" + open-pull-requests-limit: 10 diff --git a/.github/workflows/matchers/python.json b/.github/workflows/matchers/python.json deleted file mode 100644 index 1052a1c..0000000 --- a/.github/workflows/matchers/python.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "problemMatcher": [ - { - "owner": "python", - "pattern": [ - { - "regexp": "^\\s*File\\s\\\"(.*)\\\",\\sline\\s(\\d+),\\sin\\s(.*)$", - "file": 1, - "line": 2 - }, - { - "regexp": "^\\s*raise\\s(.*)\\(\\'(.*)\\'\\)$", - "message": 2 - } - ] - } - ] -} \ No newline at end of file diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml index e260e45..a0683aa 100644 --- a/.github/workflows/release-drafter.yml +++ b/.github/workflows/release-drafter.yml @@ -3,7 +3,7 @@ name: Release Drafter on: push: branches: - - master + - main jobs: update_release_draft: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index 55df554..0000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,43 +0,0 @@ -name: Test (pytest) - -on: - pull_request: - -jobs: - test: - runs-on: ubuntu-latest - strategy: - matrix: - python-version: ["3.11", "3.12"] - steps: - - uses: actions/checkout@v2 - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install -r requirements_test.txt - - name: Register Python problem matcher - run: | - echo "::add-matcher::.github/workflows/matchers/python.json" - # - name: Install Pytest Annotation plugin - # run: | - # # Ideally this should be part of our dependencies - # # However this plugin is fairly new and doesn't run correctly - # # on a non-GitHub environment. - # pip install pytest-github-actions-annotate-failures - # - name: Test with pytest - # run: | - # pytest \ - # --cov custom_components/sagemcom_fast \ - # --cov-report=xml --cov-report=html \ - # -o console_output_style=count \ - # -p no:sugar \ - # tests - # - name: Upload coverage artifact - # uses: actions/upload-artifact@v2.1.3 - # with: - # name: coverage-${{ matrix.python-version }} - # path: htmlcov diff --git a/README.md b/README.md index eb07dc1..a2d131f 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -![screenshot of a device detail page in Home Assistant](https://raw.githubusercontent.com/iMicknl/ha-sagemcom-fast/master/media/sagemcom_fast_device_page.png) +![screenshot of a device detail page in Home Assistant](https://raw.githubusercontent.com/iMicknl/ha-sagemcom-fast/main/media/sagemcom_fast_device_page.png) [![GitHub release](https://img.shields.io/github/release/iMicknl/ha-sagemcom-fast.svg)](https://github.com/iMicknl/ha-sagemcom-fast/releases/) [![HA integration usage](https://img.shields.io/badge/dynamic/json?color=41BDF5&logo=home-assistant&label=integration%20usage&suffix=%20installs&cacheSeconds=15600&url=https://analytics.home-assistant.io/custom_integrations.json&query=$.sagemcom_fast.total)](https://analytics.home-assistant.io/custom_integrations.json) diff --git a/requirements_test.txt b/requirements_test.txt deleted file mode 100644 index 509105c..0000000 --- a/requirements_test.txt +++ /dev/null @@ -1,6 +0,0 @@ --r requirements_dev.txt - -pytest==7.3.1 -pytest-socket==0.6.0 -pytest-homeassistant-custom-component==0.13.51 # 2023.8.2 -pytest-timeout==2.1.0 \ No newline at end of file From f0a15f1f114a87d9ac8a9cc968f921093856461e Mon Sep 17 00:00:00 2001 From: Mick Date: Sun, 7 Jan 2024 17:54:54 +0000 Subject: [PATCH 14/16] Sort alphabetically --- custom_components/sagemcom_fast/manifest.json | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/custom_components/sagemcom_fast/manifest.json b/custom_components/sagemcom_fast/manifest.json index c05a696..2524d35 100644 --- a/custom_components/sagemcom_fast/manifest.json +++ b/custom_components/sagemcom_fast/manifest.json @@ -1,12 +1,16 @@ { "domain": "sagemcom_fast", "name": "Sagemcom F@st", - "version": "0.2.9", + "codeowners": [ + "@imicknl", + "@arunpoudel" + ], "config_flow": true, "documentation": "https://github.com/imicknl/ha-sagemcom-fast", + "iot_class": "local_polling", "issue_tracker": "https://github.com/imicknl/ha-sagemcom-fast/issues", "requirements": [ - "sagemcom_api===1.1.0" + "sagemcom_api==1.1.0" ], "ssdp": [ { @@ -18,9 +22,5 @@ "manufacturer": "Sagemcom Broadband SAS" } ], - "codeowners": [ - "@imicknl", - "@arunpoudel" - ], - "iot_class": "local_polling" + "version": "0.2.9" } From d7a515770c7c2b17001bebf7cdb2fb31992d3a6f Mon Sep 17 00:00:00 2001 From: Mick Date: Sun, 7 Jan 2024 18:16:41 +0000 Subject: [PATCH 15/16] Fix yamllint --- .pre-commit-config.yaml | 2 +- .yamllint | 61 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 .yamllint diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c7d2431..04c8674 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -36,4 +36,4 @@ repos: - repo: https://github.com/adrienverge/yamllint.git rev: v1.26.3 hooks: - - id: yamllint \ No newline at end of file + - id: yamllint diff --git a/.yamllint b/.yamllint new file mode 100644 index 0000000..f7cd7c6 --- /dev/null +++ b/.yamllint @@ -0,0 +1,61 @@ +ignore: | + .github +rules: + braces: + level: error + min-spaces-inside: 0 + max-spaces-inside: 1 + min-spaces-inside-empty: -1 + max-spaces-inside-empty: -1 + brackets: + level: error + min-spaces-inside: 0 + max-spaces-inside: 0 + min-spaces-inside-empty: -1 + max-spaces-inside-empty: -1 + colons: + level: error + max-spaces-before: 0 + max-spaces-after: 1 + commas: + level: error + max-spaces-before: 0 + min-spaces-after: 1 + max-spaces-after: 1 + comments: + level: error + require-starting-space: true + min-spaces-from-content: 2 + comments-indentation: + level: error + document-end: + level: error + present: false + document-start: + level: error + present: false + empty-lines: + level: error + max: 1 + max-start: 0 + max-end: 1 + hyphens: + level: error + max-spaces-after: 1 + indentation: + level: error + spaces: 2 + indent-sequences: true + check-multi-line-strings: false + key-duplicates: + level: error + line-length: disable + new-line-at-end-of-file: + level: error + new-lines: + level: error + type: unix + trailing-spaces: + level: error + truthy: + level: warning From 217d9efc564648b254dc3beea0fb75ebec8ddd93 Mon Sep 17 00:00:00 2001 From: Mick Date: Sun, 7 Jan 2024 18:19:21 +0000 Subject: [PATCH 16/16] Update CI/CD --- .github/workflows/linters.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/linters.yml b/.github/workflows/linters.yml index f6d86ed..b946465 100644 --- a/.github/workflows/linters.yml +++ b/.github/workflows/linters.yml @@ -7,6 +7,6 @@ jobs: lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 - - uses: pre-commit/action@v2.0.0 + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + - uses: pre-commit/action@v3.0.0