Skip to content

Commit

Permalink
Remove unwanted parts of home-assistant#39096
Browse files Browse the repository at this point in the history
  • Loading branch information
emontnemery committed Aug 27, 2020
1 parent a47f732 commit bab4aab
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions homeassistant/components/mqtt/fan.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
CONF_PAYLOAD_ON,
CONF_STATE,
CONF_UNIQUE_ID,
STATE_OFF,
STATE_ON,
)
from homeassistant.core import callback
import homeassistant.helpers.config_validation as cv
Expand Down Expand Up @@ -155,7 +153,7 @@ class MqttFan(
def __init__(self, config, config_entry, discovery_data):
"""Initialize the MQTT fan."""
self._unique_id = config.get(CONF_UNIQUE_ID)
self._state = STATE_OFF
self._state = False
self._speed = None
self._oscillation = None
self._supported_features = 0
Expand Down Expand Up @@ -257,9 +255,9 @@ def state_received(msg):
"""Handle new received MQTT message."""
payload = templates[CONF_STATE](msg.payload)
if payload == self._payload["STATE_ON"]:
self._state = STATE_ON
self._state = True
elif payload == self._payload["STATE_OFF"]:
self._state = STATE_OFF
self._state = False
self.async_write_ha_state()

if self._topic[CONF_STATE_TOPIC] is not None:
Expand Down Expand Up @@ -337,7 +335,7 @@ def assumed_state(self):
@property
def is_on(self):
"""Return true if device is on."""
return self._state == STATE_ON
return self._state

@property
def name(self) -> str:
Expand Down Expand Up @@ -379,7 +377,7 @@ async def async_turn_on(self, speed: str = None, **kwargs) -> None:
if speed:
await self.async_set_speed(speed)
if self._optimistic:
self._state = STATE_ON
self._state = True
self.async_write_ha_state()

async def async_turn_off(self, **kwargs) -> None:
Expand All @@ -395,7 +393,7 @@ async def async_turn_off(self, **kwargs) -> None:
self._config[CONF_RETAIN],
)
if self._optimistic:
self._state = STATE_OFF
self._state = False
self.async_write_ha_state()

async def async_set_speed(self, speed: str) -> None:
Expand Down

0 comments on commit bab4aab

Please sign in to comment.