Python homeassistant.const.CONF_PASSWORD Examples
The following are 8
code examples of homeassistant.const.CONF_PASSWORD().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
homeassistant.const
, or try the search function
.
Example #1
Source File: midea.py From midea-ac-py with MIT License | 6 votes |
def async_setup_platform(hass, config, async_add_entities, discovery_info=None): """Set up the Midea cloud service and query appliances.""" from midea.client import client as midea_client app_key = config.get(CONF_APP_KEY) username = config.get(CONF_USERNAME) password = config.get(CONF_PASSWORD) temp_step = config.get(CONF_TEMP_STEP) include_off_as_state = config.get(CONF_INCLUDE_OFF_AS_STATE) client = midea_client(app_key, username, password) devices = client.devices() entities = [] for device in devices: if(device.type == 0xAC): entities.append(MideaClimateACDevice( device, temp_step, include_off_as_state)) else: _LOGGER.error( "Unsupported device type: 0x{:02x}".format(device.type)) async_add_entities(entities)
Example #2
Source File: light.py From example-custom-config with Apache License 2.0 | 6 votes |
def setup_platform(hass, config, add_entities, discovery_info=None): """Set up the Awesome Light platform.""" # Assign configuration variables. # The configuration check takes care they are present. host = config[CONF_HOST] username = config[CONF_USERNAME] password = config.get(CONF_PASSWORD) # Setup connection with devices/cloud hub = awesomelights.Hub(host, username, password) # Verify that passed in configuration works if not hub.is_valid_login(): _LOGGER.error("Could not connect to AwesomeLight hub") return # Add devices add_entities(AwesomeLight(light) for light in hub.lights())
Example #3
Source File: sure_petflap.py From sure_petcare with GNU General Public License v3.0 | 5 votes |
def setup_platform(hass, config, add_devices, discovery_info=None): """Setup the sensor platform.""" username = config.get(CONF_USERNAME) password = config.get(CONF_PASSWORD) add_devices([SurePetConnect(username, password)])
Example #4
Source File: my_sleepiq.py From HomeAssistantConfig with MIT License | 5 votes |
def setup(hass, config): """Set up the SleepIQ component. Will automatically load sensor components to support devices discovered on the account. """ # pylint: disable=global-statement global DATA from sleepyq import Sleepyq username = config[DOMAIN][CONF_USERNAME] password = config[DOMAIN][CONF_PASSWORD] client = Sleepyq(username, password) try: DATA = SleepIQData(client) DATA.update() except HTTPError: message = """ SleepIQ failed to login, double check your username and password" """ _LOGGER.error(message) return False discovery.load_platform(hass, 'sensor', DOMAIN, {}, config) discovery.load_platform(hass, 'binary_sensor', DOMAIN, {}, config) return True
Example #5
Source File: sensor.py From SmartHouse with MIT License | 5 votes |
def setup_platform(hass, config, add_devices, discovery_info=None): username = config.get(CONF_USERNAME) password = config.get(CONF_PASSWORD) name = config.get(CONF_NAME) websession = async_get_clientsession(hass) add_devices([LunchingSensor(hass, websession, name, username, password)])
Example #6
Source File: config_flow.py From wiserHomeAssistantPlatform with MIT License | 5 votes |
def validate_input(hass, data): """Validate the user input allows us to connect. Data has the keys from DATA_SCHEMA with values provided by the user. """ try: wiser = await hass.async_add_executor_job( wiserHub, data[CONF_HOST], data[CONF_PASSWORD] ) wiser_id = await hass.async_add_executor_job(wiser.getWiserHubName) except WiserHubTimeoutException: raise CannotConnect except WiserHubAuthenticationException: raise InvalidAuth except WiserRESTException: raise UnknownError except requests.exceptions.ConnectionError: raise CannotConnect except RuntimeError: raise UnknownError unique_id = str(f"{DOMAIN}-{wiser_id}") name = wiser_id return {"title": name, "unique_id": unique_id}
Example #7
Source File: __init__.py From home-assistant-archive with MIT License | 4 votes |
def setup_account(account_config: dict, hass, name: str) \ -> 'BMWConnectedDriveAccount': """Set up a new BMWConnectedDriveAccount based on the config.""" username = account_config[CONF_USERNAME] password = account_config[CONF_PASSWORD] region = account_config[CONF_REGION] read_only = account_config[CONF_READ_ONLY] _LOGGER.debug('Adding new account %s', name) cd_account = BMWConnectedDriveAccount(username, password, region, name, read_only) def execute_service(call): """Execute a service for a vehicle. This must be a member function as we need access to the cd_account object here. """ vin = call.data[ATTR_VIN] vehicle = cd_account.account.get_vehicle(vin) if not vehicle: _LOGGER.error('Could not find a vehicle for VIN "%s"!', vin) return function_name = _SERVICE_MAP[call.service] function_call = getattr(vehicle.remote_services, function_name) function_call() if not read_only: # register the remote services for service in _SERVICE_MAP: hass.services.register( DOMAIN, service, execute_service, schema=SERVICE_SCHEMA) # update every UPDATE_INTERVAL minutes, starting now # this should even out the load on the servers now = datetime.datetime.now() track_utc_time_change( hass, cd_account.update, minute=range(now.minute % UPDATE_INTERVAL, 60, UPDATE_INTERVAL), second=now.second) return cd_account
Example #8
Source File: __init__.py From hass-opensprinkler with MIT License | 4 votes |
def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): """Set up OpenSprinkler from a config entry.""" hass.data.setdefault(DOMAIN, {}) url = entry.data.get(CONF_URL) password = entry.data.get(CONF_PASSWORD) try: controller = OpenSprinkler(url, password) controller.refresh_on_update = False async def async_update_data(): """Fetch data from OpenSprinkler.""" _LOGGER.debug("refreshing data") async with async_timeout.timeout(TIMEOUT): try: await hass.async_add_executor_job(controller.refresh) except Exception as exc: raise UpdateFailed("Error fetching OpenSprinkler state") from exc if not controller._state: raise UpdateFailed("Error fetching OpenSprinkler state") return controller._state scan_interval = entry.options.get(CONF_SCAN_INTERVAL, DEFAULT_SCAN_INTERVAL) coordinator = DataUpdateCoordinator( hass, _LOGGER, name="OpenSprinkler resource status", update_method=async_update_data, update_interval=timedelta(seconds=scan_interval), ) # initial load before loading platforms await coordinator.async_refresh() hass.data[DOMAIN][entry.entry_id] = { "coordinator": coordinator, "controller": controller, } except (OpenSprinklerAuthError, OpenSprinklerConnectionError) as exc: _LOGGER.error("Unable to connect to OpenSprinkler controller: %s", str(exc)) raise ConfigEntryNotReady for component in PLATFORMS: hass.async_create_task( hass.config_entries.async_forward_entry_setup(entry, component) ) return True