Skip to content

Commit

Permalink
feat: update grpc dependency to allow device info in reading responses
Browse files Browse the repository at this point in the history
  • Loading branch information
edaniszewski committed Jan 19, 2021
1 parent db90a03 commit 98ed0c6
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ shortuuid==1.0.1 # via synse_server (setup.py)
six==1.15.0 # via google-auth, grpcio, kubernetes, protobuf, python-dateutil, structlog, websocket-client
sniffio==1.1.0 # via httpx
structlog==20.1.0 # via synse_server (setup.py)
synse-grpc==3.0.0 # via synse_server (setup.py)
synse-grpc==3.1.0 # via synse_server (setup.py)
ujson==2.0.3 # via sanic
urllib3==1.25.10 # via httpx, kubernetes, requests
uvloop==0.14.0 # via sanic
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
'shortuuid',
'structlog>=20.1.0',
'websockets',
'synse-grpc==3.0.0',
'synse-grpc==3.1.0',
],
zip_safe=False,
classifiers=[
Expand Down
1 change: 1 addition & 0 deletions synse_server/cmd/read.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ def reading_to_dict(reading: api.V3Reading) -> Dict[str, Any]:
'timestamp': reading.timestamp,
'type': reading.type,
'device_type': reading.deviceType,
'device_info': reading.deviceInfo,
'unit': unit,
'value': value,
'context': dict(reading.context),
Expand Down
11 changes: 11 additions & 0 deletions tests/unit/cmd/test_read.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ async def test_read_ok_no_tags(mocker, simple_plugin, temperature_reading, humid
'timestamp': '2019-04-22T13:30:00Z',
'type': 'temperature',
'device_type': 'temperature',
'device_info': 'Example Temperature Device',
'unit': {
'name': 'celsius',
'symbol': 'C',
Expand All @@ -194,6 +195,7 @@ async def test_read_ok_no_tags(mocker, simple_plugin, temperature_reading, humid
'timestamp': '2019-04-22T13:30:00Z',
'type': 'humidity',
'device_type': 'humidity',
'device_info': 'Example Humidity Device',
'unit': {
'name': 'percent',
'symbol': '%',
Expand Down Expand Up @@ -240,6 +242,7 @@ async def test_read_ok_tags_with_ns(mocker, simple_plugin, state_reading):
'timestamp': '2019-04-22T13:30:00Z',
'type': 'state',
'device_type': 'led',
'device_info': 'Example LED Device',
'value': 'on',
'unit': None,
'context': {},
Expand Down Expand Up @@ -286,6 +289,7 @@ async def test_read_ok_tags_without_ns(mocker, simple_plugin, state_reading):
'timestamp': '2019-04-22T13:30:00Z',
'type': 'state',
'device_type': 'led',
'device_info': 'Example LED Device',
'value': 'on',
'unit': None,
'context': {},
Expand Down Expand Up @@ -332,6 +336,7 @@ async def test_read_ok_single_tag_group_without_ns(mocker, simple_plugin, state_
'timestamp': '2019-04-22T13:30:00Z',
'type': 'state',
'device_type': 'led',
'device_info': 'Example LED Device',
'value': 'on',
'unit': None,
'context': {},
Expand Down Expand Up @@ -378,6 +383,7 @@ async def test_read_ok_single_tag_group_without_ns_with_plugin(
'timestamp': '2019-04-22T13:30:00Z',
'type': 'state',
'device_type': 'led',
'device_info': 'Example LED Device',
'value': 'on',
'unit': None,
'context': {},
Expand Down Expand Up @@ -489,6 +495,7 @@ async def test_read_device_ok(mocker, simple_plugin, temperature_reading):
'timestamp': '2019-04-22T13:30:00Z',
'type': 'temperature',
'device_type': 'temperature',
'device_info': 'Example Temperature Device',
'unit': {
'name': 'celsius',
'symbol': 'C',
Expand Down Expand Up @@ -578,6 +585,7 @@ def patchreadcache(*args, **kwargs):
'timestamp': '2019-04-22T13:30:00Z',
'type': 'humidity',
'device_type': 'humidity',
'device_info': 'Example Humidity Device',
'unit': {
'name': 'percent',
'symbol': '%',
Expand Down Expand Up @@ -624,6 +632,7 @@ def test_reading_to_dict_1(temperature_reading):
'timestamp': '2019-04-22T13:30:00Z',
'type': 'temperature',
'device_type': 'temperature',
'device_info': 'Example Temperature Device',
'unit': {
'name': 'celsius',
'symbol': 'C',
Expand All @@ -643,6 +652,7 @@ def test_reading_to_dict_2(humidity_reading):
'timestamp': '2019-04-22T13:30:00Z',
'type': 'humidity',
'device_type': 'humidity',
'device_info': 'Example Humidity Device',
'unit': {
'name': 'percent',
'symbol': '%',
Expand All @@ -660,6 +670,7 @@ def test_reading_to_dict_3(state_reading):
'timestamp': '2019-04-22T13:30:00Z',
'type': 'state',
'device_type': 'led',
'device_info': 'Example LED Device',
'value': 'on',
'unit': None,
'context': {},
Expand Down
3 changes: 3 additions & 0 deletions tests/unit/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ def temperature_reading():
timestamp='2019-04-22T13:30:00Z',
type='temperature',
deviceType='temperature',
deviceInfo='Example Temperature Device',
context={'zone': '1'},
unit=api.V3OutputUnit(
name='celsius',
Expand All @@ -188,6 +189,7 @@ def humidity_reading():
timestamp='2019-04-22T13:30:00Z',
type='humidity',
deviceType='humidity',
deviceInfo='Example Humidity Device',
unit=api.V3OutputUnit(
name='percent',
symbol='%',
Expand All @@ -205,6 +207,7 @@ def state_reading():
timestamp='2019-04-22T13:30:00Z',
type='state',
deviceType='led',
deviceInfo='Example LED Device',
string_value='on',
)

Expand Down

0 comments on commit 98ed0c6

Please sign in to comment.