-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
[octopusenergy] New binding to support Octopus Energy API (agile energy tariffs in the UK) #10176
Conversation
Signed-off-by: Rene Scherer <[email protected]> [octopusenergy] basic account, consuption and price API implementation Signed-off-by: Rene Scherer <[email protected]> first working version with actions Signed-off-by: Rene Scherer <[email protected]>
...main/java/org/openhab/binding/octopusenergy/internal/handler/OctopusEnergyBridgeHandler.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Rene Scherer <[email protected]>
Signed-off-by: Rene Scherer <[email protected]>
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.
Thanks for your contribution! Good overall code quality. Here is my feedback.
There are some checkstyle warnings left. You could take a look at target/code-analysis/report.html
.
To make the binding compile, you need to rebase your branch and set the version to the current snapshot: 3.2.0-SNAPSHOT
.
Here are the commands for rebasing your branch:
If not already done, add the upstream openHAB addon repo as a remote to your local repo and fetch it:
git remote add upstream https://github.com/openhab/openhab-addons.git
git fetch upstream
The remotes (git remote --verbose
) should look like this, now:
origin https://github.com/[your name]/openhab-addons.git (fetch)
origin https://github.com/[your name]/openhab-addons.git (push)
upstream https://github.com/openhab/openhab-addons.git (fetch)
upstream https://github.com/openhab/openhab-addons.git (push)
Then, you can rebase your PR's branch onto main
:
git rebase upstream/main
Finally force-push the rebased branch to this PR's branch:
git push origin [your branch name of this PR] --force-with-lease
DON'T use merge! This can clutter the Git history and make the PR unusable.
@@ -24,3 +24,5 @@ features/**/src/main/feature | |||
.vscode | |||
.factorypath | |||
pom.xml.versionsBackup | |||
|
|||
bundles/org.openhab.binding.octopusenergy/src/test/java/org/openhab/binding/octopusenergy/internal/OctopusEnergyApiHelperLiveTest.java |
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.
Did you add this by intention?
#### Manual configuration | ||
|
||
For the identifier of the meter points, the corresponding MPAN or MPRN is used. | ||
|
||
``` | ||
Bridge octopusenergy:bridge:api "Demo Octopus Energy Bridge" [ accountNumber="<Account Number>", apiKey="<API Key>", refreshInterval=15 ] | ||
{ | ||
Thing electricityMeterPoint 1679122486235 "My Electricy Meter Point with MPAN 1679122486235" | ||
Thing gasMeterPoint 3046829404 "My Gas Meter Point with MPRN 3046829404" | ||
} | ||
``` |
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.
You could put the config parameters in a table like here https://www.openhab.org/addons/bindings/telegram/#thing-configuration This makes your readme consistent with other bindings.
The example seems redundant to the example section and could be removed here.
|
||
| channel | type | description | | ||
|--------------------------------|---------------|----------------------------------------------------------------------------------------------| | ||
| refresh | Switch | Allows a manual refresh of the API data when sent an ON command | |
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.
There's a dedicated refresh command for this purpose. See https://www.openhab.org/docs/developer/bindings/#handling-refreshtype-command
| mostRecentConsumptionAmount | Number:Energy | The amount of energy consumed during the given time window | | ||
| mostRecentConsumptionStartTime | DateTime | The start time of the most recent consumption window | | ||
| mostRecentConsumptionEndTime | DateTime | The end time of the most recent consumption window | | ||
| unitPriceWindowStartTime | Number | The start time of the unit price window | |
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.
What's the reason this is Number instead of DateTime?
| unitPriceWindowStartTime | Number | The start time of the unit price window | | ||
| unitPriceWindowEndTime | DateTime | The end time of the unit price window | | ||
| unitPriceWindowMinAmount | Number | The minimum unit price of energy in GBp per Kilowatt Hour over the available forecast period | | ||
| unitPriceWindowMaxAmount | DateTime | The maximum unit price of energy in GBp per Kilowatt Hour over the available forecast period | |
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.
Seems like this should be Number.
|
||
<name>OctopusEnergy Binding</name> | ||
<description>This binding interacts with Octopus Energy API to retrieve energy consumption and prices.</description> | ||
<author>Rene Scherer</author> |
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.
The author tag is deprecated and should therefore be removed. See openhab/openhab-core#1844.
<description>The API key to access the Octopus Energy API</description> | ||
<context>password</context> | ||
</parameter> | ||
<parameter name="refreshInterval" type="integer" required="false" unit="m"> |
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.
<parameter name="refreshInterval" type="integer" required="false" unit="m"> | |
<parameter name="refreshInterval" type="integer" required="false" unit="m" min="1"> |
<bridge-type-ref id="bridge"/> | ||
</supported-bridge-type-refs> | ||
|
||
<label>Octopus Energy Electricity Meter Point</label> |
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.
Labels should be concise as possible. The binding name is redunandant.
<label>Octopus Energy Electricity Meter Point</label> | |
<label>Electricity Meter Point</label> |
|
||
<channel-type id="requestedStartTimeHourType"> | ||
<item-type>Number</item-type> | ||
<label>Requested Activity Start Hour</label> |
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.
This doesn't seem documented in the readme. Is this the result of the Action? What's the reason for writing it extra into a Channel?
@@ -0,0 +1,7 @@ | |||
# Root logger |
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.
What's the purpose of this?
@renescherer What's the state of this PR? |
@fwolter @renescherer : Review was done one year ago and there was no feedback, I am afraid unfortunately time has come to close this PR ? |
@renescherer : if you want to resume the work on this binding, you are welcome to reopen this PR. |
Octopus Energy Binding
This binding allows openHAB to communicate with the public API from Octopus Energy (https://octopus.energy), an energy provider in the UK. The following features are provided by the binding:
The key feature of this binding is a number of actions to calculate the optimal time and cost for running a certain appliance (e.g. Dishwasher). This can be used in a variety of ways, such as:
Current Limitations / Work in Progress