Skip to content

Commit b496d33

Browse files
committed
fan duration zero == "off"
1 parent 9e08690 commit b496d33

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

custom_components/google_nest_fan/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,10 @@ async def _async_run_fan(call: ServiceCall) -> None:
8484
for device in devices:
8585
trait: FanTrait = device.traits[FanTrait.NAME]
8686
try:
87-
await trait.set_timer("ON", duration=round(duration.total_seconds()))
87+
if duration.total_seconds() > 0:
88+
await trait.set_timer("ON", duration=round(duration.total_seconds()))
89+
else:
90+
await trait.set_timer("OFF")
8891
except ApiException as err:
8992
raise ServiceValidationError(
9093
f"Error setting fan run time for {device.name} {duration.total_seconds()}s: {err}"

0 commit comments

Comments
 (0)