Welcome to mvm_smart_meter’s documentation!
mvm_smart_meter package
Submodules
mvm_smart_meter.smart_meter module
- exception GuidNotFoundException(message='Guid not found in URL', url=None)[source]
Bases:
ExceptionException raised when the GUID is not found in a URL.
- Parameters:
message (str) – Custom error message describing the exception. Defaults to “Guid not found in URL”.
url (str) – URL where the GUID was not found. Defaults to None.
- Variables:
message – Custom error message describing the exception.
url – URL where the GUID was not found.
- class Smart_meter(username: str, password: str)[source]
Bases:
objectAll the main function to gather date from the smart metering site is gathered here
- download_ldc_data() object[source]
This function downloads the data inbetwen the previusly set dates.
- Returns:
returns text object
- Return type:
object
- get_base_cookies()[source]
Gets cookies from the main site to be used for later
- get_cookies_smart_meter_site()[source]
Get cookies from the main site.Need to find a workaround as requestium uses old version of selenium.
- get_custumer_data()[source]
Gets custumer data as it’s needs to be provided in the url’s later on.
- get_ldc()[source]
Loads the load curve site, as data is stored in html.
- get_login_cookies()[source]
Log’s into the main site, gets the cookies and the AuthCode for grabbing the token later on.
- get_smart_meter_data()[source]
The smart metering site is on a external site, this function gets thoose links into a list.
- get_token()[source]
Gets Oauth 2.0 token to be used on the main site for authorization
- set_date_for_ldc(date_from: str, date_to: str)[source]
Function for posting dates, as load curve data is stored in the html.
- Parameters:
date_from (str) – date where to start
date_to (str) – date where to end
- smart_site_accept_cookes()[source]
Accapts the cookies on the smart metering site.
- clean_data(df: DataFrame) DataFrame[source]
This function can clean up text response
- Parameters:
df (pandas.DataFrame) – Dataframe to be cleaned
- Returns:
Return a cleaned up dataframe
- Return type:
pandas.DataFrame
- data_to_dataframe(data: object) DataFrame[source]
Converts html/text request to dataframe
- Parameters:
data (object) – Text from request
- Returns:
Returns a dataframe
- Return type:
pandas.DataFrame
- date_list(date_from: str, date_to: str) list[source]
Makes a list with date’s between date_from and date_to
- Parameters:
date_from (str) – date_from in string
date_to (str) – date_to in string
- Returns:
Returns a list with all the dates
- Return type:
list
- get_all_load_curve(username: str, password: str, date_from=None, date_to=None, raw_data: bool = False) DataFrame[source]
It’s similar to get_load_curve(), but this function was intented to get all the available data from the smart matering site day by day
- Parameters:
username (str) – Username for smart metering site
password (str) – Password for smart metering site
date_from (_type_, optional) – Start to data where to start from, defaults to None
date_to (_type_, optional) – End date where to stop, defaults to None
raw_data (bool, optional) – Flag for cleaning up response txt, defaults to False
- Returns:
Return all valid daily load curve in Dataframe
- Return type:
pandas.DataFrame
- get_load_curve(username: str, password: str, date_from=None, date_to=None, raw_data: bool = False) DataFrame[source]
Get’s load curve data from smart metering site into a Dataframe
- Parameters:
username (str) – Username for smart metering site
password (str) – Password for smart metering site
date_from (_type_, optional) – Usualy date_from and date_to is the same date., defaults to None
date_to (_type_, optional) – Usualy date_from and date_to is the same date., defaults to None
raw_data (bool, optional) – Flag for cleaning up response txt, defaults to False
- Returns:
Returns load curve data between set dates into a Dataframe
- Return type:
pandas.DataFrame
- main()[source]
Main funtion intented for debuging
- sum_load_curve(load_curve_df: DataFrame) DataFrame[source]
Summation function for load curve data set
- Parameters:
load_curve_df (pandas.DataFrame) – Dataframe which summoned
- Returns:
Returns summed dataset
- Return type:
pandas.DataFrame
- validate_df(df_to_validate: DataFrame) bool[source]
Usualy smart metering site stores daily data for 3 months, after that all the daily data is deleted.Helper function for get_all_load_curve() to validate the date is valid on that date.
- Parameters:
df_to_validate (pandas.DataFrame) – Dataframe which validation is performed
- Returns:
Returns True when the Dataframe is valid
- Return type:
bool