diff --git a/codes/fan/1230.json b/codes/fan/1230.json new file mode 100644 index 000000000..3e521251f --- /dev/null +++ b/codes/fan/1230.json @@ -0,0 +1,33 @@ +{ + "manufacturer": "EGLO", + "supportedModels": [ + "35014", + "35015", + "35016", + "35017", + "35069", + "35071", + "35072", + "35073" + ], + "supportedController": "Broadlink", + "commandsEncoding": "Base64", + "speed": [ + "1", + "2", + "3", + "4", + "5" + ], + "commands": { + "off": "scAGAeKeBgAbAAPiC7wLHQsdHgkLHR8JHgoKHh4KCh0LHR4KHgodCwodCh4KHgoeCh0KHgoeCh4KHR8JHgoKvQoeCh0fCQsdHgoeCgodHgoKHgoeHgkeCh4KCh4KHgodCx0KHgoeCh0LHQsdHgoeCgq8Cx0KHh4KCh4eCR4KCh4eCgodCx0eCh4KHgoKHgkeCh4KHgodCx0KHgoeCh0fCR4KCr0KHgodHwkKHh4KHgoKHh4JCx0KHh4KHgkeCgoeCh4KHQsdCh4KHgoeCh0LHR8JHgoKvQodCx0eCgoeHgoeCQoeHgoKHgoeHQoeCh4KCh4KHQoeCh4KHgodCx0LHQoeHgoeCQsABdw=", + "default": { + "1": "scAGAcSeBgAfAAPlC7wLHQodHwkLHR4KHgoKHh4JCx0KHh4KHgoeCgkfCR4KHgoeCh0KHgoeCh4eCgodHgoKvQoeCh4eCQsdHgoeCgoeHgkLHQoeHgoeCh4KCR4KHgoeCh4KHQsdCh4KHh4KCh0eCgu8Ch4KHh4KCh0fCR4KCh4eCgkeCh4eCh4KHgoJHgoeCh4KHgodCx0KHgoeHgoKHR4KCr0KHgoeHgoKHR4KHgoKHh4JCx0KHh4KHgoeCgkeCh4KHgoeCh0LHQoeCh4eCgodHgoKvQoeCh4eCgodHwkeCgoeHgkKHgoeHgoeCh4KCh0KHgoeCh4KHQoeCh4KHh4KCh0eCgoABdw=", + "2": "scAGAdieBgAdAAPpC7wLHQsdHgkLHR8JHwkLHR4KCh4KHR4KHgoeCgoeCh4JHgoeCh4KHgodHgoKHh4KCh0LvAsdC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eCh4KCh4eCQsdCh4eCh4KHgoJHgoeCh4KHgoeCh0KHh4KCh4KHh4JC7wLHQsdHgoKHh4JHwkKHh4KCh4KHh4KHQoeCgoeCh4KHQsdCh4KHgoeHgoKHQsdHgoKvQoeCh4eCQsdHwkeCgoeHgoKHQsdHgoeCh4KCh4KHQsdCh4KHgoeCh0eCgoeCh4eCgoABD8EAAJ/BD0E6ATSBIUEPAQXBAAF3A==", + "5": "scAGAdieBgAZAAPlCr0KHQsdHwkKHh4KHgoJHh4KCh4KHh4KHQoeCgoeCh4KHgoeCR4KHgoeCh4KHR8JCh4KvQoeCh4eCQsdHgoeCgoeHgoKHgkeHgoeCh4KCh4KHQsdCh4KHgoeCh0LHQsdHgoKHgq9Ch4KHR8JCx0eCh4KCh4eCgodCh4eCh4KHgoJHgoeCh4KHgodCx0LHQoeCh4eCgoeCr0KHQsdHgoKHh4KHgkLHR4KCh4KHh4KHgkeCgoeCh4KHgodCx0KHgoeCh4KHR8JCx0LvAoeCh4eCgodHwkeCgoeHgoKHgodHwkeCh4KCh4KHQsdCh4KHgoeCh4KHQsdHgoKHgoABdw=" + }, + "oscillate": "scAAAc6eBgALHQsdHwkKHR8JHwkKHh4KCh4KHR8JHgoeCgoeCh4JHgoeCh4KHgodHwkeCgoeCh4KvQoeCh0fCQsdHgoeCgodHwkLHQoeHgoeCh4KCh0KHgoeCh4KHgodCx0eCh4KCh4KHQu9Ch0LHR4KCh4eCh4KCh0eCgoeCh4eCh4JHgoKHgoeCh4KHQsdCx0KHh4KHgoKHgodDLsLHQsdHgoKHR8JHwkKHh4KCh4KHR8JHgoeCgoeCh4KHgodCh4KHgoeHgoeCgodCx0KvQoeCh4eCgodHwkeCgoeHgoKHgodHgoeCh4KCh4JHgoeCh4KHgoeCh0fCR4KCh4KHgoABdw=" + } +} diff --git a/codes/fan/1231.json b/codes/fan/1231.json new file mode 100644 index 000000000..0568093da --- /dev/null +++ b/codes/fan/1231.json @@ -0,0 +1,33 @@ +{ + "manufacturer": "EGLO", + "supportedModels": [ + "35014", + "35015", + "35016", + "35017", + "35069", + "35071", + "35072", + "35073" + ], + "supportedController": "Broadlink", + "commandsEncoding": "Base64", + "speed": [ + "1", + "2", + "3", + "4", + "5" + ], + "commands": { + "off": "scAGARSfBgAAAVAABaIKvh8JCx0fCgoeCx0fCQsdCx0fCh4KCh4KHh4KHwkKHh8KCh4KHgoeCh4KHgsdHwoeCgq+HwoKHh4KCh4LHR8JCx4KHh4KHgoKHgsdHwoeCgoeHgoKHgoeCx4KHgoeCh4eCh4KCr8eCgsdHwkLHgodHwoKHgoeHgofCQofCh4eCh4KCh4eCwoeCh4KHgoeCh4LHR4KHwkLvh4KCx0fCQsdCx0fCgoeCh4eCh4KCh4LHR8KHgoKHh4KCh4KHgoeCh4LHQsdHwoeCgq+HgoLHR8JCx4KHh4KCh4KHh4KHgoKHgseHgoeCgoeHgoKHgoeCh4LHQsdCx0fCR8ABdw=", + "default": { + "1": "scD8AOKeBgALHh4KCh4LHR8JCh4LHR8JHwoKHgoeHgoeCgoeHgoKHgoeCh4LHQseHgoKHh4KCr4fCgoeHgoKHgoeHgoKHgsdHwkfCgoeCh4eCh4KCh4eCgoeCh4LHgodCx4eCgoeHgoKvh8JCx0fCQseCh0fCgoeCh4eCh4KCh4KHh4KHwkKHx4JCx4KHgoeCh4KHh4KCh4eCgq/HgoKHh4KCh4KHh8JCx0LHR8JHwoKHQseHgoeCgoeHgoKHgoeCh4KHgsdHwkLHR8KCr4eCgoeHgoKHgoeHwkKHgsdHwkfCgodCx4eCh4KCh4eCgoeCh4KHgoeCh4eCgoeHgAF3A==", + "2": "scD+AOyeBgAeCQsdHwkLHQsdHwkLHgoeHgoeCgoeCh4eCh4KCh4dCwoeCh4KHgoeHgoKHh4KCh4Kvh4JCx0fCgodCx0fCgoeCh4eCh4KCh4KHh4KHgoKHh4KCh4KHgoeCh4eCgoeHgoKHgq+HwkLHR8JCx0LHR8JCx0LHR8JHgoLHQsdHwoeCgoeHgoKHgoeC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goeHgoKHgofCR4KHgoeCx4eCQseCr4eCgoeHgoKHwoeHgoKHgoeHgoeCgoeCh8cCx4LCR8eCQseCh4KHgoeCh4KHh4KCh4Kvx4KCh4eCgoeCh4eCgoeCh4fCh4KCh4KHh4KHgoKHh4KCh4KHgoeCx4KHgoeHgoKAAXc" + }, + "oscillate": "scD8AOKeBgALHh4KCh4LHR8JCh4LHR8JHwoKHgoeHgoeCgoeHgoKHgoeCh4LHQseHgoKHh4KCr4fCgoeHgoKHgoeHgoKHgsdHwkfCgoeCh4eCh4KCh4eCgoeCh4LHgodCx4eCgoeHgoKvh8JCx0fCQseCh0fCgoeCh4eCh4KCh4KHh4KHwkKHx4JCx4KHgoeCh4KHh4KCh4eCgq/HgoKHh4KCh4KHh8JCx0LHR8JHwoKHQseHgoeCgoeHgoKHgoeCh4KHgsdHwkLHR8KCr4eCgoeHgoKHgoeHwkKHgsdHwkfCgodCx4eCh4KCh4eCgoeCh4KHgoeCh4eCgoeHgAF3A==" + } +} diff --git a/custom_components/smartir/fan.py b/custom_components/smartir/fan.py index 4c9bb9352..f50786517 100644 --- a/custom_components/smartir/fan.py +++ b/custom_components/smartir/fan.py @@ -151,6 +151,10 @@ async def async_added_to_hass(self): self._support_flags & FanEntityFeature.DIRECTION): self._direction = last_state.attributes['direction'] + if ('oscillating' in last_state.attributes and \ + self._support_flags & FanEntityFeature.OSCILLATE): + self._oscillating = last_state.attributes['oscillating'] + if 'last_on_speed' in last_state.attributes: self._last_on_speed = last_state.attributes['last_on_speed'] @@ -237,9 +241,12 @@ async def async_set_percentage(self, percentage: int): async def async_oscillate(self, oscillating: bool) -> None: """Set oscillation of the fan.""" + if self._oscillating == oscillating: + return + self._oscillating = oscillating - await self.send_command() + await self.send_command('oscillate') self.async_write_ha_state() async def async_set_direction(self, direction: str): @@ -263,17 +270,16 @@ async def async_turn_off(self): """Turn off the fan.""" await self.async_set_percentage(0) - async def send_command(self): + async def send_command(self, command_type=None): 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: + if command_type == 'oscillate': command = self._commands['oscillate'] + elif speed.lower() == SPEED_OFF: + command = self._commands['off'] else: command = self._commands[direction][speed] @@ -304,4 +310,4 @@ async def _async_power_sensor_changed(self, event: Event[EventStateChangedData]) self._on_by_remote = False if self._speed != SPEED_OFF: self._speed = SPEED_OFF - self.async_write_ha_state() \ No newline at end of file + self.async_write_ha_state() diff --git a/docs/FAN.md b/docs/FAN.md index 966e57db9..b7239593a 100644 --- a/docs/FAN.md +++ b/docs/FAN.md @@ -190,6 +190,13 @@ Contributing to your own code files is welcome. However, we do not accept incomp | ------------- | -------------------------- | ------------- | [1200](../codes/fan/1200.json)|Unknown|Broadlink +#### EGLO + +| Code | Supported Models | Controller | +| ------------- | -------------------------- | ------------- | +[1230](../codes/fan/1230.json)|35014, 35015, 35016, 35017, 35069, 35071, 35072, 35073|Broadlink +[1231](../codes/fan/1231.json)|35014, 35015, 35016, 35017, 35069, 35071, 35072, 35073|Broadlink + #### Mitsubishi | Code | Supported Models | Controller |