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

Question: change get functions #234

Closed
elenril2 opened this issue Dec 4, 2021 · 4 comments
Closed

Question: change get functions #234

elenril2 opened this issue Dec 4, 2021 · 4 comments

Comments

@elenril2
Copy link
Contributor

elenril2 commented Dec 4, 2021

Hello,

I want to change get consumpionts functions in GazBoiler class to match my device Vitodens 100-W. I must change self.service.getProperty("heating.gas.consumption.heating")["properties"]["unit"]["value"] to self.service.getProperty("heating.gas.consumption.summary.heating")["properties"]["unit"]["value"].
But when I do this directly in PyViCareGazBoiler.py I've got errors:

Traceback (most recent call last):
  File "vicare.py", line 56, in <module>
    print(t.getGasConsumptionHeatingUnit())
  File "/usr/local/lib/python3.7/dist-packages/PyViCare-2.13.0.post2+git.c95094c3-py3.7.egg/PyViCare/PyViCareUtils.py", line 45, in feature_flag_wrapper
  File "/usr/local/lib/python3.7/dist-packages/PyViCare-2.13.0.post2+git.c95094c3-py3.7.egg/PyViCare/PyViCareUtils.py", line 38, in wrapper
  File "/usr/local/lib/python3.7/dist-packages/PyViCare-2.13.0.post2+git.c95094c3-py3.7.egg/PyViCare/PyViCareGazBoiler.py", line 22, in getGasConsumptionHeatingUnit
    return self.service.getProperty("heating.gas.consumption.summary.heating")["properties"]["unit"]["value"]
  File "/usr/local/lib/python3.7/dist-packages/PyViCare-2.13.0.post2+git.c95094c3-py3.7.egg/PyViCare/PyViCareCachedService.py", line 26, in getProperty
    return readFeature(entities, property_name)
  File "/usr/local/lib/python3.7/dist-packages/PyViCare-2.13.0.post2+git.c95094c3-py3.7.egg/PyViCare/PyViCareService.py", line 17, in readFeature
    if(feature is None):
PyViCare.PyViCareUtils.PyViCareNotSupportedFeatureError: heating.gas.consumption.heating

What I'm doing wrong, is there a cache that sends old property_name heating.gas.consumption.heating instead of heating.gas.consumption.summary.heating?

@woehrl01
Copy link
Collaborator

woehrl01 commented Dec 7, 2021

Hi @elenril2,

There isn't an active cache. It's only stored in memory so after a restart it's gone.

As I haven't seen your new property on the wild. Do you have a dump to share?

@elenril2
Copy link
Contributor Author

elenril2 commented Dec 7, 2021

Hello @woehrl01, thanks for answer. Here is my dump: #225

@damianbro
Copy link
Contributor

Hello @elenril2 @woehrl01
I made some changes according to your dump. I made new json dump today and there are some additional data.
I made also new methods to get consumption with new API properties. Here is a Pull Request for that:
Pull Request #235

@woehrl01
Copy link
Collaborator

Thank you for your contribution. I just published 2.15.0

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

No branches or pull requests

3 participants