SmartIR
SmartIR copied to clipboard
Fan Oscillate sends "off" base64 command regardless of whether the fan is off or on
the problem in here
`async def send_command(self): async with self._temp_lock: self._on_by_remote = False speed = self._speed direction = self._direction or 'default' oscillating = self._oscillating
if speed.lower() == SPEED_OFF:
command = self._commands['off']
elif oscillating:
command = self._commands['oscillate']
else:
command = self._commands[direction][speed]
try:
await self._controller.send(command)
except Exception as e:
_LOGGER.exception(e)`
I have found a fix by help of ai and the oscillate work fine now,but there is another problem appeared after this that the first turn on for the fan after homeassistant restart doesnt work this is the new code
`async def send_command(self): async with self._temp_lock: self._on_by_remote = False speed = self._speed direction = self._direction or 'default' oscillating = self._oscillating
if not hasattr(self, '_last_oscillating'):
self._last_oscillating = None
try:
if oscillating != self._last_oscillating and 'oscillate' in self._commands:
command = self._commands['oscillate']
self._last_oscillating = oscillating
elif speed is None or speed.lower() == SPEED_OFF:
command = self._commands['off']
else:
command = self._commands[direction][speed]
await self._controller.send(command)
except Exception as e:
_LOGGER.exception("Failed to send IR command: %s", e)
`