BottlecapDave / HomeAssistant-OctopusEnergy

Unofficial Home Assistant integration for interacting with Octopus Energy
https://bottlecapdave.github.io/HomeAssistant-OctopusEnergy/
MIT License
583 stars 60 forks source link

Multiple accounts #223

Closed alandrumo closed 6 months ago

alandrumo commented 1 year ago

I have two different octopus accounts and two meters in my house. How difficult would it be to add another account and meter to the same home assistant instance?

BottlecapDave commented 1 year ago

Hello. I've had a couple of requests, but tbh it's low on my list as it would require quite a major re-write. One of the biggest issues is the limitation on HA integration UIs. I'll keep this issue open so other people can upvote it.

rwbarrett commented 9 months ago

Would also like this as have 2 accounts

ronhogwarts commented 9 months ago

Same, two accounts for me

ACALVETT commented 9 months ago

Me to, useful as i would like to manage and automate my mums energy as well.

BottlecapDave commented 8 months ago

I've created an initial beta release to support this, which can be found at https://github.com/BottlecapDave/HomeAssistant-OctopusEnergy/releases/tag/multi-account-support-beta-1.

I don't have multiple accounts so very hard for me to test. Because of this and that less than 1% of installs are requesting this feature, the presence of the beta does not guarantee an eventual release.

Multiple accounts with target rate sensors and cost sensors that span multiple accounts should be tested.

Installation Instructions

Go to HACS and click redownload

hacs-1

From here, you'll need to switch to see beta releases and select the target beta version.

hacs-2

Once downloaded, you'll need to restart your HA instance.

Additional Accounts

If this is your first time using the integration, then you'll need to add your initial account. After this, to add additional accounts, you'll need to configure another instance of the integration, which will bring up the following menu

integration-1

If you add target rate sensors or cost sensors, you'll now be presented with this pre-menu where you need to select your target account. This will filter down the target meters for the sensors.

integration-2
ACALVETT commented 8 months ago

Amazing! I will setup and feedback

rwbarrett commented 8 months ago

HACS tells me I have the beta installed but when I add the integration it only asks me for one account number and sets up as before with only the devises for that single account

BottlecapDave commented 8 months ago

@rwbarrett You'll need to configure an initial account first. This flow will not change as 99% of users will not need to setup more than one account. I've updated my comment above with installation and instructions on how to add additional accounts.

ACALVETT commented 8 months ago

Working for me, i will test more. One minor thing to note is the api key is the same so don't need to add it again for multiple accounts.

rwbarrett commented 8 months ago

Thanks - thats brilliant - all working now. Will need to see what Predbat does now it has two octopus accounts to choose from

markcocker commented 8 months ago

The beta is work great for me. I now have two accounts configured: both with gas + electric meters, and one also has export meter and four export rate meters. Amazing. Thank you!

Update: I have now have 3 Octopus accounts added and working.

alandrumo commented 8 months ago

Working for me too. 👌 ☺️ Thank you for adding the support for this!

On Sun, 21 Jan 2024, 14:17 Mark Cocker, @.***> wrote:

The beta is work great for me. I now have two accounts configured: both with gas + electric meters, and one also has export meter and four export rate meters. Amazing. Thank you!

— Reply to this email directly, view it on GitHub https://github.com/BottlecapDave/HomeAssistant-OctopusEnergy/issues/223#issuecomment-1902643265, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJVMAV6ZAO43TQXF7D6M6M3YPUPN3AVCNFSM6AAAAAAXIDVSKOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMBSGY2DGMRWGU . You are receiving this because you authored the thread.Message ID: @.*** com>

PhillyGilly commented 8 months ago

Can I use this to compare two tariffs? I'm on the octopus variable E7 tariff but I'd like to compare this with Agile using traget Rate Sensors before switching over. Thanks

BottlecapDave commented 8 months ago

This will not support this functionality as you'll result in clashes in entity names (which include account id or meter ids). There is checks in place to ensure you can't setup the same account multiple times. You can use the override sensors to compare tariffs, but this will not effect target rate sensors.

alfwro13 commented 8 months ago

I agree with @PhillyGilly that would be a great enhancement - i.e. add the same account 2nd time and use the tariff override for cost comparison. But I understand why that is currently not possible with the sensors are named.

BottlecapDave commented 8 months ago

There is a separate ticket around being able to override the main tariff of your account which would have a cascading effect to everything including target rate sensors. But this would obv replace all data while the tariff has been override (which could cause confusion when looking at past data). As mentioned, no plans to support this ability with multiple accounts support.

BottlecapDave commented 8 months ago

Speaking of multiple account support, has anyone had any issues with it?

markcocker commented 8 months ago

Speaking of multiple account support, has anyone had any issues with it?

I have setup 3 accounts as below and 4 rate meters. Automated joining saving session for all 3. Getting electric + gas spins data for all 3.

rwbarrett commented 8 months ago

No it’s been a working really well for me - will this be wrapped into the main releases if there are no reported issues?Sent from my iPhoneOn 7 Feb 2024, at 14:59, David Kendall @.***> wrote: Speaking of multiple account support, has anyone had any issues with it?

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>

BottlecapDave commented 8 months ago

If there's no issues that are related to having multiple accounts, then yes the idea is to merge the feature into the main release.

BottlecapDave commented 8 months ago

New beta release which includes features/bugfixes from v10.0.4 and v10.1.0. This can be found at https://github.com/BottlecapDave/HomeAssistant-OctopusEnergy/releases/tag/multi-account-support-beta-2

sandersr commented 8 months ago

