示例#1
0
_LOGGER = logging.getLogger(__name__)

ATTRIBUTION = "Air quality from " \
              "https://luftkvalitet.miljostatus.no/, " \
              "delivered by the Norwegian Meteorological Institute."
# https://api.met.no/license_data.html

CONF_FORECAST = 'forecast'

DEFAULT_FORECAST = 0
DEFAULT_NAME = 'Air quality Norway'

PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
    vol.Optional(CONF_FORECAST, default=DEFAULT_FORECAST): vol.Coerce(int),
    vol.Optional(CONF_LATITUDE): cv.latitude,
    vol.Optional(CONF_LONGITUDE): cv.longitude,
    vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string,
})

SCAN_INTERVAL = timedelta(minutes=5)


async def async_setup_platform(hass, config, async_add_entities,
                               discovery_info=None):
    """Set up the air_quality norway sensor."""
    forecast = config.get(CONF_FORECAST)
    latitude = config.get(CONF_LATITUDE, hass.config.latitude)
    longitude = config.get(CONF_LONGITUDE, hass.config.longitude)
    name = config.get(CONF_NAME)

    if None in (latitude, longitude):
示例#2
0
ATTRIBUTION = "Air quality from " \
              "https://luftkvalitet.miljostatus.no/, " \
              "delivered by the Norwegian Meteorological Institute."
# https://api.met.no/license_data.html

CONF_FORECAST = 'forecast'

DEFAULT_FORECAST = 0
DEFAULT_NAME = 'Air quality Norway'

PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
    vol.Optional(CONF_FORECAST, default=DEFAULT_FORECAST):
    vol.Coerce(int),
    vol.Optional(CONF_LATITUDE):
    cv.latitude,
    vol.Optional(CONF_LONGITUDE):
    cv.longitude,
    vol.Optional(CONF_NAME, default=DEFAULT_NAME):
    cv.string,
})

SCAN_INTERVAL = timedelta(minutes=5)


async def async_setup_platform(hass,
                               config,
                               async_add_entities,
                               discovery_info=None):
    """Set up the air_quality norway sensor."""
    forecast = config.get(CONF_FORECAST)
    latitude = config.get(CONF_LATITUDE, hass.config.latitude)
from homeassistant.const import CONF_NAME
from homeassistant.exceptions import PlatformNotReady
from homeassistant.helpers.aiohttp_client import async_get_clientsession
import homeassistant.helpers.config_validation as cv
from homeassistant.util import Throttle

_LOGGER = logging.getLogger(__name__)

ATTRIBUTION = "Data provided by openSenseMap"

CONF_STATION_ID = "station_id"

SCAN_INTERVAL = timedelta(minutes=10)

PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
    {vol.Required(CONF_STATION_ID): cv.string, vol.Optional(CONF_NAME): cv.string}
)


async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
    """Set up the openSenseMap air quality platform."""

    name = config.get(CONF_NAME)
    station_id = config[CONF_STATION_ID]

    session = async_get_clientsession(hass)
    osm_api = OpenSenseMapData(OpenSenseMap(station_id, hass.loop, session))

    await osm_api.async_update()

    if "name" not in osm_api.api.data:
示例#4
0
)
from .device import XiaomiMiioEntity

_LOGGER = logging.getLogger(__name__)

DEFAULT_NAME = "Xiaomi Miio Air Quality Monitor"

ATTR_CO2E = "carbon_dioxide_equivalent"
ATTR_TVOC = "total_volatile_organic_compounds"
ATTR_TEMP = "temperature"
ATTR_HUM = "humidity"

PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
    vol.Required(CONF_HOST):
    cv.string,
    vol.Required(CONF_TOKEN):
    vol.All(cv.string, vol.Length(min=32, max=32)),
    vol.Optional(CONF_NAME, default=DEFAULT_NAME):
    cv.string,
})

PROP_TO_ATTR = {
    "carbon_dioxide_equivalent": ATTR_CO2E,
    "total_volatile_organic_compounds": ATTR_TVOC,
    "temperature": ATTR_TEMP,
    "humidity": ATTR_HUM,
}


class AirMonitorB1(XiaomiMiioEntity, AirQualityEntity):
    """Air Quality class for Xiaomi cgllc.airmonitor.b1 device."""
    def __init__(self, name, device, entry, unique_id):
示例#5
0
from homeassistant.helpers.aiohttp_client import async_get_clientsession
import homeassistant.helpers.config_validation as cv
from homeassistant.util import Throttle

REQUIREMENTS = ['opensensemap-api==0.1.5']

_LOGGER = logging.getLogger(__name__)

ATTRIBUTION = 'Data provided by openSenseMap'

CONF_STATION_ID = 'station_id'

SCAN_INTERVAL = timedelta(minutes=10)

PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
    vol.Required(CONF_STATION_ID): cv.string,
    vol.Optional(CONF_NAME): cv.string,
})


async def async_setup_platform(
        hass, config, async_add_entities, discovery_info=None):
    """Set up the openSenseMap air quality platform."""
    from opensensemap_api import OpenSenseMap

    name = config.get(CONF_NAME)
    station_id = config[CONF_STATION_ID]

    session = async_get_clientsession(hass)
    osm_api = OpenSenseMapData(OpenSenseMap(station_id, hass.loop, session))

    await osm_api.async_update()
    "Ålesund",
]

PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
    vol.Inclusive(CONF_LATITUDE, "coordinates", "Latitude and longitude must exist together"):
    cv.latitude,
    vol.Inclusive(CONF_LONGITUDE, "coordinates", "Latitude and longitude must exist together"):
    cv.longitude,
    vol.Exclusive(
        CONF_AREA,
        "station_collection",
        "Can only configure one specific station or "
        "stations in a specific area pr sensor. "
        "Please only configure station or area.",
    ):
    vol.All(cv.string, vol.In(CONF_ALLOWED_AREAS)),
    vol.Exclusive(
        CONF_STATION,
        "station_collection",
        "Can only configure one specific station or "
        "stations in a specific area pr sensor. "
        "Please only configure station or area.",
    ):
    vol.All(cv.ensure_list, [cv.string]),
    vol.Optional(CONF_NAME, default=DEFAULT_NAME):
    cv.string,
    vol.Optional(CONF_SHOW_ON_MAP, default=False):
    cv.boolean,
})


def setup_platform(hass, config, add_entities, discovery_info=None):
示例#7
0
    CONF_STATION_ID,
    EkoKartaZagrebData,
    SENSOR_TYPES,
    ATTR_STATION,
    ATTR_UPDATED,
    closest_station,
    ekokartazagreb_stations,
)

_LOGGER = logging.getLogger(__name__)

PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
    vol.Optional(CONF_STATION_ID):
    cv.string,
    vol.Optional(CONF_NAME, default=DEFAULT_NAME):
    cv.string,
    vol.Inclusive(CONF_LATITUDE, "coordinates", "Latitude and longitude must exist together"):
    cv.latitude,
    vol.Inclusive(CONF_LONGITUDE, "coordinates", "Latitude and longitude must exist together"):
    cv.longitude,
})

SCAN_INTERVAL = timedelta(minutes=20)


def setup_platform(hass, config, add_entities, discovery_info=None):
    """Set up the Eko Karta Zagreb weather platform."""
    name = config.get(CONF_NAME)
    station_id = config.get(CONF_STATION_ID)
    latitude = config.get(CONF_LATITUDE, hass.config.latitude)
    longitude = config.get(CONF_LONGITUDE, hass.config.longitude)
    'Tromsø',
    'Trondheim',
    'Tustervatn',
    'Zeppelinfjellet',
    'Ålesund',
]

PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
    vol.Inclusive(CONF_LATITUDE, 'coordinates',
                  'Latitude and longitude must exist together'): cv.latitude,
    vol.Inclusive(CONF_LONGITUDE, 'coordinates',
                  'Latitude and longitude must exist together'): cv.longitude,
    vol.Exclusive(CONF_AREA, 'station_collection',
                  'Can only configure one specific station or '
                  'stations in a specific area pr sensor. '
                  'Please only configure station or area.'
                  ): vol.All(cv.string, vol.In(CONF_ALLOWED_AREAS)),
    vol.Exclusive(CONF_STATION, 'station_collection',
                  'Can only configure one specific station or '
                  'stations in a specific area pr sensor. '
                  'Please only configure station or area.'
                  ): vol.All(cv.ensure_list, [cv.string]),
    vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string,
    vol.Optional(CONF_SHOW_ON_MAP, default=False): cv.boolean,
})


def setup_platform(hass, config, add_entities, discovery_info=None):
    """Set up the NILU air quality sensor."""
    import niluclient as nilu
    name = config.get(CONF_NAME)
    area = config.get(CONF_AREA)
from functools import partial
from typing import Optional

import homeassistant.helpers.config_validation as cv
import requests
import voluptuous as vol
from homeassistant.components.air_quality import AirQualityEntity, PLATFORM_SCHEMA
from homeassistant.util import Throttle

_LOGGER = logging.getLogger(__name__)

DOMAIN = "podkowaaq"

CONF_STATION = "station"

PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
    {vol.Required(CONF_STATION): cv.string})


def setup_platform(hass, config, add_entities, discovery_info=None):
    station = config.get(CONF_STATION)
    repository = MeasurementRepository(station)
    add_entities([PodkowaAQ(station, repository)])


class Measurement:
    def pm25(self):
        return None

    def pm10(self):
        return None
示例#10
0
    GW1000EntityFactory
)

from .const import (
    DOMAIN
)

from .conversions import (
    CONVERT
)

DEPENDENCIES = ['gw1000']

PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
    {
        vol.Optional(CONF_NAME, default=DOMAIN): cv.string,
        vol.Optional(CONF_WEBHOOK_ID): cv.string,
    }
)

def setup_platform(hass, config, add_entities, discovery_info=None):
    """Set up the webhook."""

    name = config.get(CONF_NAME)
    webhook_id = config.get(CONF_WEBHOOK_ID, name)

    _LOGGER.debug("Initializing Air Quality platform: name=%s webhook_id=%s", name, webhook_id)

    factory = GW1000AirQualityEntityFactory(hass, add_entities, webhook_id)
    #add_entities([GW1000PM25(name, webhook_id)], True)

class GW1000AirQualityEntityFactory(GW1000EntityFactory):
示例#11
0
DEFAULT_NAME = 'RIVM'
DEFAULT_ATTRIBUTION = 'Data provided by Rijksinstituut voor Volksgezondheid en Milieu (RIVM)'
DEFAULT_SCAN_INTERVAL = timedelta(mninutes=60)

RIVM_DATEFORMAT = '%d/%m/%Y'

SENSOR_TYPES = {
    'nitrogen_monoxide': ['', 'mdi:calendar'],
    'nitrogen_dioxide': ['Nitrogen Dioxide', 'mdi:car'],
    'recall': ['Recall', 'mdi:car'],
}

PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
    vol.Required(CONF_PLATE): cv.string,
    vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string,
    vol.Optional(CONF_SENSORS, default=[]):
        vol.All(cv.ensure_list, [vol.In(SENSOR_TYPES)]),
    vol.Optional(CONF_SCAN_INTERVAL, default=DEFAULT_SCAN_INTERVAL):
        cv.time_period
})


def setup_platform(hass, config, add_devices, discovery_info=None):
    """Set up the RIVM Platform."""

    name = config.get(CONF_NAME)
    plate = config.get(CONF_PLATE)
    interval = config.get(CONF_SCAN_INTERVAL)

    data = RIVMSensorData(hass, plate.upper(), interval)

    dev = []