Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# and the numbers have meaning.
class FanMode(IntEnum):
"""Enum to map WeMo FanModes to human-readable strings."""
Off = 0 # Fan and device turned off
Minimum = 1
Low = 2
Medium = 3
High = 4
Maximum = 5
FAN_MODE_NAMES = {
FanMode.Off: "Off",
FanMode.Minimum: "Minimum",
FanMode.Low: "Low",
FanMode.Medium: "Medium",
FanMode.High: "High",
FanMode.Maximum: "Maximum"
}
class DesiredHumidity(IntEnum):
"""Enum to map WeMo DesiredHumidity to human-readable strings."""
FortyFivePercent = 0
FiftyPercent = 1
FiftyFivePercent = 2
SixtyPercent = 3
OneHundredPercent = 4 # "Always On" Mode
Off = 0 # Fan and device turned off
Minimum = 1
Low = 2
Medium = 3
High = 4
Maximum = 5
FAN_MODE_NAMES = {
FanMode.Off: "Off",
FanMode.Minimum: "Minimum",
FanMode.Low: "Low",
FanMode.Medium: "Medium",
FanMode.High: "High",
FanMode.Maximum: "Maximum"
}
class DesiredHumidity(IntEnum):
"""Enum to map WeMo DesiredHumidity to human-readable strings."""
FortyFivePercent = 0
FiftyPercent = 1
FiftyFivePercent = 2
SixtyPercent = 3
OneHundredPercent = 4 # "Always On" Mode
DESIRED_HUMIDITY_NAMES = {
DesiredHumidity.FortyFivePercent: "45",
DesiredHumidity.FiftyPercent: "50",
class FanMode(IntEnum):
"""Enum to map WeMo FanModes to human-readable strings."""
Off = 0 # Fan and device turned off
Minimum = 1
Low = 2
Medium = 3
High = 4
Maximum = 5
FAN_MODE_NAMES = {
FanMode.Off: "Off",
FanMode.Minimum: "Minimum",
FanMode.Low: "Low",
FanMode.Medium: "Medium",
FanMode.High: "High",
FanMode.Maximum: "Maximum"
}
class DesiredHumidity(IntEnum):
"""Enum to map WeMo DesiredHumidity to human-readable strings."""
FortyFivePercent = 0
FiftyPercent = 1
FiftyFivePercent = 2
SixtyPercent = 3
OneHundredPercent = 4 # "Always On" Mode
DESIRED_HUMIDITY_NAMES = {
# Thus these names/values were not chosen randomly
# and the numbers have meaning.
class FanMode(IntEnum):
"""Enum to map WeMo FanModes to human-readable strings."""
Off = 0 # Fan and device turned off
Minimum = 1
Low = 2
Medium = 3
High = 4
Maximum = 5
FAN_MODE_NAMES = {
FanMode.Off: "Off",
FanMode.Minimum: "Minimum",
FanMode.Low: "Low",
FanMode.Medium: "Medium",
FanMode.High: "High",
FanMode.Maximum: "Maximum"
}
class DesiredHumidity(IntEnum):
"""Enum to map WeMo DesiredHumidity to human-readable strings."""
FortyFivePercent = 0
FiftyPercent = 1
FiftyFivePercent = 2
SixtyPercent = 3
OneHundredPercent = 4 # "Always On" Mode
def get_state(self, force_update=False):
"""Return 0 if off and 1 if on."""
# The base implementation using GetBinaryState
# doesn't work for Humidifier (always returns 0)
# so use fan mode instead.
if force_update or self._state is None:
self.update_attributes()
# Consider the Humidifier to be "on" if it's not off.
return int(self._state != FanMode.Off)
"""Enum to map WeMo FanModes to human-readable strings."""
Off = 0 # Fan and device turned off
Minimum = 1
Low = 2
Medium = 3
High = 4
Maximum = 5
FAN_MODE_NAMES = {
FanMode.Off: "Off",
FanMode.Minimum: "Minimum",
FanMode.Low: "Low",
FanMode.Medium: "Medium",
FanMode.High: "High",
FanMode.Maximum: "Maximum"
}
class DesiredHumidity(IntEnum):
"""Enum to map WeMo DesiredHumidity to human-readable strings."""
FortyFivePercent = 0
FiftyPercent = 1
FiftyFivePercent = 2
SixtyPercent = 3
OneHundredPercent = 4 # "Always On" Mode
DESIRED_HUMIDITY_NAMES = {
DesiredHumidity.FortyFivePercent: "45",