Skip to content

Commit cf0373f

Browse files
authored
Merge pull request #83 from sh00t2kill/develop
Replaced `store debug data` switch and the feature of storing debug data to `/config/.storage` with debug API
2 parents 35287f2 + 4fd4565 commit cf0373f

20 files changed

Lines changed: 364 additions & 212 deletions

File tree

.github/workflows/hassfest.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ jobs:
1212
validate:
1313
runs-on: "ubuntu-latest"
1414
steps:
15-
- uses: "actions/checkout@v2"
15+
- uses: "actions/checkout@v3.1.0"
1616
- uses: home-assistant/actions/hassfest@master

.github/workflows/pre-commit.yaml

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,26 +13,14 @@ jobs:
1313
runs-on: ubuntu-latest
1414
name: pre-commit
1515
steps:
16-
- uses: actions/checkout@v2.3.4
17-
- uses: actions/setup-python@v2.2.1
16+
- uses: actions/checkout@v3.1.0
17+
- uses: actions/setup-python@v4.3.0
1818
with:
1919
python-version: "3.10"
2020
- run: |
2121
pip install --constraint=.github/workflows/constraints.txt pip
2222
pip install --constraint=.github/workflows/constraints.txt pre-commit
23-
- name: Compute cache key prefix
24-
if: matrix.os != 'windows-latest'
25-
id: cache_key_prefix
26-
shell: python
27-
run: |
28-
import hashlib
29-
import sys
30-
python = "py{}.{}".format(*sys.version_info[:2])
31-
payload = sys.version.encode() + sys.executable.encode()
32-
digest = hashlib.sha256(payload).hexdigest()
33-
result = "${{ runner.os }}-{}-{}-pre-commit".format(python, digest)
34-
print("::set-output name=result::{}".format(result))
35-
- uses: actions/cache@v2.1.3
23+
- uses: actions/cache@v3.0.11
3624
if: matrix.os != 'windows-latest'
3725
with:
3826
path: ~/.cache/pre-commit

.pre-commit-config.yaml

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,36 +2,32 @@
22

33
repos:
44
- repo: https://github.com/asottile/pyupgrade
5-
rev: v2.32.1
5+
rev: v3.2.2
66
hooks:
77
- id: pyupgrade
88
args: [ --py310 ]
99
- repo: https://github.com/psf/black
10-
rev: 22.3.0
10+
rev: 22.10.0
1111
hooks:
1212
- id: black
1313
args:
1414
- --safe
1515
- --quiet
16-
- --exclude="robot\.py"
1716
files: ^((homeassistant|script|tests)/.+)?[^/]+\.py$
1817
- repo: https://github.com/codespell-project/codespell
19-
rev: v2.1.0
18+
rev: v2.2.2
2019
hooks:
2120
- id: codespell
2221
args:
2322
- --ignore-words-list=hass,alot,datas,dof,dur,ether,farenheit,hist,iff,ines,ist,lightsensor,mut,nd,pres,referer,ser,serie,te,technik,ue,uint,visability,wan,wanna,withing,iam,incomfort
24-
- --skip="./.*,*.csv,*.json,*.pem"
23+
- --skip="./.*,*.csv,*.json"
2524
- --quiet-level=2
26-
exclude_types: [csv, json, svg, pem, json]
25+
exclude_types: [csv, json, svg]
2726
exclude: ^tests/fixtures/
2827
- repo: https://github.com/pycqa/flake8
29-
rev: 3.8.4
28+
rev: 5.0.4
3029
hooks:
3130
- id: flake8
32-
additional_dependencies:
33-
- flake8-docstrings==1.5.0
34-
- pydocstyle==5.1.1
3531
files: ^(homeassistant|script|tests)/.+\.py$
3632
- repo: https://github.com/PyCQA/bandit
3733
rev: 1.7.4
@@ -40,22 +36,20 @@ repos:
4036
args:
4137
- --quiet
4238
- --format=custom
43-
- --configfile=tests/bandit.yaml
44-
files: ^(homeassistant|script)/.+\.py$
39+
files: ^(homeassistant|script|tests)/.+\.py$
4540
- repo: https://github.com/PyCQA/isort
4641
rev: 5.10.1
4742
hooks:
4843
- id: isort
4944
- repo: https://github.com/pre-commit/pre-commit-hooks
50-
rev: v3.2.0
45+
rev: v4.3.0
5146
hooks:
5247
- id: check-executables-have-shebangs
5348
stages: [manual]
5449
- id: check-json
5550
exclude: (.vscode|.devcontainer)
5651
- id: check-yaml
5752
- id: end-of-file-fixer
58-
exclude: (.pem)
5953
- id: trailing-whitespace
6054
- id: check-added-large-files
6155
- repo: https://github.com/pre-commit/mirrors-prettier

CHANGELOG.md

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,26 @@
22

33
## v0.3.2
44

