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

RooftopPvParser can not handle InfluxDB profiles #87

Open
4 tasks
noracato opened this issue Mar 7, 2023 · 1 comment
Open
4 tasks

RooftopPvParser can not handle InfluxDB profiles #87

noracato opened this issue Mar 7, 2023 · 1 comment
Assignees
Labels

Comments

@noracato
Copy link
Member

noracato commented Mar 7, 2023

In __set_production of the RooftopPvParser we add the values of the profiles of the ports like this:

self.production = sum((asset.port[0].profile[0].value for asset in assets_generator))

However, when a profile is referenced like in the InfluxDBProfile object, there is no direct attribute value.
We should find another way to get this value. As we cannot access the db from our app, the profile needs to be supplied to our API. Plan is to:

  • Create a new field in the API for profiles
  • Store the intermediate profiles in a new object/class
  • Mock the current implementation of the InfluxDBProfile object to reference our new profile objects.
  • Think of what to do (or tell the user) when the profile was not supplied

Part of #82

@noracato
Copy link
Member Author

For now I added a mocked method that returns 0 as a value when a profile was not found, so that the files at least make it through the API. We should change that according to the description of this issue.

See:

# Assuming there is only one port and one profile
self.production = sum((self.__value_mocked_for_influx_db(asset) for asset in assets_generator))
def __value_mocked_for_influx_db(self, asset):
'''If value is not found (like for influx db) return 0'''
try:
return asset.port[0].profile[0].value
except AttributeError:
return 0

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

No branches or pull requests

2 participants