def to_code(config): rhs = App.make_bme280_sensor(config[CONF_TEMPERATURE][CONF_NAME], config[CONF_PRESSURE][CONF_NAME], config[CONF_HUMIDITY][CONF_NAME], config[CONF_ADDRESS], config.get(CONF_UPDATE_INTERVAL)) bme280 = Pvariable(config[CONF_ID], rhs) if CONF_OVERSAMPLING in config[CONF_TEMPERATURE]: constant = OVERSAMPLING_OPTIONS[config[CONF_TEMPERATURE] [CONF_OVERSAMPLING]] add(bme280.set_temperature_oversampling(constant)) if CONF_OVERSAMPLING in config[CONF_PRESSURE]: constant = OVERSAMPLING_OPTIONS[config[CONF_PRESSURE] [CONF_OVERSAMPLING]] add(bme280.set_pressure_oversampling(constant)) if CONF_OVERSAMPLING in config[CONF_HUMIDITY]: constant = OVERSAMPLING_OPTIONS[config[CONF_HUMIDITY] [CONF_OVERSAMPLING]] add(bme280.set_humidity_oversampling(constant)) if CONF_IIR_FILTER in config: constant = IIR_FILTER_OPTIONS[config[CONF_IIR_FILTER]] add(bme280.set_iir_filter(constant)) sensor.setup_sensor(bme280.Pget_temperature_sensor(), config[CONF_TEMPERATURE]) sensor.setup_sensor(bme280.Pget_pressure_sensor(), config[CONF_PRESSURE]) sensor.setup_sensor(bme280.Pget_humidity_sensor(), config[CONF_HUMIDITY]) setup_component(bme280, config)
def to_code(config): rhs = App.make_htu21d_sensor(config[CONF_TEMPERATURE][CONF_NAME], config[CONF_HUMIDITY][CONF_NAME], config.get(CONF_UPDATE_INTERVAL)) htu21d = Pvariable(config[CONF_ID], rhs) sensor.setup_sensor(htu21d.Pget_temperature_sensor(), config[CONF_TEMPERATURE]) sensor.setup_sensor(htu21d.Pget_humidity_sensor(), config[CONF_HUMIDITY]) setup_component(htu21d, config)
def to_code(config): rhs = App.make_bmp085_sensor(config[CONF_TEMPERATURE][CONF_NAME], config[CONF_PRESSURE][CONF_NAME], config.get(CONF_UPDATE_INTERVAL)) bmp = Pvariable(config[CONF_ID], rhs) if CONF_ADDRESS in config: add(bmp.set_address(HexIntLiteral(config[CONF_ADDRESS]))) sensor.setup_sensor(bmp.Pget_temperature_sensor(), config[CONF_TEMPERATURE]) sensor.setup_sensor(bmp.Pget_pressure_sensor(), config[CONF_PRESSURE]) setup_component(bmp, config)
def to_code(config): rhs = App.make_ms5611_sensor(config[CONF_TEMPERATURE][CONF_NAME], config[CONF_PRESSURE][CONF_NAME], config.get(CONF_UPDATE_INTERVAL)) ms5611 = Pvariable(config[CONF_ID], rhs) if CONF_ADDRESS in config: add(ms5611.set_address(config[CONF_ADDRESS])) sensor.setup_sensor(ms5611.Pget_temperature_sensor(), config[CONF_TEMPERATURE]) sensor.setup_sensor(ms5611.Pget_pressure_sensor(), config[CONF_PRESSURE]) setup_component(ms5611, config)
def to_code(config): for pin in gpio_output_pin_expression(config[CONF_PIN]): yield rhs = App.make_dht_sensor(config[CONF_TEMPERATURE][CONF_NAME], config[CONF_HUMIDITY][CONF_NAME], pin, config.get(CONF_UPDATE_INTERVAL)) dht = Pvariable(config[CONF_ID], rhs) if CONF_MODEL in config: constant = DHT_MODELS[config[CONF_MODEL]] add(dht.set_dht_model(constant)) sensor.setup_sensor(dht.Pget_temperature_sensor(), config[CONF_TEMPERATURE]) sensor.setup_sensor(dht.Pget_humidity_sensor(), config[CONF_HUMIDITY]) setup_component(dht, config)