Skip to content

Commit

Permalink
Renamed actuator reading types (#14)
Browse files Browse the repository at this point in the history
* Renamed actuator reading types

* Added space for range actuator
  • Loading branch information
djesic authored Aug 7, 2020
1 parent 4577bf4 commit f262187
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 25 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

setuptools.setup(
name="wolk-gateway-module",
version="1.0.6",
version="1.0.7",
install_requires=["paho_mqtt==1.4.0"],
include_package_data=True,
license="Apache License 2.0",
Expand Down
35 changes: 17 additions & 18 deletions test/test_json_registration_protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,32 +21,31 @@

from wolk_gateway_module.json_registration_protocol import (
JsonRegistrationProtocol,
)
from wolk_gateway_module.model.actuator_template import ActuatorTemplate
from wolk_gateway_module.model.alarm_template import AlarmTemplate
) # noqa
from wolk_gateway_module.model.actuator_template import (
ActuatorTemplate,
) # noqa
from wolk_gateway_module.model.alarm_template import AlarmTemplate # noqa
from wolk_gateway_module.model.configuration_template import (
ConfigurationTemplate,
)
from wolk_gateway_module.model.data_type import DataType
) # noqa
from wolk_gateway_module.model.data_type import DataType # noqa
from wolk_gateway_module.model.device_registration_request import (
DeviceRegistrationRequest,
)
) # noqa
from wolk_gateway_module.model.device_registration_response import (
DeviceRegistrationResponse,
)
) # noqa
from wolk_gateway_module.model.device_registration_response_result import (
DeviceRegistrationResponseResult,
)
from wolk_gateway_module.model.device_template import DeviceTemplate
from wolk_gateway_module.model.message import Message
) # noqa
from wolk_gateway_module.model.device_template import DeviceTemplate # noqa
from wolk_gateway_module.model.message import Message # noqa
from wolk_gateway_module.model.reading_type_measurement_unit import (
ReadingTypeMeasurementUnit,
)
from wolk_gateway_module.model.reading_type_name import ReadingTypeName
from wolk_gateway_module.model.sensor_template import SensorTemplate
from wolk_gateway_module.protocol.registration_protocol import (
RegistrationProtocol,
)
) # noqa
from wolk_gateway_module.model.reading_type_name import ReadingTypeName # noqa
from wolk_gateway_module.model.sensor_template import SensorTemplate # noqa


class JsonRegistrationProtocolTests(unittest.TestCase):
Expand Down Expand Up @@ -360,8 +359,8 @@ def test_full_device_registration_request(self):
+ ' "name": "Slider",'
+ ' "reference": "SL",'
+ ' "unit": {'
+ ' "readingTypeName": "COUNT(ACTUATOR)",'
+ ' "symbol": "count"'
+ ' "readingTypeName": "RANGE (ACTUATOR)",'
+ ' "symbol": ""'
+ " },"
+ ' "description": "",'
+ ' "minimum": 0,'
Expand Down
9 changes: 3 additions & 6 deletions wolk_gateway_module/model/actuator_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,19 +84,16 @@ def __init__(
raise ValueError("Invalid data type given")
if data_type == DataType.NUMERIC:
self.unit = {
"readingTypeName": "COUNT(ACTUATOR)",
"symbol": "count",
"readingTypeName": "RANGE (ACTUATOR)",
"symbol": "",
}
elif data_type == DataType.BOOLEAN:
self.unit = {
"readingTypeName": "SWITCH(ACTUATOR)",
"symbol": "",
}
elif data_type == DataType.STRING:
self.unit = {
"readingTypeName": "STRING(ACTUATOR)",
"symbol": "",
}
self.unit = {"readingTypeName": "TEXT(ACTUATOR)", "symbol": ""}
return

if not (reading_type_name and unit):
Expand Down

0 comments on commit f262187

Please sign in to comment.