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

Reading telegrams from P1 #430

Open
Mausy5043 opened this issue Nov 27, 2024 · 10 comments · May be fixed by #491
Open

Reading telegrams from P1 #430

Mausy5043 opened this issue Nov 27, 2024 · 10 comments · May be fixed by #491

Comments

@Mausy5043
Copy link

This code:

async with HomeWizardEnergyV1(host=IP_ADDRESS) as api:
    wiz_data = await api.data()
    print("\ndata\n{wiz_data}")

..returns the data from the P1-meter.
I'd like to use similar code to inspect the most recent telegram received from the P1-meter. For example using await api.telegram().

Are there any plans to add this functionality?

@DCSBL
Copy link
Collaborator

DCSBL commented Jan 31, 2025

Oh hey @Mausy5043,

Sorry, your issue got tangled in some ethernet cables I think, I’m seeing it just now.

We can add this, but maybe you can take it as a challenge and create it yourself? You could propose it as a PR, this project is open source so we're open to contributions!

@Mausy5043
Copy link
Author

@DCSBL : I might give it a try. Do you want me to create a PR agains the main-branch?

My own P1-meter is still on the API/v1. Is that okay?

And how is that change then later migrated automagically to the API/v2?

@DCSBL
Copy link
Collaborator

DCSBL commented Jan 31, 2025

We can add you to the v2 release group if you wish. You can fill in that form here: https://forms.gle/yYyKJYexaJv1fdae6

Do you want me to create a PR agains the main-branch?

Yes please

@Mausy5043
Copy link
Author

Mausy5043 commented Jan 31, 2025

@DCSBL : I'm a bit hesitant, as I don't want to FUBAR my current set-up at home.
Is the API/v2 backwards compatible with calls to the API/v1 ?

@DCSBL
Copy link
Collaborator

DCSBL commented Jan 31, 2025

V1 and V2 live side-to-side

https://api-documentation.homewizard.com/docs/introduction#devices

@DCSBL
Copy link
Collaborator

DCSBL commented Jan 31, 2025

But you can start with v1 and blindly see what the v2 implementation would look like, I can finetune the last part IRL.

@Mausy5043
Copy link
Author

Mausy5043 commented Jan 31, 2025

Ah, okay. So I can acces both API/v1 and API/v2 in parallel. Using API/v1 for the "production" set-up and API/v2 for developement/testing on the same device.

I understood that once the API/v2 was activated the v1 would nolonger be available to me

@DCSBL
Copy link
Collaborator

DCSBL commented Jan 31, 2025

Yes, v1 and v2 work at the same time for the P1 Meter. You can disable v1 via the v2 API if you wish but that is up to you.

Can you refer to any documentation/message where you got the idea that you can only use one version? We might have to tweak that if that is what people think ;)

Mausy5043 added a commit to Mausy5043/python-homewizard-energy that referenced this issue Feb 1, 2025
Return type is `Any` because we don't process the response from the API.
@Mausy5043 Mausy5043 linked a pull request Feb 1, 2025 that will close this issue
@Mausy5043
Copy link
Author

Mausy5043 commented Feb 1, 2025

I've created PR #491 to fix this proposal. I've tested it with the API/v1. Not tested with API/v2, but I expect no issues with that implementation as it follows the other methods closely.

I don't have experience with writing tests. So, I'll leave it up to someone else to assess the need for and addition of a test.

@Mausy5043
Copy link
Author

Mausy5043 commented Feb 1, 2025

@DCSBL

Can you refer to any documentation/message where you got the idea that you can only use one version? We might have to tweak that if that is what people think ;)

It's probably just me. But, I would have felt more confident if the documentation would be a bit more reassuring. For example, you might want to consider changing the first sentence on this page to something like:

"The API v2 is an updated version of the API that includes new features and improvements. It can be accessed in parallel with the API v1. Read the documentation to learn more."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants