Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
DEFAULT_NAME = 'afvalwijzer'
DOMAIN = 'afvalwijzer'
ICON = 'mdi:delete-empty'
SENSOR_PREFIX = 'trash_'
CONST_URL = 'url'
CONST_POSTCODE = 'postcode'
CONST_HUISNUMMER = 'huisnummer'
CONST_TOEVOEGING = 'toevoeging'
CONST_LABEL_NONE = 'label_geen'
SCAN_INTERVAL = timedelta(seconds=30)
MIN_TIME_BETWEEN_UPDATES = timedelta(seconds=3600)
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string,
vol.Optional(CONST_URL, default="mijnafvalwijzer.nl"): cv.string,
vol.Required(CONST_POSTCODE): cv.string,
vol.Required(CONST_HUISNUMMER): cv.string,
vol.Optional(CONST_TOEVOEGING, default=""): cv.string,
vol.Optional(CONST_LABEL_NONE, default="Geen"): cv.string,
})
def setup_platform(hass, config, add_devices, discovery_info=None):
"""Setup the sensor platform."""
# Setup JSON request (add sensor/devices)
url = config.get(CONST_URL)
postcode = config.get(CONST_POSTCODE)
huisnummer = config.get(CONST_HUISNUMMER)
toevoeging = config.get(CONST_TOEVOEGING)
CONF_MINVOL = "minvol"
CONF_MAXVOL = "maxvol"
DEFAULT_MINVOL = -60
DEFAULT_MAXVOL = -30
CONF_TIMEOUT = "timeout"
CONF_BUFFER_SIZE = "buffer_size"
DEFAULT_TIMEOUT = 10
DEFAULT_BUFFER_SIZE = 1024
CONF_PAYLOAD = "payload"
# CONF_MRXMODEL = "mrxmodel"
SUPPORT_ANTHEMMRX = SUPPORT_SELECT_SOURCE | SUPPORT_VOLUME_STEP | \
SUPPORT_VOLUME_SET | SUPPORT_VOLUME_MUTE | SUPPORT_TURN_OFF
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
vol.Required(CONF_HOST): cv.string,
# vol.Optional(CONF_MRXMODEL): cv.string,
vol.Optional(CONF_PORT, default=DEFAULT_PORT): cv.port,
vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string,
vol.Optional(CONF_MRXZONE, default=DEFAULT_MRXZONE): cv.positive_int,
vol.Optional(CONF_MINVOL, default=DEFAULT_MINVOL): vol.Coerce(float),
vol.Optional(CONF_MAXVOL, default=DEFAULT_MAXVOL): vol.Coerce(float),
vol.Optional(CONF_TIMEOUT, default=DEFAULT_TIMEOUT): cv.positive_int,
})
def setup_platform(hass, config, add_devices, discovery_info=None):
add_devices([AnthemMrx(hass, config)])
return True
DOMAIN = "fastdotcom"
DATA_UPDATED = f"{DOMAIN}_data_updated"
_LOGGER = logging.getLogger(__name__)
CONF_MANUAL = "manual"
DEFAULT_INTERVAL = timedelta(hours=1)
CONFIG_SCHEMA = vol.Schema(
{
DOMAIN: vol.Schema(
{
vol.Optional(CONF_SCAN_INTERVAL, default=DEFAULT_INTERVAL): vol.All(
cv.time_period, cv.positive_timedelta
),
vol.Optional(CONF_MANUAL, default=False): cv.boolean,
}
)
},
extra=vol.ALLOW_EXTRA,
)
async def async_setup(hass, config):
"""Set up the Fast.com component."""
conf = config[DOMAIN]
data = hass.data[DOMAIN] = SpeedtestData(hass)
if not conf[CONF_MANUAL]:
async_track_time_interval(hass, data.update, conf[CONF_SCAN_INTERVAL])
REQUIREMENTS = ['pytautulli==0.5.0']
_LOGGER = logging.getLogger(__name__)
CONF_MONITORED_USERS = 'monitored_users'
DEFAULT_NAME = 'Tautulli'
DEFAULT_PORT = '8181'
DEFAULT_PATH = ''
DEFAULT_SSL = False
DEFAULT_VERIFY_SSL = True
TIME_BETWEEN_UPDATES = timedelta(seconds=10)
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
vol.Required(CONF_API_KEY): cv.string,
vol.Required(CONF_HOST): cv.string,
vol.Optional(CONF_MONITORED_CONDITIONS):
vol.All(cv.ensure_list, [cv.string]),
vol.Optional(CONF_MONITORED_USERS): vol.All(cv.ensure_list, [cv.string]),
vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string,
vol.Optional(CONF_PORT, default=DEFAULT_PORT): cv.string,
vol.Optional(CONF_PATH, default=DEFAULT_PATH): cv.string,
vol.Optional(CONF_SSL, default=DEFAULT_SSL): cv.boolean,
vol.Optional(CONF_VERIFY_SSL, default=DEFAULT_VERIFY_SSL): cv.boolean,
})
async def async_setup_platform(
hass, config, async_add_entities, discovery_info=None):
"""Create the Tautulli sensor."""
from pytautulli import Tautulli
vol.Optional("action"): cv.string,
vol.Optional("repository"): cv.string,
}
)
async def hacs_repository(hass, connection, msg):
"""Handle get media player cover command."""
hacs = get_hacs()
data = {}
try:
repo_id = msg.get("repository")
action = msg.get("action")
if repo_id is None or action is None:
return
repository = hacs.get_by_id(repo_id)
hacs.logger.debug(f"Running {action} for {repository.data.full_name}")
_LOGGER = logging.getLogger(__name__)
CONF_LOCATION = 'location'
DEFAULT_LOCATION = 'MPD'
DEFAULT_PORT = 6600
SUPPORT_MPD = SUPPORT_PAUSE | SUPPORT_VOLUME_SET | SUPPORT_TURN_OFF | \
SUPPORT_TURN_ON | SUPPORT_PREVIOUS_TRACK | SUPPORT_NEXT_TRACK | \
SUPPORT_PLAY_MEDIA
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
vol.Required(CONF_HOST): cv.string,
vol.Optional(CONF_LOCATION, default=DEFAULT_LOCATION): cv.string,
vol.Optional(CONF_PASSWORD): cv.string,
vol.Optional(CONF_PORT, default=DEFAULT_PORT): cv.port,
})
# pylint: disable=unused-argument
def setup_platform(hass, config, add_devices, discovery_info=None):
"""Setup the MPD platform."""
daemon = config.get(CONF_HOST)
port = config.get(CONF_PORT)
location = config.get(CONF_LOCATION)
password = config.get(CONF_PASSWORD)
import mpd
# pylint: disable=no-member
try:
except ValueError:
pass
try:
return datetime.strptime(value, "%m-%d").date().strftime("%m-%d")
except ValueError:
raise vol.Invalid(f"Invalid date: {value}")
SENSOR_SCHEMA = vol.Schema(
{
vol.Required(CONF_NAME): cv.string,
vol.Required(CONF_DATE): check_date,
vol.Optional(CONF_SOON, default=DEFAULT_SOON): cv.positive_int,
vol.Optional(CONF_ICON_NORMAL, default=DEFAULT_ICON_NORMAL): cv.icon,
vol.Optional(CONF_ICON_TODAY, default=DEFAULT_ICON_TODAY): cv.icon,
vol.Optional(CONF_ICON_SOON, default=DEFAULT_ICON_SOON): cv.icon,
vol.Optional(CONF_DATE_FORMAT, default=DEFAULT_DATE_FORMAT): cv.string,
vol.Optional(CONF_HALF_ANNIVERSARY, default=DEFAULT_HALF_ANNIVERSARY): cv.boolean,
vol.Optional(CONF_UNIT_OF_MEASUREMENT, default=DEFAULT_UNIT_OF_MEASUREMENT): cv.string,
vol.Optional(CONF_ID_PREFIX, default=DEFAULT_ID_PREFIX): cv.string,
vol.Optional(CONF_ONE_TIME, default=DEFAULT_ONE_TIME): cv.boolean,
}
)
CONFIG_SCHEMA = vol.Schema(
{
DOMAIN: vol.Schema(
{vol.Optional(CONF_SENSORS): vol.All(cv.ensure_list, [SENSOR_SCHEMA])}
)
},
extra=vol.ALLOW_EXTRA,
)
],
"current_up_bandwidth": [
"Currently Used Upload Bandwidth",
BANDWIDTH_MEGABITS_SECONDS,
"mdi:upload",
],
"uptime": ["Uptime", None, "mdi:clock"],
"number_of_reboots": ["Number of reboot", None, "mdi:restart"],
}
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
{
vol.Required(CONF_MONITORED_VARIABLES): vol.All(
cv.ensure_list, [vol.In(SENSOR_TYPES)]
),
vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string,
}
)
def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the Bbox sensor."""
# Create a data fetcher to support all of the configured sensors. Then make
# the first call to init the data.
try:
bbox_data = BboxData()
bbox_data.update()
except requests.exceptions.HTTPError as error:
_LOGGER.error(error)
return False
name = config.get(CONF_NAME)
ATTR_TEXT = 'text'
DOMAIN = 'remarks'
EVENT_REMARKS = 'remarks'
CONFIG_SCHEMA = vol.Schema({
DOMAIN: vol.Schema({
vol.Optional(CONF_FILE, default=DEFAULT_FILE): cv.string,
vol.Optional(CONF_HOUR, default=DEFAULT_HOUR): vol.Any(
vol.Coerce(int),
vol.Coerce(str)),
vol.Optional(CONF_MINUTE, default=DEFAULT_MINUTE): vol.Any(
vol.Coerce(int),
vol.Coerce(str)),
vol.Optional(CONF_OUTSIDE_T_SENSOR,
default=DEFAULT_OUTSIDE_T_SENSOR): cv.entity_id,
vol.Optional(CONF_COLD_THRESHOLD,
default=DEFAULT_COLD_THRESHOLD): vol.Coerce(float),
vol.Optional(CONF_FREEZE_THRESHOLD,
default=DEFAULT_FREEZE_THRESHOLD): vol.Coerce(float),
vol.Optional(CONF_TEMP_HOUR, default=DEFAULT_TEMP_HOUR): vol.Any(
vol.Coerce(int),
vol.Coerce(str)),
vol.Optional(CONF_TEMP_MINUTE, default=DEFAULT_TEMP_MINUTE): vol.Any(
vol.Coerce(int),
vol.Coerce(str)),
}),
}, extra=vol.ALLOW_EXTRA)
def setup(hass, config):
"""Set up the remarks component."""
from . import CameraData
from .const import DATA_NETATMO_AUTH, DOMAIN
_LOGGER = logging.getLogger(__name__)
CONF_HOME = "home"
CONF_CAMERAS = "cameras"
CONF_QUALITY = "quality"
DEFAULT_QUALITY = "high"
VALID_QUALITIES = ["high", "medium", "low", "poor"]
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
{
vol.Optional(CONF_VERIFY_SSL, default=True): cv.boolean,
vol.Optional(CONF_HOME): cv.string,
vol.Optional(CONF_CAMERAS, default=[]): vol.All(cv.ensure_list, [cv.string]),
vol.Optional(CONF_QUALITY, default=DEFAULT_QUALITY): vol.All(
cv.string, vol.In(VALID_QUALITIES)
),
}
)
_BOOL_TO_STATE = {True: STATE_ON, False: STATE_OFF}
def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up access to Netatmo cameras."""
home = config.get(CONF_HOME)
verify_ssl = config.get(CONF_VERIFY_SSL, True)
quality = config.get(CONF_QUALITY, DEFAULT_QUALITY)