5-
- Core alignment
6-
- Constants cleanup
7-
- Add retry mechanism for AWS token encryption process
5+
- Fix Filter Bag sensor
6+
- Core fix: wrongfully reported logs of entities getting updated when no update perform
7+
- Replaced `store debug data` switch and the feature of storing debug data to `/config/.storage` with debug API
8+
9+
**Endpoints**
10+
11+
| Endpoint Name | Method | Description |
12+
|------------------------------------|--------|-----------------------------------------------------------------------------------------------------|
13+
| /api/mydolphin_plus/list | GET | List all the endpoints available (supporting multiple integrations), available once for integration |
14+
| /api/mydolphin_plus/{ENTRY_ID}/api | GET | JSON of all raw data from the MyDolphin Plus API, per integration |
15+
| /api/mydolphin_plus/{ENTRY_ID}/ws | GET | JSON of all raw data from the MyDolphin Plus WebSocket, per integration |
16+
17+
**Authentication: Requires long-living token from HA**
18+
819

920
## v0.3.1
1021

22+
- Core alignment
23+
- Constants cleanup
24+
- Add retry mechanism for AWS token encryption process
1125
- Fix get token API (API changed and new one requires encryption of data) [#76](https://github.com/sh00t2kill/dolphin-robot/issues/76)
1226
- Add generate AWS token test file
1327
- Store encrypted data within config file to avoid re-generating the file on every startup

README.md

Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ Please remove the integration and re-add it to make it work again.
7070
###### Environment variables
7171
| Environment Variable | Type | Default | Description |
7272
|----------------------|---------|---------|---------------------------------------------------------------------------------------------------------------------------|
73-
| TEST_USERNANE | String | - | Username used for MyDolphin Plus |
74-
| TEST_PASSWORD | String | - | Password used for MyDolphin Plus |
73+
| Username | String | - | Username used for MyDolphin Plus |
74+
| Password | String | - | Password used for MyDolphin Plus |
7575
| DEBUG | Boolean | False | Setting to True will present DEBUG log level message while testing the code, False will set the minimum log level to INFO |
7676

7777
## HA Components
@@ -87,7 +87,6 @@ Please remove the integration and re-add it to make it work again.
8787
| {Robot Name} Cycle Time | Sensor | Indicates the time the robot is cleaning | |
8888
| {Robot Name} Cycle Time Left | Sensor | Indicates the time left for the robot to complete the cycle | |
8989
| {Robot Name} | Vacuum | Provides functionality of vacuum to the robot | Features: State, Fan Speed (Cleaning Mode), Return Home (Pickup), Turn On, Turn Off, Send Command (Navigate, Schedule, Delay Clean) |
90-
| {Robot Name} Store Debug Data | Switch | Sets whether to store API and WebSocket latest data for debugging | |
9190

9291
### Cleaning Modes
9392

@@ -159,6 +158,44 @@ data:
159158
mode: all
160159
```
161160
161+
## API
162+
163+
| Endpoint Name | Method | Description |
164+
|------------------------------------|--------|-----------------------------------------------------------------------------------------------------|
165+
| /api/mydolphin_plus/list | GET | List all the endpoints available (supporting multiple integrations), available once for integration |
166+
| /api/mydolphin_plus/{ENTRY_ID}/api | GET | JSON of all raw data from the MyDolphin Plus API, per integration |
167+
| /api/mydolphin_plus/{ENTRY_ID}/ws | GET | JSON of all raw data from the MyDolphin Plus WebSocket, per integration |
168+
169+
**Authentication: Requires long-living token from HA**
170+
171+
### Examples
172+
173+
#### List
174+
175+
*Request*
176+
```bash
177+
curl https://ha_url:8123/api/mydolphin_plus/list
178+
-H "Accept: application/json"
179+
-H "Authorization: Bearer {token}"
180+
```
181+
182+
#### WebSockets Data
183+
184+
*Request*
185+
```bash
186+
curl https://ha_url:8123/api/mydolphin_plus/{ENTRY_ID}/ws
187+
-H "Accept: application/json"
188+
-H "Authorization: Bearer {token}"
189+
```
190+
191+
#### API Data
192+
193+
```bash
194+
curl https://ha_url:8123/api/mydolphin_plus/{ENTRY_ID}/api
195+
-H "Accept: application/json"
196+
-H "Authorization: Bearer {token}"
197+
```
198+
162199
## Troubleshooting
163200
164201
Before opening an issue, please provide logs related to the issue,

custom_components/mydolphin_plus/component/api/aws_iot_websocket.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
from __future__ import annotations
22

33
import asyncio
4+
from collections.abc import Awaitable, Callable
45
from datetime import datetime
56
import json
67
import logging
78
import os
89
import sys
9-
from typing import Awaitable, Callable
1010
import uuid
1111

1212
from AWSIoTPythonSDK.MQTTLib import AWSIoTMQTTClient

custom_components/mydolphin_plus/component/api/mydolphin_plus_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
from __future__ import annotations
22

33
from base64 import b64encode
4+
from collections.abc import Awaitable, Callable
45
import hashlib
56
import logging
67
import secrets
78
import sys
8-
from typing import Awaitable, Callable
99

1010
from aiohttp import ClientResponseError
1111
from cryptography.hazmat.backends import default_backend

0 commit comments

Comments
 (0)