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

[FEATURE] Live data from more than one home #26

Open
TerjeMyk opened this issue Dec 30, 2022 · 3 comments · Fixed by #28
Open

[FEATURE] Live data from more than one home #26

TerjeMyk opened this issue Dec 30, 2022 · 3 comments · Fixed by #28
Labels
enhancement New feature or request low priority This issue will probably not be looked into for a while

Comments

@TerjeMyk
Copy link

TerjeMyk commented Dec 30, 2022

Hi

I have 2 home with pulser. I writing a program in python so I can look at the realtime use.

But I only get data from 1 of the homes.

I get:

Connection to websocket failed... Retrying in 10 seconds...
received 4429 (private use) Too many open connections on this server: 2; then sent 4429 (private use) Too many open connections on this server: 2

This is probably me that has tried to mutch.

WHAT IS THE CORRECT WAY TO GET REALTIME DATA FROM MORE THAN 1 HOME?

Here is my code:

import tibber
import init

account = tibber.Account(init.GetTibberKey())
home0 = account.homes[0]
home1 = account.homes[1]

@home0.event("live_measurement")
def show_accumulated_cost(data):
print(f"0 - {data.power} {data.power_production}")

@home1.event("live_measurement")
def show_accumulated_cost1(data):
print(f"1 - {data.power} {data.power_production}")

if name == 'main':
# Start the live feed. This runs forever.
home0.start_live_feed()
home1.start_live_feed()

@TerjeMyk TerjeMyk added the enhancement New feature or request label Dec 30, 2022
@BeatsuDev
Copy link
Owner

Hi, I will look into adding support for multiple homes in one script. For now, you could try splitting each home into separate scripts and see if that works. About the connection issue; I am still trying to figure that one out... There is a similar issue that has been brought up which is probably the same issue you are experiencing. I will be a bit busy the next week but will try to find the problem as soon as I have time!

@BeatsuDev BeatsuDev self-assigned this Dec 30, 2022
@BeatsuDev BeatsuDev added low priority This issue will probably not be looked into for a while bug Something isn't working labels Dec 30, 2022
@BeatsuDev BeatsuDev linked a pull request Jan 5, 2023 that will close this issue
@BeatsuDev BeatsuDev reopened this Jan 5, 2023
@BeatsuDev
Copy link
Owner

Hi, could you try updating to the newest version of tibber (version 0.3.0) and see how it goes? Run:

pip install --upgrade tibber.py

You will still have to split your two homes into two separate scripts for now, but the connection limit error/bug should be fixed or at least improved in the newest version!

home0.py:

import tibber
import init

account = tibber.Account(init.GetTibberKey())
home = account.homes[0]

@home.event("live_measurement")
def show_accumulated_cost(data):
  print(f"0 - {data.power} {data.power_production}")

if __name__ == '__main__':
  home.start_live_feed()

home1.py:

import tibber
import init

account = tibber.Account(init.GetTibberKey())
home = account.homes[1]

@home.event("live_measurement")
def show_accumulated_cost(data):
  print(f"0 - {data.power} {data.power_production}")

if __name__ == '__main__':
  home.start_live_feed()

@BeatsuDev
Copy link
Owner

The connection limit issue should be fixed now. See issue #23 if the problem persists.

Although you should be able to run multiple homes with the above steps, I'll keep this issue open since adding support for multiple homes in a single file still seems like a potentially nice idea!

@BeatsuDev BeatsuDev removed their assignment Feb 6, 2023
@BeatsuDev BeatsuDev removed the bug Something isn't working label Nov 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request low priority This issue will probably not be looked into for a while
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants