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

Config flow #31

Merged
merged 48 commits into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
fa28c04
Add basic config flow dialog
dala318 Jan 9, 2024
7faa1cc
Edit init for flow
dala318 Jan 9, 2024
684d486
Begin adding binary sensor
dala318 Jan 9, 2024
fdd5774
A number entity is created
dala318 Jan 9, 2024
fd531a1
Also binary sensor is now creted
dala318 Jan 10, 2024
ba7376e
Some progress
dala318 Jan 29, 2024
b87b062
Merge pull request #25 from dala318/main
dala318 Jan 29, 2024
412bdb6
One more step
dala318 Jan 30, 2024
645bcdd
Small changes
dala318 Jan 31, 2024
9165a22
Onto something
dala318 Aug 27, 2024
0f490db
Clean up config_flow.py
dala318 Aug 27, 2024
8e37623
Config flow working, need to fix entity creation
dala318 Aug 28, 2024
ed3e9c9
Numbers seem to work
dala318 Aug 30, 2024
5da3b03
Moving out number logic to entity class
dala318 Aug 30, 2024
f6ff260
Cleanup and activate binary sensor
dala318 Aug 30, 2024
d4ebbca
It actually somewhat works
dala318 Aug 30, 2024
45bc7e0
Cleanup config flow
dala318 Aug 31, 2024
d9bf285
Just noting the no longer valid sections in README
dala318 Aug 31, 2024
9918eea
Fixing suntax style
dala318 Sep 1, 2024
dc4c9bc
Try fixing number value restore
dala318 Sep 1, 2024
698a9ca
Remove Entity from names
dala318 Sep 1, 2024
876453c
Fix only creating necessary config entities
dala318 Sep 1, 2024
82e49ec
Correction to use new name of state class variable
dala318 Sep 1, 2024
a19a5e8
Start new approash to planner
dala318 Sep 1, 2024
39a3261
Preparation to use e-Entso prices
dala318 Sep 2, 2024
a1798e3
Getting along to new planner logic
dala318 Sep 2, 2024
2b439f5
Almost, but do not set binary state corectly
dala318 Sep 2, 2024
e5e3c53
Update seem to work but not setting binbary sensor and number value r…
dala318 Sep 3, 2024
27273dc
Easy fix for scheduling update of output entity
dala318 Sep 3, 2024
ae6d460
Prep for currency
dala318 Sep 3, 2024
69f1cae
Seem to be working
dala318 Sep 3, 2024
f1cd810
Update version
dala318 Sep 3, 2024
49d62ad
Add High cost binary sensor as option
dala318 Sep 3, 2024
c354bf6
Schedule update also of hihg cost entity
dala318 Sep 4, 2024
6bd6c90
Try fixing high-cost sensor
dala318 Sep 4, 2024
8a9661d
Adding base for automatic testing
dala318 Sep 4, 2024
a7c7fbe
Move actions config to correct folder
dala318 Sep 4, 2024
6d1b6b1
Some fixes for action error results
dala318 Sep 4, 2024
4bdfffc
Fix name in flow test
dala318 Sep 4, 2024
3f5874f
Try fixing test
dala318 Sep 4, 2024
0de5b4a
New attempt
dala318 Sep 4, 2024
9132c66
Changing to an easier test
dala318 Sep 4, 2024
b52b72b
Another attempt
dala318 Sep 4, 2024
ca39195
A hail-mary attempt
dala318 Sep 4, 2024
7d408df
Back to basics, remove the async_track_state_change_event
dala318 Sep 4, 2024
e03ef7e
More to basics
dala318 Sep 4, 2024
310e2fa
Merge pull request #35 from dala318/add_test
dala318 Sep 4, 2024
6e1a869
Merge branch 'main' into config_flow
dala318 Sep 4, 2024
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
14 changes: 14 additions & 0 deletions .github/workflows/hassfest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Validate with hassfest

on:
push:
pull_request:
# schedule:
# - cron: "0 0 * * *"

jobs:
validate:
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v4
- uses: home-assistant/actions/hassfest@master
32 changes: 32 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Python tests

on:
workflow_dispatch:
pull_request:
paths:
- '**.py'
push:
paths:
- '**.py'

jobs:
tests:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.12']

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.test.txt
- name: Full test with pytest
run: pytest --cov=. --cov-config=.coveragerc --cov-report xml:coverage.xml
9 changes: 8 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
.idea/
.idea/
.storage/
blueprints/
www/
.HA_VERSION
__pycache__
home-assistant*
/*.yaml
19 changes: 11 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ Apart from potentially saving some money, this kind of temporal shifting of cons

### Configuration

1. Add the following to your `configuration.yaml` file:
> **IMPORTANT NOTE**: With version 2 configuration via `configuration.yaml` is no longer possible. Converting that configuration via "import config" is still not implemented. You wil have to remove the old now broken manual configuration and create a new via the GUI.


<!-- 1. Add the following to your file:

```yaml
binary_sensor:
Expand All @@ -52,11 +55,11 @@ Apart from potentially saving some money, this kind of temporal shifting of cons
`static` planner searches for an ammount of cheap hours until a set time (work in progress!)

2. Restart HA again to load the configuration. Now you should see `nordpool_planner_2_10_0_0_0_0` binary_sensor, where
the `2_10_0_0_0_0` part corresponds to default values of optional parameters, explained below.
the `2_10_0_0_0_0` part corresponds to default values of optional parameters, explained below. -->

## Optional parameters

There are some optional parameters that could be provided to the sensor, they can be grouped in some categories.
<!-- There are some optional parameters that could be provided to the sensor, they can be grouped in some categories.

Generic optional: `duration` (2), `var_duration_entity` (""), `accept_cost` (0.0) and `accept_rate` (0.0). Default values in parenthesis.

Expand All @@ -76,7 +79,7 @@ input_number:
min: 0
max: 24
step: 1
```
``` -->

`accept_cost` specifies a price level in the currency of your `nordpool_entity`, that if an "average over a duration" is below this value, it is accepted and used. Even if not the lowest in the range specified.

Expand All @@ -86,7 +89,7 @@ The planner types has some additional configuration variables

### Moving

Optional parameter `var_search_length_entity` (""). Default value in parenthesis.
<!-- Optional parameter `var_search_length_entity` (""). Default value in parenthesis.

```yaml
binary_sensor:
Expand All @@ -100,7 +103,7 @@ Optional parameter `var_search_length_entity` (""). Default value in parenthesis
moving:
search_length: 10
var_search_length_entity: input_number.look_this_far_ahead
```
``` -->

`search_length` can be in the range of 2 to 24 and specifies how many hours ahead to serach for lowest price.

Expand All @@ -113,7 +116,7 @@ The integration will use minimum of `var_search_length_entity` (if supplied and
> **WORK IN PROGRESS**: This version of entity is still not fully tested, may need some more work to work properly.


Optional parameters `var_end_hour_entity` ("") and `split_hours` (false). Default values in parenthesis.
<!-- Optional parameters `var_end_hour_entity` ("") and `split_hours` (false). Default values in parenthesis.

```yaml
binary_sensor:
Expand All @@ -128,7 +131,7 @@ Optional parameters `var_end_hour_entity` ("") and `split_hours` (false). Defaul
end_hour: 7
var_end_hour_entity: input_number.need_fully_charged_car_at
split_hours: false
```
``` -->

`end_hour` can be in the range of 0 to 23 and specifies at what time within 24 hours the ammount of active hours shall be selected.

Expand Down
Loading