Skip to content

Fix humidifier platform for Comelit #141854

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion homeassistant/components/comelit/humidifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@

async def async_set_humidity(self, humidity: int) -> None:
"""Set new target humidity."""
if self.mode == HumidifierComelitMode.OFF:
if not self._attr_is_on:

Check warning on line 165 in homeassistant/components/comelit/humidifier.py

View check run for this annotation

Codecov / codecov/patch

homeassistant/components/comelit/humidifier.py#L165

Added line #L165 was not covered by tests
raise ServiceValidationError(
translation_domain=DOMAIN,
translation_key="humidity_while_off",
Expand Down Expand Up @@ -190,9 +190,13 @@
await self.coordinator.api.set_humidity_status(
self._device.index, self._set_command
)
self._attr_is_on = True
self.async_write_ha_state()

Check warning on line 194 in homeassistant/components/comelit/humidifier.py

View check run for this annotation

Codecov / codecov/patch

homeassistant/components/comelit/humidifier.py#L193-L194

Added lines #L193 - L194 were not covered by tests

async def async_turn_off(self, **kwargs: Any) -> None:
"""Turn off."""
await self.coordinator.api.set_humidity_status(
self._device.index, HumidifierComelitCommand.OFF
)
self._attr_is_on = False
self.async_write_ha_state()

Check warning on line 202 in homeassistant/components/comelit/humidifier.py

View check run for this annotation

Codecov / codecov/patch

homeassistant/components/comelit/humidifier.py#L201-L202

Added lines #L201 - L202 were not covered by tests
4 changes: 3 additions & 1 deletion homeassistant/components/comelit/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@
"rest": "Rest",
"sabotated": "Sabotated"
}
},
}
},
"humidifier": {
"humidifier": {
"name": "Humidifier"
},
Expand Down