Skip to content

Commit

Permalink
Add methods for requesting tests and calibrations (#114)
Browse files Browse the repository at this point in the history
  • Loading branch information
joostlek authored Jun 18, 2024
1 parent 1a27570 commit c5bd413
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/airgradient/airgradient.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,14 @@ async def set_led_bar_mode(self, led_bar_mode: LedBarMode) -> None:
"""Set LED bar mode on AirGradient device."""
await self._set_config("ledBarMode", led_bar_mode)

async def request_co2_calibration(self) -> None:
"""Request CO2 calibration on AirGradient device."""
await self._set_config("co2CalibrationRequested", value=True)

async def request_led_bar_test(self) -> None:
"""Request LED bar test on AirGradient device."""
await self._set_config("ledBarTestRequested", value=True)

async def close(self) -> None:
"""Close open client session."""
if self.session and self._close_session:
Expand Down
8 changes: 8 additions & 0 deletions tests/test_airgradient.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,14 @@ async def test_config(
lambda client: client.set_led_bar_mode(LedBarMode.CO2),
{"ledBarMode": "co2"},
),
(
lambda client: client.request_co2_calibration(),
{"co2CalibrationRequested": True},
),
(
lambda client: client.request_led_bar_test(),
{"ledBarTestRequested": True},
),
],
)
async def test_setting_config(
Expand Down

0 comments on commit c5bd413

Please sign in to comment.