Fixing up style issues

This commit is contained in:
sibowler
2021-12-13 06:08:53 +11:00
parent ec0c6c04b4
commit 9af91081a7
3 changed files with 13 additions and 11 deletions

View File

@@ -46,6 +46,7 @@ DATA_DISCOVERY = "discovery"
DOMAIN = "localtuya"
# Platforms in this list must support config flows
PLATFORMS = ["binary_sensor", "cover", "fan", "light", "number", "select", "sensor", "switch"]
PLATFORMS = ["binary_sensor", "cover", "fan", "light", "number",
"select", "sensor", "switch"]
TUYA_DEVICE = "tuya_device"

View File

@@ -19,8 +19,9 @@ CONF_MAX_VALUE = "max_value"
DEFAULT_MIN = 0
DEFAULT_MAX = 100000
def flow_schema(dps):
# """Return schema used in config flow."""
"""Return schema used in config flow."""
return {
vol.Optional(CONF_MIN_VALUE, default=DEFAULT_MIN): vol.All(
vol.Coerce(float), vol.Range(min=-1000000.0, max=1000000.0),
@@ -59,7 +60,6 @@ class LocaltuyaNumber(LocalTuyaEntity, NumberEntity):
@property
def min_value(self) -> float:
"""Return the minimum value."""
return self._minValue
@property
@@ -76,7 +76,6 @@ class LocaltuyaNumber(LocalTuyaEntity, NumberEntity):
"""Update the current value."""
await self._device.set_dp(value, self._dp_id)
def status_updated(self):
"""Device status was updated."""
state = self.dps(self._dp_id)

View File

@@ -18,7 +18,7 @@ CONF_OPTIONS_FRIENDLY = "select_options_friendly"
def flow_schema(dps):
# """Return schema used in config flow."""
"""Return schema used in config flow."""
return {
vol.Required(CONF_OPTIONS): str,
vol.Optional(CONF_OPTIONS_FRIENDLY): str,
@@ -40,7 +40,7 @@ class LocaltuyaSelect(LocalTuyaEntity, SelectEntity):
self._state = STATE_UNKNOWN
self._validOptions = self._config.get(CONF_OPTIONS).split(';')
#Set Display options
# Set Display options
self._displayOptions = []
displayOptionsStr = ""
if (CONF_OPTIONS_FRIENDLY in self._config):
@@ -52,14 +52,17 @@ class LocaltuyaSelect(LocalTuyaEntity, SelectEntity):
elif (len(displayOptionsStr.strip()) > 0):
self._displayOptions.append(displayOptionsStr)
else:
#Default display string to raw string
# Default display string to raw string
_LOGGER.debug("No Display options configured - defaulting to raw values")
self._displayOptions = self._validOptions
_LOGGER.debug("Total Raw Options: " + str(len(self._validOptions)) + " - Total Display Options: " + str(len(self._displayOptions)))
_LOGGER.debug("Total Raw Options: " + str(len(self._validOptions)) +
" - Total Display Options: " + str(len(self._displayOptions)))
if (len(self._validOptions) > len(self._displayOptions)):
#If list of display items smaller than list of valid items, then default remaining items to be the raw value
_LOGGER.debug("Valid options is larger than display options - filling up with raw values")
# If list of display items smaller than list of valid items,
# then default remaining items to be the raw value
_LOGGER.debug("Valid options is larger than display options - \
filling up with raw values")
for i in range(len(self._displayOptions), len(self._validOptions)):
self._displayOptions.append(self._validOptions[i])
@@ -84,7 +87,6 @@ class LocaltuyaSelect(LocalTuyaEntity, SelectEntity):
_LOGGER.debug("Sending Option: " + option + " -> " + optionValue)
await self._device.set_dp(optionValue, self._dp_id)
def status_updated(self):
"""Device status was updated."""
state = self.dps(self._dp_id)