Will this integration work if I have two electricity meters on the same account? Recently I asked Octopus to add 2nd meter and rather than creating a new account, they've added it to my primary account. In their API I can see two meters:

https://api.octopus.energy/v1/electricity-meter-points/{METER_1_ID}/meters/{METER_1_SERIAL_NUMBER}/consumption/ and https://api.octopus.energy/v1/electricity-meter-points/{METER_2_ID}/meters/{METER_2_SERIAL_NUMBER}/consumption/

BottlecapDave commented 8 months ago

@sandersr if both meters have a valid tariff associated with them, then both should be retrieved and populated.

markcocker commented 7 months ago

I have an automation to join the saving sessions for multiple accounts when the octopus_energy_new_octoplus_saving_session event is fired. The first account is joined as expected, but the second one fails with Account ineligible to join Saving Sessions event.. I can go to the Octopus site for those accounts an manually sign up to the savings session.

I wondered if this is due to timing - perhaps Octopus does not make all accounts eligible at the same time and so the 2nd account fails?

Should this integration fire the same event for each account, so perhaps my automation needs to handle just one account per event?

alias: Octopus saving session - joiner
description: Automatically join Octopus Saving Session Events
trigger:
  - platform: event
    event_type: octopus_energy_new_octoplus_saving_session
condition: []
action:
  - service: octopus_energy.join_octoplus_saving_session_event
    data:
      event_code: "{{ trigger.event.data[\"event_code\"] }}"
    target:
      entity_id: event.octopus_energy_X_XXXXXXXX_octoplus_saving_session_events
    continue_on_error: true
  - service: octopus_energy.join_octoplus_saving_session_event
    data:
      event_code: "{{ trigger.event.data[\"event_code\"] }}"
    target:
      entity_id: event.octopus_energy_Y_YYYYYYYY_octoplus_saving_session_events
    continue_on_error: true

etc.

  - service: persistent_notification.create
    data:
      title: Octopus Saving Sessions Updated
      message: >
        Joined Octopus Energy saving session. It starts on
        {{trigger.event.data["event_start"].day}}/{{trigger.event.data["event_start"].month
        }} at {{trigger.event.data["event_start"].strftime('%H:%M') }}.
mode: single
Screenshot 2024-03-02 at 13 51 22
alandrumo commented 7 months ago

I have two accounts but have already joined today's session on both. I can test this if you want? I'm very interested in auto join of the sessions. I've already got a heap of automations to manage my power use over the session but sometimes i miss the notification on my phone or am too late to join.

Alan

On Sat, 2 Mar 2024, 13:58 Mark Cocker, @.***> wrote:

I have an automation to join the saving sessions for multiple accounts when the octopus_energy_new_octoplus_saving_session event is fired. The first account is joined as expected, but the second one fails with Account ineligible to join Saving Sessions event.. I can go to the Octopus site for those accounts an manually sign up to the savings session.

I wondered if this is due to timing - perhaps Octopus does not make all accounts eligible at the same time and so the 2nd account fails?

Should this integration fire the same event for each account, so perhaps my automation needs to handle just one account per event?

alias: Octopus saving session - joinerdescription: Automatically join Octopus Saving Session Eventstrigger:

  • platform: event event_type: octopus_energy_new_octoplus_saving_sessioncondition: []action:

  • service: octopus_energy.join_octoplus_saving_session_event data: event_code: "{{ trigger.event.data[\"event_code\"] }}" target: entity_id: event.octopus_energy_X_XXXXXXXX_octoplus_saving_session_events continue_on_error: true

  • service: octopus_energy.join_octoplus_saving_session_event data: event_code: "{{ trigger.event.data[\"event_code\"] }}" target: entity_id: event.octopus_energy_X_XXXXXXXX_octoplus_saving_session_events continue_on_error: true etc.

  • service: persistent_notification.create data: title: Octopus Saving Sessions Updated message: > Joined Octopus Energy saving session. It starts on {{trigger.event.data["event_start"].day}}/{{trigger.event.data["event_start"].month }} at {{trigger.event.data["event_start"].strftime('%H:%M') }}.mode: single

Screenshot.2024-03-02.at.13.51.22.png (view on web) https://github.com/BottlecapDave/HomeAssistant-OctopusEnergy/assets/15351000/6180e9a5-a4e5-4ffe-aff1-200fe4650018

— Reply to this email directly, view it on GitHub https://github.com/BottlecapDave/HomeAssistant-OctopusEnergy/issues/223#issuecomment-1974803390, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJVMAVZL656YR2M467S3QJ3YWHLINAVCNFSM6AAAAAAXIDVSKOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNZUHAYDGMZZGA . You are receiving this because you authored the thread.Message ID: @.*** com>

martindell commented 7 months ago

Thanks @BottlecapDave. Works a treat with two Octopus accounts 👍

RaoulSargent commented 6 months ago

PERFECT :-)

I have two accounts now working: 1) Electric Export, Electric Import, Gas 2) Electric Import, Gas

I will be adding a third account in the coming months.

Very easy to setup.

I was previously running version 10.1.4 with the 1) account mentioned above. I went into HACS, re-downloaded the Beta-2, restarted HA Then added a new instance of the Octopus plugin in HA Settings / Devices & Services / Add Integration This gave me the new menu option to add account, which I did with the account ID for the 2) account Bingo, all working as expected.

I also use the blueprint called "Octopus Energy - Join Saving Session" with account 1) So I setup another instance of the blueprint for account 2) Bingo, that too appears to have created the automation correctly.

So all-in-all a very smooth setup experience.

Well done and Thank you :-)

BottlecapDave commented 6 months ago

This feature has now been released as part of v10.2.0