Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,4 @@ typed-ast==1.4.2
typing-extensions==3.7.4.3
urllib3==1.26.4
webencodings==0.5.1
getmac==0.8.2
6 changes: 4 additions & 2 deletions tests/test_connector.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from getmac import get_mac_address

from thingooConnector.device_info import DeviceInfo
from thingooConnector.entity import Entity
from thingooConnector.httpconnector import HTTPCredentials, HTTPConnector
Expand All @@ -18,7 +20,7 @@ def test_json():
connector = HTTPConnector("#", device_info, [temp, hum], credentials)

data = connector._create_registration_form()
# FIXME Testing with real macAddress
mac = get_mac_address()
if str(
data) != "{'key': 'test', 'macAddress': '00:00:00:00:00:00', 'displayName': 'test device', 'entities': [{'key': 'temp', 'type': 'SENSOR', 'valueType': 'DECIMAL', 'unitDisplayName': 'C'}, {'key': 'hum', 'type': 'SENSOR', 'valueType': 'DECIMAL', 'unitDisplayName': '%'}]}":
data) != "{'key': 'test', 'macAddress': '" + mac + "', 'displayName': 'test device', 'entities': [{'key': 'temp', 'type': 'SENSOR', 'valueType': 'DECIMAL', 'unitDisplayName': 'C'}, {'key': 'hum', 'type': 'SENSOR', 'valueType': 'DECIMAL', 'unitDisplayName': '%'}]}":
raise AssertionError
4 changes: 1 addition & 3 deletions thingooConnector/device_info.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
def get_mac_address():
# TODO Get real MAC address from device
return "00:00:00:00:00:00"
from getmac import get_mac_address


class DeviceInfo:
Expand Down