Skip to content

Commit

Permalink
Merge pull request #65 from scs/feature/update
Browse files Browse the repository at this point in the history
Feature/update
  • Loading branch information
raymar9 authored Mar 26, 2024
2 parents d497a3e + 092151d commit 80e38db
Show file tree
Hide file tree
Showing 37 changed files with 471 additions and 577 deletions.
6 changes: 4 additions & 2 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,17 @@ name = "pypi"

[packages]
aioserial = "~=1.3.1"
asyncio-mqtt = "~=0.16.1"
gurux-dlms = "==1.0.143"
asyncio-mqtt = "~=0.16.2"
gurux-dlms = "==1.0.150"
paho-mqtt = "~=1.6.1"

[dev-packages]
autopep8 = "*"
chardet = "*"
isort = "*"
licenseheaders = "*"
pipenv-setup = "*"
plette = "~=0.4"
pylint = "*"
pytest = "*"
pytest-asyncio = "*"
Expand Down
954 changes: 429 additions & 525 deletions Pipfile.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions debian/postinst
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ echo -n "Installing dependencies using pip.."
# write a pip requirements.txt for automatic dependency installation
echo "-i https://pypi.org/simple
aioserial==1.3.1
asyncio-mqtt==0.16.1
gurux-dlms==1.0.143
asyncio-mqtt==0.16.2
gurux-dlms==1.0.150
paho-mqtt==1.6.1
pyserial==3.5" > /tmp/requirements.txt
# install all required dependencies
Expand Down
7 changes: 3 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
#
# Copyright (C) 2022 Supercomputing Systems AG
# Copyright (C) 2024 Supercomputing Systems AG
# This file is part of smartmeter-datacollector.
#
# SPDX-License-Identifier: GPL-2.0-only
Expand Down Expand Up @@ -39,7 +39,6 @@
"Development Status :: 5 - Production/Stable",
"License :: OSI Approved :: GNU General Public License v2 (GPLv2)",
"Programming Language :: Python",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
Expand All @@ -53,8 +52,8 @@
include_package_data=True,
install_requires=[
'aioserial==1.3.1',
'asyncio-mqtt==0.16.1',
'gurux-dlms==1.0.143',
'asyncio-mqtt==0.16.2',
'gurux-dlms==1.0.150',
'paho-mqtt==1.6.1',
'pyserial==3.5'
],
Expand Down
2 changes: 1 addition & 1 deletion smartmeter_datacollector/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (C) 2022 Supercomputing Systems AG
# Copyright (C) 2024 Supercomputing Systems AG
# This file is part of smartmeter-datacollector.
#
# SPDX-License-Identifier: GPL-2.0-only
Expand Down
2 changes: 1 addition & 1 deletion smartmeter_datacollector/__main__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (C) 2022 Supercomputing Systems AG
# Copyright (C) 2024 Supercomputing Systems AG
# This file is part of smartmeter-datacollector.
#
# SPDX-License-Identifier: GPL-2.0-only
Expand Down
2 changes: 1 addition & 1 deletion smartmeter_datacollector/__version__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (C) 2022 Supercomputing Systems AG
# Copyright (C) 2024 Supercomputing Systems AG
# This file is part of smartmeter-datacollector.
#
# SPDX-License-Identifier: GPL-2.0-only
Expand Down
2 changes: 1 addition & 1 deletion smartmeter_datacollector/app.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (C) 2022 Supercomputing Systems AG
# Copyright (C) 2024 Supercomputing Systems AG
# This file is part of smartmeter-datacollector.
#
# SPDX-License-Identifier: GPL-2.0-only
Expand Down
2 changes: 1 addition & 1 deletion smartmeter_datacollector/collector.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (C) 2022 Supercomputing Systems AG
# Copyright (C) 2024 Supercomputing Systems AG
# This file is part of smartmeter-datacollector.
#
# SPDX-License-Identifier: GPL-2.0-only
Expand Down
2 changes: 1 addition & 1 deletion smartmeter_datacollector/config.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (C) 2022 Supercomputing Systems AG
# Copyright (C) 2024 Supercomputing Systems AG
# This file is part of smartmeter-datacollector.
#
# SPDX-License-Identifier: GPL-2.0-only
Expand Down
2 changes: 1 addition & 1 deletion smartmeter_datacollector/factory.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (C) 2022 Supercomputing Systems AG
# Copyright (C) 2024 Supercomputing Systems AG
# This file is part of smartmeter-datacollector.
#
# SPDX-License-Identifier: GPL-2.0-only
Expand Down
2 changes: 1 addition & 1 deletion smartmeter_datacollector/sinks/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (C) 2022 Supercomputing Systems AG
# Copyright (C) 2024 Supercomputing Systems AG
# This file is part of smartmeter-datacollector.
#
# SPDX-License-Identifier: GPL-2.0-only
Expand Down
2 changes: 1 addition & 1 deletion smartmeter_datacollector/sinks/data_sink.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (C) 2022 Supercomputing Systems AG
# Copyright (C) 2024 Supercomputing Systems AG
# This file is part of smartmeter-datacollector.
#
# SPDX-License-Identifier: GPL-2.0-only
Expand Down
2 changes: 1 addition & 1 deletion smartmeter_datacollector/sinks/logger_sink.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (C) 2022 Supercomputing Systems AG
# Copyright (C) 2024 Supercomputing Systems AG
# This file is part of smartmeter-datacollector.
#
# SPDX-License-Identifier: GPL-2.0-only
Expand Down
2 changes: 1 addition & 1 deletion smartmeter_datacollector/sinks/mqtt_sink.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (C) 2022 Supercomputing Systems AG
# Copyright (C) 2024 Supercomputing Systems AG
# This file is part of smartmeter-datacollector.
#
# SPDX-License-Identifier: GPL-2.0-only
Expand Down
2 changes: 1 addition & 1 deletion smartmeter_datacollector/smartmeter/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (C) 2022 Supercomputing Systems AG
# Copyright (C) 2024 Supercomputing Systems AG
# This file is part of smartmeter-datacollector.
#
# SPDX-License-Identifier: GPL-2.0-only
Expand Down
2 changes: 1 addition & 1 deletion smartmeter_datacollector/smartmeter/cosem.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (C) 2022 Supercomputing Systems AG
# Copyright (C) 2024 Supercomputing Systems AG
# This file is part of smartmeter-datacollector.
#
# SPDX-License-Identifier: GPL-2.0-only
Expand Down
2 changes: 1 addition & 1 deletion smartmeter_datacollector/smartmeter/hdlc_dlms_parser.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (C) 2022 Supercomputing Systems AG
# Copyright (C) 2024 Supercomputing Systems AG
# This file is part of smartmeter-datacollector.
#
# SPDX-License-Identifier: GPL-2.0-only
Expand Down
2 changes: 1 addition & 1 deletion smartmeter_datacollector/smartmeter/iskraam550.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (C) 2022 Supercomputing Systems AG
# Copyright (C) 2024 Supercomputing Systems AG
# This file is part of smartmeter-datacollector.
#
# SPDX-License-Identifier: GPL-2.0-only
Expand Down
2 changes: 1 addition & 1 deletion smartmeter_datacollector/smartmeter/kamstrup_han.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (C) 2023 Supercomputing Systems AG
# Copyright (C) 2024 Supercomputing Systems AG
# This file is part of smartmeter-datacollector.
#
# SPDX-License-Identifier: GPL-2.0-only
Expand Down
2 changes: 1 addition & 1 deletion smartmeter_datacollector/smartmeter/lge360.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (C) 2022 Supercomputing Systems AG
# Copyright (C) 2024 Supercomputing Systems AG
# This file is part of smartmeter-datacollector.
#
# SPDX-License-Identifier: GPL-2.0-only
Expand Down
2 changes: 1 addition & 1 deletion smartmeter_datacollector/smartmeter/lge450.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (C) 2022 Supercomputing Systems AG
# Copyright (C) 2024 Supercomputing Systems AG
# This file is part of smartmeter-datacollector.
#
# SPDX-License-Identifier: GPL-2.0-only
Expand Down
2 changes: 1 addition & 1 deletion smartmeter_datacollector/smartmeter/meter.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (C) 2022 Supercomputing Systems AG
# Copyright (C) 2024 Supercomputing Systems AG
# This file is part of smartmeter-datacollector.
#
# SPDX-License-Identifier: GPL-2.0-only
Expand Down
2 changes: 1 addition & 1 deletion smartmeter_datacollector/smartmeter/meter_data.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (C) 2022 Supercomputing Systems AG
# Copyright (C) 2024 Supercomputing Systems AG
# This file is part of smartmeter-datacollector.
#
# SPDX-License-Identifier: GPL-2.0-only
Expand Down
2 changes: 1 addition & 1 deletion smartmeter_datacollector/smartmeter/obis.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (C) 2022 Supercomputing Systems AG
# Copyright (C) 2024 Supercomputing Systems AG
# This file is part of smartmeter-datacollector.
#
# SPDX-License-Identifier: GPL-2.0-only
Expand Down
2 changes: 1 addition & 1 deletion smartmeter_datacollector/smartmeter/reader.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (C) 2022 Supercomputing Systems AG
# Copyright (C) 2024 Supercomputing Systems AG
# This file is part of smartmeter-datacollector.
#
# SPDX-License-Identifier: GPL-2.0-only
Expand Down
2 changes: 1 addition & 1 deletion smartmeter_datacollector/smartmeter/serial_reader.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (C) 2022 Supercomputing Systems AG
# Copyright (C) 2024 Supercomputing Systems AG
# This file is part of smartmeter-datacollector.
#
# SPDX-License-Identifier: GPL-2.0-only
Expand Down
2 changes: 1 addition & 1 deletion tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (C) 2022 Supercomputing Systems AG
# Copyright (C) 2024 Supercomputing Systems AG
# This file is part of smartmeter-datacollector.
#
# SPDX-License-Identifier: GPL-2.0-only
Expand Down
5 changes: 1 addition & 4 deletions tests/test_collector.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (C) 2022 Supercomputing Systems AG
# Copyright (C) 2024 Supercomputing Systems AG
# This file is part of smartmeter-datacollector.
#
# SPDX-License-Identifier: GPL-2.0-only
Expand All @@ -22,7 +22,6 @@ def test_type() -> MeterDataPointType:
return MeterDataPointType("TEST_TYPE", "test type", "unit")


