Skip to content

Commit

Permalink
Allow 'off' value for sensors from mqtt (#14)
Browse files Browse the repository at this point in the history
* Allow 'off' value for sensors from mqtt

* Fixing tests for new unit scales
  • Loading branch information
dotvezz authored May 5, 2023
1 parent 5fbf97e commit 4229ce3
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion libdyson/dyson_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ def _get_field_value(state: Dict[str, Any], field: str):

def _get_environmental_field_value(self, field, divisor=1) -> Optional[Union[int, float]]:
value = self._get_field_value(self._environmental_data, field)
if value == "OFF":
if value == "OFF" or value == "off":
return ENVIRONMENTAL_OFF
if value == "INIT":
return ENVIRONMENTAL_INIT
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = libdyson-neon
version = 1.0.1
version = 1.0.2
author = The libdyson Working Group
author_email = [email protected]
license = MIT License
Expand Down
4 changes: 2 additions & 2 deletions tests/test_pure_cool_formaldehyde.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,6 @@ def test_properties(mqtt_client: MockedMQTT):
device.request_environmental_data()
assert device.particulate_matter_2_5 == 9
assert device.particulate_matter_10 == 5
assert device.volatile_organic_compounds == 4
assert device.nitrogen_dioxide == 11
assert device.volatile_organic_compounds == 0.4
assert device.nitrogen_dioxide == 1.1
assert device.formaldehyde == 1
8 changes: 4 additions & 4 deletions tests/test_pure_cool_missing_env_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ def test_no_hcho(mqtt_client: MockedMQTT):
device.request_environmental_data()
assert device.particulate_matter_2_5 == 9
assert device.particulate_matter_10 == 5
assert device.volatile_organic_compounds == 4
assert device.nitrogen_dioxide == 11
assert device.volatile_organic_compounds == .4
assert device.nitrogen_dioxide == 1.1
assert device.formaldehyde is None


Expand Down Expand Up @@ -98,6 +98,6 @@ def test_missing_data(mqtt_client: MockedMQTT):
device.request_environmental_data()
assert device.particulate_matter_2_5 == 9
assert device.particulate_matter_10 == 5
assert device.volatile_organic_compounds == 4
assert device.nitrogen_dioxide == 11
assert device.volatile_organic_compounds == .4
assert device.nitrogen_dioxide == 1.1
assert device.formaldehyde is None
4 changes: 2 additions & 2 deletions tests/test_purifier_humidify_cool_formaldehyde.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,6 @@ def test_properties(mqtt_client: MockedMQTT):
device.request_environmental_data()
assert device.particulate_matter_2_5 == 9
assert device.particulate_matter_10 == 5
assert device.volatile_organic_compounds == 4
assert device.nitrogen_dioxide == 11
assert device.volatile_organic_compounds == .4
assert device.nitrogen_dioxide == 1.1
assert device.formaldehyde == 1

0 comments on commit 4229ce3

Please sign in to comment.