Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 3.0.0 #708

Merged
merged 5 commits into from
Mar 6, 2024
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
2 changes: 2 additions & 0 deletions .devcontainer/configuration.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
default_config:

tapo:

logger:
default: info
logs:
Expand Down
6 changes: 5 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@
"editor.formatOnPaste": false,
"editor.formatOnSave": true,
"editor.formatOnType": true,
"files.trimTrailingWhitespace": true
"files.trimTrailingWhitespace": true,
"python.testing.pytestArgs": ["tests", "--no-cov"],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true,
"python.testing.pytestPath": "pytest"
}
}
}
Expand Down
15 changes: 0 additions & 15 deletions .github/workflows/release-drafter.yml

This file was deleted.

37 changes: 37 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Release

on:
workflow_dispatch:
push:
branches:
- main

jobs:
release:
name: "Release"
runs-on: "ubuntu-latest"

steps:
- name: Checkout repository
uses: actions/[email protected]
with:
fetch-depth: 0
persist-credentials: false
- name: Setup Node 20.x
uses: actions/[email protected]
with:
node-version: 20
- name: Semantic Release
uses: cycjimmy/[email protected]
with:
semantic_version: 23.0.2
branches: |
[ 'main' ]
extra_plugins: |
@semantic-release/[email protected]
@semantic-release/[email protected]
@semantic-release/[email protected]
@semantic-release/[email protected]
@semantic-release/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
54 changes: 45 additions & 9 deletions .github/workflows/validation.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,50 @@
name: Linting

on:
push:
branches:
- main
- master
- dev
pull_request:
types:
- opened
- edited
- synchronize
branches:
- main
- master
- dev
- next

env:
DEFAULT_PYTHON: 3.11

permissions:
pull-requests: write
statuses: write

jobs:
validate-pr-title:
name: Validate PR title
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
types: |
docs
refactor
chore
fix
feat
breaking
scopes: |
ci
core
requireScope: true
ignoreLabels: |
bot
subjectPattern: ^.+$
subjectPatternError: |
The subject "{subject}" found in the pull request title "{title}"
didn't match the configured pattern. Please ensure that the subject
doesn't start with an uppercase character.
wip: true
pre-commit:
runs-on: "ubuntu-latest"
name: Pre-commit
Expand Down Expand Up @@ -72,6 +101,13 @@ jobs:
--timeout=9 \
--durations=10 \
--cov-fail-under=40 \
-n auto \
--junitxml=pytest.xml \
--cov-report=term-missing:skip-covered \
--cov=app \
-p no:sugar \
tests/unit
tests/ | tee pytest-coverage.txt
- name: Pytest coverage comment
uses: MishaKav/pytest-coverage-comment@main
with:
pytest-coverage-path: ./pytest-coverage.txt
junitxml-path: ./pytest.xml
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,9 @@ pythonenv*
.coverage
venv
.venv

coverage_re/
pytest-coverage.txt
pytest.xml

