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

[octopusenergy] New binding to support Octopus Energy API (agile energy tariffs in the UK) #10176

Closed
wants to merge 3 commits into from

Conversation

renescherer
Copy link
Contributor

@renescherer renescherer commented Feb 16, 2021

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:

  • retrieval of latest meter readings (consumption)
  • retrieval of agile tariff schedule / unit rates (if on an agile tariff, half-hourly future rates are provided based on availability)

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:

  • display the recommended Dishwasher or Washing machine start time on a wall panel
  • schedule a nightly EV charging session if your EVSE or car allows automated scheduling
  • switching of storage heaters overnight
  • schedule wake up time for a server to run nightly backups

Current Limitations / Work in Progress

  • only tested with Octopus "Agile" electricity tariff. I would welcome users of "Go" or "Go Faster" for testing.

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]>
@Hilbrand Hilbrand added the new binding If someone has started to work on a binding. For a new binding PR. label Feb 17, 2021
@renescherer renescherer requested a review from Skinah February 25, 2021 11:14
Copy link
Member

@fwolter fwolter left a 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
Copy link
Member

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?

Comment on lines +29 to +39
#### 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"
}
```
Copy link
Member

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 |
Copy link
Member

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 |
Copy link
Member

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 |
Copy link
Member

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>
Copy link
Member

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">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<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>
Copy link
Member

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.

Suggested change
<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>
Copy link
Member

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
Copy link
Member

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?

@fwolter fwolter added the awaiting feedback Awaiting feedback from the pull request author label Jul 25, 2021
@fwolter
Copy link
Member

fwolter commented Dec 11, 2021

@renescherer What's the state of this PR?

@lolodomo
Copy link
Contributor

@fwolter @renescherer : Review was done one year ago and there was no feedback, I am afraid unfortunately time has come to close this PR ?

@lolodomo lolodomo added the stale As soon as a PR is marked stale, it can be removed 6 months later. label Jun 11, 2022
@lolodomo
Copy link
Contributor

@renescherer : if you want to resume the work on this binding, you are welcome to reopen this PR.

@lolodomo lolodomo closed this Jun 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting feedback Awaiting feedback from the pull request author new binding If someone has started to work on a binding. For a new binding PR. stale As soon as a PR is marked stale, it can be removed 6 months later.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants