Skip to content

Commit 14bcc6a

Browse files
committed
Changed currentSwitchStateV2 back to currentSwitchState, as currentSwitchState is the right one to use in a filter. Added initial codecov reporting for tests.
1 parent cb83246 commit 14bcc6a

4 files changed

Lines changed: 10 additions & 15 deletions

File tree

crownstone_cloud/cloud_models/crownstones.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def __iter__(self):
2626
async def async_update_crownstone_data(self) -> None:
2727
"""Get the crownstones data from the cloud."""
2828
# include abilities and current switch state in the request
29-
data_filter = {"include": ["currentSwitchStateV2", {"abilities": "properties"}]}
29+
data_filter = {"include": ["currentSwitchState", {"abilities": "properties"}]}
3030
# request data
3131
crownstone_data = await self.cloud.request_handler.get(
3232
'Spheres', 'ownedStones', filter=data_filter, model_id=self.sphere_id
@@ -147,7 +147,7 @@ def icon(self) -> str:
147147
@property
148148
def state(self) -> int:
149149
"""Return the last reported switch state (0 - 100) of this Crownstone."""
150-
return self.data['currentSwitchStateV2']['switchState']
150+
return self.data['currentSwitchState']['switchState']
151151

152152
@state.setter
153153
def state(self, value: int) -> None:
@@ -156,7 +156,7 @@ def state(self, value: int) -> None:
156156
157157
Only updates state in cloud, does not send a switch command to the actual Crownstone.
158158
"""
159-
self.data['currentSwitchStateV2']['switchState'] = value
159+
self.data['currentSwitchState']['switchState'] = value
160160

161161
def update_abilities(self) -> None:
162162
"""Add/update the abilities for this Crownstone."""

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
aiohttp>=3.6.2
22
asynctest>=0.13.0
3+
codecov>=2.1.10
34
certifi

setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1+
"""Setup for Crownstone Cloud library."""
12
from setuptools import setup, find_packages
23

34
with open("README.md", "r") as fh:
45
long_description = fh.read()
56

67
setup(
78
name='crownstone-cloud',
8-
version='2.0.0',
9+
version='1.4.2',
910
long_description=long_description,
1011
long_description_content_type="text/markdown",
1112
url='https://github.com/crownstone/crownstone-lib-python-cloud',

tox.ini

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,10 @@
1-
# tox (https://tox.readthedocs.io/) is a tool for running tests
2-
# in multiple virtualenvs. This configuration file will run the
3-
# test suite on all supported python versions. To use it, "pip install tox"
4-
# and then run "tox" from this directory.
5-
61
[tox]
72
envlist = py38
83

94
[testenv]
10-
deps =
11-
aiohttp
12-
coverage
13-
asynctest
5+
deps = -r{toxinidir}/requirements.txt
6+
passenv = CI TRAVIS TRAVIS_*
147
commands =
15-
# NOTE: you can run any command line tool here - not just tests
168
coverage run --source crownstone_cloud -m unittest discover -v
17-
coverage report
9+
coverage report
10+
codecov -e TOXENV

0 commit comments

Comments
 (0)