mirror of
https://github.com/esphome/esphome.git
synced 2024-11-14 19:18:09 +01:00
8e75980ebd
* Cleanup dashboard JS * Add vscode * Save start_mark/end_mark * Updates * Updates * Remove need for cv.nameable It's a bit hacky but removes so much bloat from integrations * Add enum helper * Document APIs, and Improvements * Fixes * Fixes * Update PULL_REQUEST_TEMPLATE.md * Updates * Updates * Updates
21 lines
779 B
Python
21 lines
779 B
Python
import esphome.codegen as cg
|
|
import esphome.config_validation as cv
|
|
from esphome.components import ssd1306_base, i2c
|
|
from esphome.const import CONF_ID, CONF_LAMBDA, CONF_PAGES
|
|
|
|
AUTO_LOAD = ['ssd1306_base']
|
|
DEPENDENCIES = ['i2c']
|
|
|
|
ssd1306_i2c = cg.esphome_ns.namespace('ssd1306_i2c')
|
|
I2CSSD1306 = ssd1306_i2c.class_('I2CSSD1306', ssd1306_base.SSD1306, i2c.I2CDevice)
|
|
|
|
CONFIG_SCHEMA = cv.All(ssd1306_base.SSD1306_SCHEMA.extend({
|
|
cv.GenerateID(): cv.declare_id(I2CSSD1306),
|
|
}).extend(cv.COMPONENT_SCHEMA).extend(i2c.i2c_device_schema(0x3C)),
|
|
cv.has_at_most_one_key(CONF_PAGES, CONF_LAMBDA))
|
|
|
|
|
|
def to_code(config):
|
|
var = cg.new_Pvariable(config[CONF_ID])
|
|
yield ssd1306_base.setup_ssd1036(var, config)
|
|
yield i2c.register_i2c_device(var, config)
|