Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
tstorek committed Mar 22, 2022
2 parents 7eb32a0 + afc4b42 commit 5c2512c
Show file tree
Hide file tree
Showing 15 changed files with 37 additions and 17 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
#### v0.2.2
- Updated requirements for tutorials ([#132](https://github.com/RWTH-EBC/FiLiP/issues/132))
- fixed quantumleap timeseries header ([#133](https://github.com/RWTH-EBC/FiLiP/issues/133))
- fixed broken imports for tutorials ([#134](https://github.com/RWTH-EBC/FiLiP/issues/134))

#### v0.2.1
- Updated documentation ([#128](https://github.com/RWTH-EBC/FiLiP/issues/128))
- Improve tutorials ([#127](https://github.com/RWTH-EBC/FiLiP/issues/127))
Expand Down
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
author = 'E.ON ERC - EBC'

# The full version, including alpha/beta/rc tags
release = '0.2.1'
release = '0.2.2'

# The short X.Y version.
version = '.'.join(release.split('.')[0:2])
Expand Down
2 changes: 1 addition & 1 deletion filip/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
from filip.config import settings
from filip.clients.ngsi_v2 import HttpClient

__version__ = '0.2.1'
__version__ = '0.2.2'
8 changes: 4 additions & 4 deletions filip/models/ngsi_v2/timeseries.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""
from __future__ import annotations
import logging
from typing import Any, List
from typing import Any, List, Union
from datetime import datetime
import numpy as np
import pandas as pd
Expand All @@ -18,7 +18,7 @@ class TimeSeriesBase(BaseModel):
"""
Base model for other time series api models
"""
index: List[datetime] = Field(
index: Union[List[datetime], datetime] = Field(
default=None,
description="Array of the timestamps which are indexes of the response "
"for the requested data. It's a parallel array to 'values'."
Expand All @@ -37,7 +37,7 @@ class TimeSeriesHeader(TimeSeriesBase):
"""
Model to describe an available entity in the time series api
"""
# aliases are required due to inconsistencies in the api-specs
# aliases are required due to formally inconsistencies in the api-specs
entityId: str = Field(default=None,
alias="id",
description="The entity id the time series api."
Expand All @@ -51,7 +51,7 @@ class TimeSeriesHeader(TimeSeriesBase):
description="The type of an entity")

class Config:
allow_population_by_field_name = False
allow_population_by_field_name = True


class IndexedValues(BaseModel):
Expand Down
4 changes: 3 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,6 @@ wget >=3.2
stringcase>=1.2.0
igraph==0.9.8
paho-mqtt>=1.6.1
datamodel_code_generator[http]>=0.11.16
datamodel_code_generator[http]>=0.11.16
# tutorials
matplotlib>=3.5.1
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

setuptools.setup(
name='filip',
version='0.2.1',
version='0.2.2',
author='RWTH Aachen University, E.ON Energy Research Center, Institute\
of Energy Efficient Buildings and Indoor Climate',
author_email='[email protected]',
Expand Down
15 changes: 14 additions & 1 deletion tests/models/test_ngsiv2_timeseries.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""
import logging
import unittest
from filip.models.ngsi_v2.timeseries import TimeSeries
from filip.models.ngsi_v2.timeseries import TimeSeries, TimeSeriesHeader


logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -72,6 +72,12 @@ def setUp(self) -> None:
]
}

self.timeseries_header = {"entityId": "test_id",
"entityType": "test_type"}

self.timeseries_header_alias = {"id": "test_id",
"type": "test_type"}

def test_model_creation(self):
"""
Test model creation
Expand All @@ -92,6 +98,13 @@ def test_extend(self):
with self.assertRaises(AssertionError):
ts1.extend(ts2)

def test_timeseries_header(self):
header = TimeSeriesHeader(**self.timeseries_header)
header_by_alias = TimeSeriesHeader(**self.timeseries_header_alias)
self.assertEqual(header.dict(), header_by_alias.dict())
self.assertEqual(header.dict(by_alias=True),
header_by_alias.dict(by_alias=True))


if __name__ == '__main__':
unittest.main()
2 changes: 1 addition & 1 deletion tutorials/ngsi_v2/e1_virtual_weatherstation.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import paho.mqtt.client as mqtt

# import simulation model
from tutorial.ngsi_v2.simulation_model import SimulationModel
from tutorials.ngsi_v2.simulation_model import SimulationModel


# ## Parameters
Expand Down
2 changes: 1 addition & 1 deletion tutorials/ngsi_v2/e1_virtual_weatherstation_solution.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import paho.mqtt.client as mqtt

# import simulation model
from tutorial.ngsi_v2.simulation_model import SimulationModel
from tutorials.ngsi_v2.simulation_model import SimulationModel


# ## Parameters
Expand Down
2 changes: 1 addition & 1 deletion tutorials/ngsi_v2/e4_iot_thermal_zone_sensors.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
from filip.models.ngsi_v2.iot import Device, DeviceAttribute, ServiceGroup
from filip.utils.cleanup import clear_context_broker, clear_iot_agent
# import simulation model
from tutorial.ngsi_v2.simulation_model import SimulationModel
from tutorials.ngsi_v2.simulation_model import SimulationModel

# ## Parameters
# ToDo: Enter your context broker host and port, e.g. http://localhost:1026
Expand Down
2 changes: 1 addition & 1 deletion tutorials/ngsi_v2/e4_iot_thermal_zone_sensors_solution.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
from filip.models.ngsi_v2.iot import Device, DeviceAttribute, ServiceGroup
from filip.utils.cleanup import clear_context_broker, clear_iot_agent
# import simulation model
from tutorial.ngsi_v2.simulation_model import SimulationModel
from tutorials.ngsi_v2.simulation_model import SimulationModel

# ## Parameters
# ToDo: Enter your context broker host and port, e.g. http://localhost:1026
Expand Down
2 changes: 1 addition & 1 deletion tutorials/ngsi_v2/e5_iot_thermal_zone_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
ServiceGroup
from filip.utils.cleanup import clear_context_broker, clear_iot_agent
# import simulation model
from tutorial.ngsi_v2.simulation_model import SimulationModel
from tutorials.ngsi_v2.simulation_model import SimulationModel

# ## Parameters
# ToDo: Enter your context broker host and port, e.g http://localhost:1026
Expand Down
2 changes: 1 addition & 1 deletion tutorials/ngsi_v2/e5_iot_thermal_zone_control_solution.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
ServiceGroup
from filip.utils.cleanup import clear_context_broker, clear_iot_agent
# import simulation model
from tutorial.ngsi_v2.simulation_model import SimulationModel
from tutorials.ngsi_v2.simulation_model import SimulationModel

# ## Parameters
# ToDo: Enter your context broker host and port, e.g http://localhost:1026
Expand Down
2 changes: 1 addition & 1 deletion tutorials/ngsi_v2/e6_timeseries_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
clear_iot_agent, \
clear_quantumleap
# import simulation model
from tutorial.ngsi_v2.simulation_model import SimulationModel
from tutorials.ngsi_v2.simulation_model import SimulationModel

# ## Parameters
# ToDo: Enter your context broker host and port, e.g http://localhost:1026
Expand Down
2 changes: 1 addition & 1 deletion tutorials/ngsi_v2/e6_timeseries_data_solution.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
clear_iot_agent, \
clear_quantumleap
# import simulation model
from tutorial.ngsi_v2.simulation_model import SimulationModel
from tutorials.ngsi_v2.simulation_model import SimulationModel

# ## Parameters
# ToDo: Enter your context broker host and port, e.g http://localhost:1026
Expand Down

0 comments on commit 5c2512c

Please sign in to comment.