-
-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Added sensors for tracking free electricity sessions (3 hours d…
…ev time)
- Loading branch information
1 parent
6403589
commit 98cbafb
Showing
26 changed files
with
863 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
custom_components/octopus_energy/api_client/free_electricity_sessions.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from datetime import datetime | ||
|
||
from .octoplus_session import BaseOctoplusSession | ||
|
||
class FreeElectricitySession(BaseOctoplusSession): | ||
def __init__( | ||
self, | ||
code: str, | ||
start: datetime, | ||
end: datetime | ||
): | ||
BaseOctoplusSession.__init__(self, code, start, end) | ||
|
||
class FreeElectricitySessionsResponse: | ||
data: list[FreeElectricitySession] | ||
|
||
def __init__( | ||
self, | ||
data: list[FreeElectricitySession] | ||
): | ||
self.data = data |
19 changes: 19 additions & 0 deletions
19
custom_components/octopus_energy/api_client/octoplus_session.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from datetime import datetime | ||
|
||
|
||
class BaseOctoplusSession: | ||
code: str | ||
start: datetime | ||
end: datetime | ||
duration_in_minutes: int | ||
|
||
def __init__( | ||
self, | ||
code: str, | ||
start: datetime, | ||
end: datetime | ||
): | ||
self.code = code | ||
self.start = start | ||
self.end = end | ||
self.duration_in_minutes = (end - start).total_seconds() / 60 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
98cbafb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A decent amount of work gone into this thank you @BottlecapDave