Skip to content

Commit

Permalink
Additional fixes of Change units from Bytes, KBytes and MBytes to B, …
Browse files Browse the repository at this point in the history
…Last activity as seconds, integration reload after changing configuration + pre-commit configuration
  • Loading branch information
elad-bar committed Feb 24, 2023
1 parent 33a8b1e commit 583fd30
Show file tree
Hide file tree
Showing 54 changed files with 1,510 additions and 742 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/hassfest.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---

name: Validate with hassfest

# yamllint disable-line rule:truthy
on:
push:
pull_request:
Expand Down
29 changes: 7 additions & 22 deletions .github/workflows/pre-commit.yaml
Original file line number Diff line number Diff line change
@@ -1,30 +1,15 @@
name: Linting
name: pre-commit

# yamllint disable-line rule:truthy
on:
push:
branches:
- main
- master
- dev
pull_request:
push:
branches: [master]

jobs:
pre-commit:
runs-on: ubuntu-latest
name: pre-commit
steps:
- uses: actions/checkout@v3.1.0
- uses: actions/setup-python@v4.3.0
with:
python-version: "3.10"
- run: |
pip install --constraint=.github/workflows/constraints.txt pip
pip install --constraint=.github/workflows/constraints.txt pre-commit
- uses: actions/cache@v3.0.11
if: matrix.os != 'windows-latest'
with:
path: ~/.cache/pre-commit
key: ${{ steps.cache_key_prefix.outputs.result }}-${{ hashFiles('.pre-commit-config.yaml') }}
restore-keys: |
${{ steps.cache_key_prefix.outputs.result }}-
- run: pre-commit run --all-files --show-diff-on-failure --color=always
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: pre-commit/action@v3.0.0
49 changes: 31 additions & 18 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
---

repos:
- repo: https://github.com/asottile/pyupgrade
rev: v3.2.2
rev: v3.3.1
hooks:
- id: pyupgrade
args: [ --py310 ]
args: [--py39-plus]
- repo: https://github.com/psf/black
rev: 22.10.0
rev: 23.1.0
hooks:
- id: black
args:
- --safe
- --quiet
files: ^((homeassistant|script|tests)/.+)?[^/]+\.py$
files: ^((custom_components)/.+)?[^/]+\.py$
- repo: https://github.com/codespell-project/codespell
rev: v2.2.2
hooks:
Expand All @@ -23,37 +20,53 @@ repos:
- --skip="./.*,*.csv,*.json"
- --quiet-level=2
exclude_types: [csv, json]
exclude: ^tests/fixtures/
- repo: https://github.com/pycqa/flake8
rev: 5.0.4
- repo: https://github.com/PyCQA/autoflake
rev: v2.0.1
hooks:
- id: autoflake
args:
- --in-place
- --remove-all-unused-imports
- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
hooks:
- id: flake8
files: ^(homeassistant|script|tests)/.+\.py$
additional_dependencies:
- pycodestyle==2.10.0
- pyflakes==3.0.1
# - flake8-docstrings==1.6.0
# - pydocstyle==6.2.3
- flake8-comprehensions==3.10.1
- flake8-noqa==1.3.0
- mccabe==0.7.0
files: ^(custom_components)/.+\.py$
- repo: https://github.com/PyCQA/bandit
rev: 1.7.4
hooks:
- id: bandit
args:
- --quiet
- --format=custom
files: ^(homeassistant|script|tests)/.+\.py$
- --configfile=bandit.yaml
files: ^(custom_components)/.+\.py$
- repo: https://github.com/PyCQA/isort
rev: 5.11.5
rev: 5.12.0
hooks:
- id: isort
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
rev: v4.4.0
hooks:
- id: check-executables-have-shebangs
stages: [manual]
- id: check-json
exclude: (.vscode|.devcontainer)
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- id: check-added-large-files
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.28.0
hooks:
- id: yamllint
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v2.6.1
rev: v3.0.0-alpha.4
hooks:
- id: prettier
stages: [manual]
61 changes: 61 additions & 0 deletions .yamllint
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
ignore: |
azure-*.yml
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: error
26 changes: 18 additions & 8 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog

## 2.0.26

Configuration breaking change

