diff --git a/pyproject.toml b/pyproject.toml index 535ca64..78100f6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "Tilty" -version = "0.3.1" +version = "0.3.2" description = "A pluggable system to receive and transmit bluetooth events from the Tilt Hydrometer" authors = ["Marcus Young <3vilpenguin@gmail.com>"] license = "MIT" diff --git a/setup.py b/setup.py index 10cddaf..23bae35 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ long_description=long_description, long_description_content_type="text/markdown", py_modules=['tilty', 'blescan'], - version='0.3.1', + version='0.3.2', packages=find_packages(exclude=['tests*']), install_requires=[ 'Click', diff --git a/tests/test_cli.py b/tests/test_cli.py index 3ea8c3e..b9435e9 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -26,7 +26,7 @@ def test_cli_invalid_params(): assert result.output == 'Usage: run [OPTIONS]\nTry "run --help" for help.\n\nError: no such option: --foo\n' # noqa -@mock.patch('tilty.blescan.parse_events', return_value=[{'uuid': 'foo', 'major': 2, 'minor': 1}]) # noqa +@mock.patch('tilty.blescan.parse_events', return_value=[{'uuid': 'foo', 'major': 78, 'minor': 1833}]) # noqa @mock.patch('tilty.blescan.hci_le_set_scan_parameters') # noqa @mock.patch('tilty.blescan.hci_enable_le_scan') # noqa def test_cli_no_params_no_valid_data( @@ -53,7 +53,7 @@ def test_cli_no_params_no_data( assert result.exit_code == 0 assert result.output == 'Scanning for Tilt data...\n\n' # noqa -@mock.patch('tilty.blescan.parse_events', return_value=[{'uuid': 'a495bb30c5b14b44b5121370f02d74de', 'major': 2, 'minor': 1}]) # noqa +@mock.patch('tilty.blescan.parse_events', return_value=[{'uuid': 'a495bb30c5b14b44b5121370f02d74de', 'major': 60, 'minor': 1053}]) # noqa @mock.patch('tilty.blescan.hci_le_set_scan_parameters') # noqa @mock.patch('tilty.blescan.hci_enable_le_scan') # noqa def test_cli_no_params_success( @@ -64,4 +64,4 @@ def test_cli_no_params_success( runner = CliRunner() result = runner.invoke(cli.run, []) assert result.exit_code == 0 - assert "Scanning for Tilt data...\n{'color': 'Black', 'gravity': 1, 'temp': 2, 'timestamp'" in result.output# noqa + assert "Scanning for Tilt data...\n{'color': 'Black', 'gravity': 1.053, 'temp': 60, 'timestamp'" in result.output# noqa diff --git a/tilty/tilt_device.py b/tilty/tilt_device.py index 5d62ad6..98bb3bd 100644 --- a/tilty/tilt_device.py +++ b/tilty/tilt_device.py @@ -42,7 +42,7 @@ def scan_for_tilt_data(self): if beacon['uuid'] in constants.TILT_DEVICES: data = { 'color': constants.TILT_DEVICES[beacon['uuid']], - 'gravity': beacon['minor'], + 'gravity': float(beacon['minor']/1000), 'temp': beacon['major'], 'timestamp': datetime.now().isoformat(), }