Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Commit

Permalink
Bugfix: gravity should be a float/1000
Browse files Browse the repository at this point in the history
  • Loading branch information
myoung34 committed Feb 28, 2020
1 parent 7a7a910 commit 6cc5a33
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>"]
license = "MIT"
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
6 changes: 3 additions & 3 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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(
Expand All @@ -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
2 changes: 1 addition & 1 deletion tilty/tilt_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
}
Expand Down

0 comments on commit 6cc5a33

Please sign in to comment.