@pytest.mark.skipif(sys.version_info < (3, 8), reason="Python3.7 does not support AsyncMock.")
@pytest.mark.asyncio
async def test_collector_with_one_sink(mocker: MockerFixture, test_type: MeterDataPointType):
coll = Collector()
Expand All @@ -39,7 +38,6 @@ async def test_collector_with_one_sink(mocker: MockerFixture, test_type: MeterDa
sink.send.assert_awaited_once_with(data_point)


@pytest.mark.skipif(sys.version_info < (3, 8), reason="Python3.7 does not support AsyncMock.")
@pytest.mark.asyncio
async def test_collector_with_one_sink_multiple_data_points(mocker: MockerFixture, test_type: MeterDataPointType):
coll = Collector()
Expand All @@ -58,7 +56,6 @@ async def test_collector_with_one_sink_multiple_data_points(mocker: MockerFixtur
assert sink.send.await_count == 2


@pytest.mark.skipif(sys.version_info < (3, 8), reason="Python3.7 does not support AsyncMock.")
@pytest.mark.asyncio
async def test_collector_with_two_sinks(mocker: MockerFixture, test_type: MeterDataPointType):
coll = Collector()
Expand Down
2 changes: 1 addition & 1 deletion tests/test_config.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (C) 2022 Supercomputing Systems AG
# Copyright (C) 2024 Supercomputing Systems AG
# This file is part of smartmeter-datacollector.
#
# SPDX-License-Identifier: GPL-2.0-only
Expand Down
2 changes: 1 addition & 1 deletion tests/test_hdlc_dlms_parser.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (C) 2022 Supercomputing Systems AG
# Copyright (C) 2024 Supercomputing Systems AG
# This file is part of smartmeter-datacollector.
#
# SPDX-License-Identifier: GPL-2.0-only
Expand Down
4 changes: 1 addition & 3 deletions tests/test_iskraam550.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (C) 2022 Supercomputing Systems AG
# Copyright (C) 2024 Supercomputing Systems AG
# This file is part of smartmeter-datacollector.
#
# SPDX-License-Identifier: GPL-2.0-only
Expand All @@ -17,7 +17,6 @@
from .utils import *


@pytest.mark.skipif(sys.version_info < (3, 8), reason="Python3.7 does not support AsyncMock.")
@pytest.mark.asyncio
async def test_iskaam550_initialization(mocker: MockerFixture):
observer = mocker.stub()
Expand All @@ -33,7 +32,6 @@ async def test_iskaam550_initialization(mocker: MockerFixture):
observer.assert_not_called


@pytest.mark.skipif(sys.version_info < (3, 8), reason="Python3.7 does not support AsyncMock.")
@pytest.mark.asyncio
async def test_iskraam550_parse_and_provide_unencrypted_data(mocker: MockerFixture,
unencrypted_valid_data_iskra: List[bytes]):
Expand Down
5 changes: 1 addition & 4 deletions tests/test_lge450.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (C) 2022 Supercomputing Systems AG
# Copyright (C) 2024 Supercomputing Systems AG
# This file is part of smartmeter-datacollector.
#
# SPDX-License-Identifier: GPL-2.0-only
Expand All @@ -17,7 +17,6 @@
from .utils import *


@pytest.mark.skipif(sys.version_info < (3, 8), reason="Python3.7 does not support AsyncMock.")
@pytest.mark.asyncio
async def test_lge450_initialization(mocker: MockerFixture):
observer = mocker.stub()
Expand All @@ -33,7 +32,6 @@ async def test_lge450_initialization(mocker: MockerFixture):
observer.assert_not_called


@pytest.mark.skipif(sys.version_info < (3, 8), reason="Python3.7 does not support AsyncMock.")
@pytest.mark.asyncio
async def test_lge450_parse_and_provide_unencrypted_data(mocker: MockerFixture,
unencrypted_valid_data_lg: List[bytes]):
Expand Down Expand Up @@ -70,7 +68,6 @@ def data_received():
assert all(data.timestamp.strftime(r"%m/%d/%y %H:%M:%S") == "07/06/21 14:58:18" for data in values)


@pytest.mark.skipif(sys.version_info < (3, 8), reason="Python3.7 does not support AsyncMock.")
@pytest.mark.asyncio
async def test_lge450_do_not_provide_invalid_data(mocker: MockerFixture,
unencrypted_invalid_data_lg: List[bytes]):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_meter_data.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (C) 2022 Supercomputing Systems AG
# Copyright (C) 2024 Supercomputing Systems AG
# This file is part of smartmeter-datacollector.
#
# SPDX-License-Identifier: GPL-2.0-only
Expand Down
5 changes: 1 addition & 4 deletions tests/test_mqtt_sink.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (C) 2022 Supercomputing Systems AG
# Copyright (C) 2024 Supercomputing Systems AG
# This file is part of smartmeter-datacollector.
#
# SPDX-License-Identifier: GPL-2.0-only
Expand All @@ -22,7 +22,6 @@
TEST_TYPE = MeterDataPointType("TEST_TYPE", "test type", "unit")


@pytest.mark.skipif(sys.version_info < (3, 8), reason="Python3.7 does not support AsyncMock.")
@pytest.mark.asyncio
async def test_mqtt_sink_start_stop(mocker: MockerFixture):
config = MqttConfig("localhost")
Expand All @@ -36,7 +35,6 @@ async def test_mqtt_sink_start_stop(mocker: MockerFixture):
client_mock.disconnect.assert_awaited_once()


@pytest.mark.skipif(sys.version_info < (3, 8), reason="Python3.7 does not support AsyncMock.")
@pytest.mark.asyncio
async def test_mqtt_sink_send_point_when_started(mocker: MockerFixture):
config = MqttConfig("localhost")
Expand All @@ -55,7 +53,6 @@ async def test_mqtt_sink_send_point_when_started(mocker: MockerFixture):
client_mock.publish.assert_awaited_once_with(expected_topic, expected_payload)


@pytest.mark.skipif(sys.version_info < (3, 8), reason="Python3.7 does not support AsyncMock.")
@pytest.mark.asyncio
async def test_mqtt_sink_send_reconnect_when_not_started(mocker: MockerFixture):
config = MqttConfig("localhost")
Expand Down
2 changes: 1 addition & 1 deletion tests/test_obis.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (C) 2022 Supercomputing Systems AG
# Copyright (C) 2024 Supercomputing Systems AG
# This file is part of smartmeter-datacollector.
#
# SPDX-License-Identifier: GPL-2.0-only
Expand Down
2 changes: 1 addition & 1 deletion tests/utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (C) 2022 Supercomputing Systems AG
# Copyright (C) 2024 Supercomputing Systems AG
# This file is part of smartmeter-datacollector.
#
# SPDX-License-Identifier: GPL-2.0-only
Expand Down

0 comments on commit 80e38db

Please sign in to comment.