.idea/
38 changes: 38 additions & 0 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"branches": ["main"],
"ci": true,
"tagFormat": "${version}",
"plugins": [
[
"@semantic-release/commit-analyzer",
{
"preset": "angular",
"releaseRules": [
{
"type": "breaking",
"release": "major"
},
{ "scope": "ci", "release": false }
]
}
],
"@semantic-release/release-notes-generator",
[
"@semantic-release/exec",
{
"publishCmd": "./bump-version.sh ${nextRelease.version}"
}
],
[
"@semantic-release/git",
{
"assets": [
"custom_components/tapo/const.py",
"custom_components/tapo/manifest.json"
],
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
}
],
"@semantic-release/github"
]
}
76 changes: 45 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Please help me to complete the [new roadmap](https://github.com/petretiandrea/ho

### Tapo protocol

Tapo is updating it's devices with a new firmware which use a new protocol called KLAP. This integration support it's but if you running older version your devices maybe cannot works. So please keep this integration up to date by using HACS!
Tapo is updating its devices with a new firmware which use a new protocol called KLAP. This integration support it's but if you running older version your devices maybe cannot works. So please keep this integration up to date by using HACS!

### Local Integration

Expand All @@ -34,10 +34,43 @@ For some unknown reason email with capital letter thrown an "Invalid authenticat

## Features

### Discovery

The integration now supports native tapo discovery! To enable it you must add at least one tapo device or this line to your tapo configuration file

```yaml
tapo:
discovery: true # you can omit "discovery" by default, with "tapo:" it will enable discovery automatically.
```

This will enable tapo device discovery. Not all tapo devices supports tapo discovery, so if you not find it, try adding manually.
Also tapo integration discovery filters out not supported devices!

<details>
<summary>Screenshot</summary>
![Discovery](./docs/discovery-devices.png)

</details>

You can disable integration discovery by editing `configuration.yaml` in the following way:

```yaml
tapo:
discovery: false
```

#### Device IP Tracking

By using DHCP home assistant discovery the feature of mac tracking is now disabled, cause HA can track it automatically now.
Please be sure to have DHCP discovery not disabled on your `configuration.yaml` (by default is active).

[BREAKING] Tracking mac address feature is now disabled cause not recommended by HA. The tracking is now performed by HA itself.

### Supported devices

- [x] pure async home assistant's method
- [x] support for tapo `H100` hub and siren, `H200`
- [x] support for tapo `H100` hub and siren
- [ ] support for tapo `H100` hub is currently Work In Progress!
- [x] support for `T31x` temperature and humidity sensor hub's device
- [x] support for `T100` motion sensor hub's device
- [x] support for `T110` smart door hub's device
Expand All @@ -57,37 +90,17 @@ For some unknown reason email with capital letter thrown an "Invalid authenticat

### Additional features

- [x] tracking of ip address. Cause Tapo local discovery isn't working for a lot of Tapo devices, this integration can try to track ip address changes by reling on MAC address.
This requires Home Assistant to runs on the same devices network and the capability to send ARP and broadcast packets.
- [x] manually change ip address. Now you can change the ip address of a tapo device wihtout removing and re-adding it.

# How to install

## Simplest and recomended way

This integration is part of HACS store, so you don't need anymore to add this repository as a custom repository.
You can find it directly on HACS Store: search for `tapo` and you will find `Tapo Controller`. (**HACS >= 1.6.0 is required**)

## Old way as a custom repository (not recomended, but use if you want to use beta versions)

1. Install from HACS, add this repository as custom repository
2. Search into HACS store the tapo integration and install
3. Full restart of home assistant is recomended

This video show installation steps:

[![Install Steps](http://img.youtube.com/vi/KSYldphgE5A/0.jpg)](https://youtu.be/KSYldphgE5A)

## "Manual" way

1. Using the tool of choice open the directory (folder) for your HA configuration (where you find `configuration.yaml`).
2. If you do not have a `custom_components` directory (folder) there, you need to create it.
3. In the `custom_components` directory (folder) create a new folder called `tapo`.
4. Download _all_ the files from the `custom_components/tapo/` directory (folder) in this repository.
5. Place the files you downloaded in the new directory (folder) you created.
6. Restart Home Assistant
7. In the HA UI go to "Configuration" -> "Integrations" click "+" and search for "tapo"

# How to add a Tapo device (after installing the integration)

## Using UI
Expand All @@ -102,17 +115,18 @@ This video show installation steps:

## Configuration by configuration.yaml

Domain can be `switch`, `light` or `sensor`.
[BREAKING]

An example with switch:
The latest version of this integration remove configuration.yaml device configuration support. This
is due to follow home assistant best practices https://developers.home-assistant.io/docs/configuration_yaml_index/ and https://github.com/home-assistant/architecture/blob/master/adr/0010-integration-configuration.md#decision

```yaml
switch:
platform: tapo
host: ...
username: ...
password: ...
```
## Beta versions

To access to beta version, you must install it as custom

1. Install from HACS, add this repository as custom repository
2. Search into HACS store the tapo integration and install
3. Full restart of home assistant is recommended

## Contributions are welcome!

Expand Down
4 changes: 0 additions & 4 deletions bump-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,4 @@ echo "Bumping const.py and manifest.json to version: $INTEGRATION_VERSION"
sed -i -E "s/VERSION = \"[0-9]+(\.[0-9]+)*\"/VERSION = \"$INTEGRATION_VERSION\"/g" custom_components/tapo/const.py
sed -i -E "s/\"version\": \"[0-9]+(\.[0-9]+)*\"/\"version\": \"$INTEGRATION_VERSION\"/gm" custom_components/tapo/manifest.json

git add custom_components/tapo/const.py
git add custom_components/tapo/manifest.json
git commit -m "bump version to $INTEGRATION_VERSION"

echo "Bump to version: $GIT_TAG_VERSION"
Loading
Loading