- Change units from Bytes, KBytes and MBytes to B, KB and MB, if the configured unit was other than Bytes, please re-configure it
- Last activity as seconds to return without milliseconds
- Upgrade pre-commit-configuration by [@tetienne](https://github.com/tetienne) [PR #91](https://github.com/elad-bar/ha-edgeos/pull/91)
- Fix integration reload after changing configuration

## 2.0.25

- Add support for Home Assistant integration and device diagnostics
Expand Down Expand Up @@ -30,7 +39,7 @@

**Version requires HA v2022.11.0 and above**

- Aligned *Core Select* according to new HA *SelectEntityDescription* object
- Aligned _Core Select_ according to new HA _SelectEntityDescription_ object

## 2.0.20

Expand Down Expand Up @@ -66,12 +75,13 @@ For now, special interface do not support to turn on / off
## 2.0.14

**Debugging became easier (less IO and Disk Space)**

- Removed `Store Debug Data` switch (Moved to the API endpoints below)
- Removed WebSocket messages sensors (Moved to the API endpoints below)
- Add endpoints to expose the data was previously stored to files and the messages counters

| Endpoint Name | Method | Description |
|----------------------------|--------|-----------------------------------------------------------------------------------------------------|
| -------------------------- | ------ | --------------------------------------------------------------------------------------------------- |
| /api/edgeos/list | GET | List all the endpoints available (supporting multiple integrations), available once for integration |
| /api/edgeos/{ENTRY_ID}/ha | GET | JSON of all HA processed data before sent to entities including messages counters, per integration |
| /api/edgeos/{ENTRY_ID}/api | GET | JSON of all raw data from the EdgeOS API, per integration |
Expand Down Expand Up @@ -144,9 +154,11 @@ For now, special interface do not support to turn on / off
- Fix missing validation of entry

## 2.0.0

Component refactored to allow faster future integration for additional features.

New features:

- Enable / Disable interface (Ethernet / Bridge) using a new switch per interface
- Enable / Disable interface monitoring for received and sent data / rate / errors / packets and dropped packets using a switch per interface
- Enable / Disable device monitoring for received and sent data and rate (including device tracker) using a switch per interface
Expand All @@ -157,6 +169,7 @@ New features:
- New service: `Update configuration` allows to edit configuration of unit, store debug data, log incoming messages and consider away interval

**Breaking Changes!**

- Most of the configurations moved to be regular components of HA (Log incoming messages, Unit of measurement, Store debug data)
- Configuration UI will hold EdgeOS URL and credentials only:
- Hostname
Expand All @@ -167,7 +180,7 @@ New features:
**System**

| Entity Name | Type | Description | Additional information |
|-------------------------------------|---------------|---------------------------------------------------------------------------|-----------------------------------------------|
| ----------------------------------- | ------------- | ------------------------------------------------------------------------- | --------------------------------------------- |
| {Router Name} Unit | Select | Sets whether to monitor device and create all the components below or not | |
| {Router Name} Unknown devices | Sensor | Represents number of devices leased by the DHCP server | Attributes holds the leased hostname and IPs |
| {Router Name} CPU | Sensor | Represents CPU usage | Attributes holds the leased hostname and IPs |
Expand All @@ -177,23 +190,21 @@ New features:
| {Router Name} Log incoming messages | Switch | Sets whether to log WebSocket incoming messages for debugging | |
| {Router Name} Store Debug Data | Switch | Sets whether to store API and WebSocket latest data for debugging | |


**Per device**

| Entity Name | Type | Description | Additional information |
|----------------------------------------------|----------------|---------------------------------------------------------------------------------|-----------------------------|
| -------------------------------------------- | -------------- | ------------------------------------------------------------------------------- | --------------------------- |
| {Router Name} {Device Name} Monitored | Sensor | Sets whether to monitor device and create all the components below or not | |
| {Router Name} {Device Name} Received Rate | Sensor | Received Rate per second | Statistics: Measurement |
| {Router Name} {Device Name} Received Traffic | Sensor | Received total traffic | Statistics: Total Increment |
| {Router Name} {Device Name} Sent Rate | Sensor | Sent Rate per second | Statistics: Measurement |
| {Router Name} {Device Name} Sent Traffic | Sensor | Sent total traffic | Statistics: Total Increment |
| {Router Name} {Device Name} | Device Tracker | Indication whether the device is or was connected over the configured timeframe | |


**Per interface**

| Entity Name | Type | Description | Additional information |
|---------------------------------------------------------|--------|------------------------------------------------------------------------------|-----------------------------|
| ------------------------------------------------------- | ------ | ---------------------------------------------------------------------------- | --------------------------- |
| {Router Name} {Interface Name} Status | Switch | Sets whether to interface is active or not | |
| {Router Name} {Interface Name} Monitored | Switch | Sets whether to monitor interface and create all the components below or not | |
| {Router Name} {Interface Name} Received Rate | Sensor | Received Rate per second | Statistics: Measurement |
Expand All @@ -207,7 +218,6 @@ New features:
| {Router Name} {Interface Name} Sent Errors | Sensor | Sent errors | Statistics: Total Increment |
| {Router Name} {Interface Name} Sent Packets | Sensor | Sent packets | Statistics: Total Increment |


## 1.2.6

- Restore value exception handling for WebSocket
Expand Down
Loading

0 comments on commit 583fd30

Please sign in to comment.