Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __init__(self, hass, domain_config, neato):
"""Initialize the Neato hub."""
self.config = domain_config
self._neato = neato
self._hass = hass
if self.config[CONF_VENDOR] == "vorwerk":
self._vendor = Vorwerk()
else: # Neato
self._vendor = Neato()
self.my_neato = None
self.logged_in = False
def try_login(username, password, vendor):
"""Try logging in to device and return any errors."""
this_vendor = None
if vendor == "vorwerk":
this_vendor = Vorwerk()
else: # Neato
this_vendor = Neato()
try:
Account(username, password, this_vendor)
except NeatoLoginException:
return "invalid_credentials"
except NeatoRobotException:
return "unexpected_error"
return None
def __init__(self, hass, domain_config, neato):
"""Initialize the Neato hub."""
self.config = domain_config
self._neato = neato
self._hass = hass
if self.config[CONF_VENDOR] == "vorwerk":
self._vendor = Vorwerk()
else: # Neato
self._vendor = Neato()
self.my_neato = None
self.logged_in = False
import sys
from pybotvac import Account, Vorwerk
if sys.version_info[0] < 3:
input = raw_input
email = input('Enter email\n')
password = input('Enter password\n')
vendor = Vorwerk()
account = Account(email, password, vendor)
print("Robots:")
for robot in account.robots:
print(robot)
print()
print("State:\n", robot.state)
print()
print("Schedule enabled:", robot.schedule_enabled)
print("Disabling schedule")
robot.schedule_enabled = False
def try_login(username, password, vendor):
"""Try logging in to device and return any errors."""
this_vendor = None
if vendor == "vorwerk":
this_vendor = Vorwerk()
else: # Neato
this_vendor = Neato()
try:
Account(username, password, this_vendor)
except NeatoLoginException:
return "invalid_credentials"
except NeatoRobotException:
return "unexpected_error"
return None