1
0
mirror of https://github.com/esphome/esphome.git synced 2025-04-13 14:20:29 +01:00
Thomas Eckerstorfer 68e7e5a51c AS3935 Lightning sensor (#666)
* added tx20 wind speed sensor

* added test

* fixed lint errors

* fixed more lint errors

* updated tx20

* updated tx20 sensor

* updated to new structure and removed static variables

* removed content from __init__.py

* fixing lint errors

* resolved issues from review

* added as3935 sensor

* updated as3935 with more settings

* update

* support for i2c + spi updated

* added tests and various fixes

* added tx20 wind speed sensor

* fixed lint errors

* fixed more lint errors

* updated tx20

* updated tx20 sensor

* updated to new structure and removed static variables

* removed content from __init__.py

* fixing lint errors

* resolved issues from review

* added as3935 sensor

* updated as3935 with more settings

* update

* support for i2c + spi updated

* added tests and various fixes

* updated tests

* fixed style issues

* Remove debug line

* Update log levels

* Reformat

* Auto-convert to int


Co-authored-by: Thomas <thomas.eckerstorfer@mic-cust.com>
Co-authored-by: Otto Winter <otto@otto-winter.com>
2019-10-12 15:03:35 +02:00

21 lines
676 B
Python

import esphome.codegen as cg
import esphome.config_validation as cv
from esphome.components import as3935_base, spi
from esphome.const import CONF_ID
AUTO_LOAD = ['as3935_base']
DEPENDENCIES = ['spi']
as3935_spi_ns = cg.esphome_ns.namespace('as3935_spi')
SPIAS3935 = as3935_spi_ns.class_('SPIAS3935Component', as3935_base.AS3935, spi.SPIDevice)
CONFIG_SCHEMA = cv.All(as3935_base.AS3935_SCHEMA.extend({
cv.GenerateID(): cv.declare_id(SPIAS3935)
}).extend(cv.COMPONENT_SCHEMA).extend(spi.SPI_DEVICE_SCHEMA))
def to_code(config):
var = cg.new_Pvariable(config[CONF_ID])
yield as3935_base.setup_as3935(var, config)
yield spi.register_spi_device(var, config)