Exemplo n.º 1
0
CONFLICTS_WITH = ['wifi']
ESP_PLATFORMS = [ESP_PLATFORM_ESP32]

CONF_PHY_ADDR = 'phy_addr'
CONF_MDC_PIN = 'mdc_pin'
CONF_MDIO_PIN = 'mdio_pin'
CONF_CLK_MODE = 'clk_mode'
CONF_POWER_PIN = 'power_pin'

EthernetType = esphome_ns.enum('EthernetType')
ETHERNET_TYPES = {
    'LAN8720': EthernetType.ETHERNET_TYPE_LAN8720,
    'TLK110': EthernetType.ETHERNET_TYPE_TLK110,
}

eth_clock_mode_t = global_ns.enum('eth_clock_mode_t')
CLK_MODES = {
    'GPIO0_IN': eth_clock_mode_t.ETH_CLOCK_GPIO0_IN,
    'GPIO0_OUT': eth_clock_mode_t.ETH_CLOCK_GPIO0_OUT,
    'GPIO16_OUT': eth_clock_mode_t.ETH_CLOCK_GPIO16_OUT,
    'GPIO17_OUT': eth_clock_mode_t.ETH_CLOCK_GPIO17_OUT,
}

EthernetComponent = esphome_ns.class_('EthernetComponent', Component)


def validate(config):
    if CONF_USE_ADDRESS not in config:
        if CONF_MANUAL_IP in config:
            use_address = str(config[CONF_MANUAL_IP][CONF_STATIC_IP])
        else:
Exemplo n.º 2
0
                          u"".format(', '.join(str(x) for x in valid_pins)))
    return value


DeepSleepComponent = esphome_ns.class_('DeepSleepComponent', Component)
EnterDeepSleepAction = esphome_ns.class_('EnterDeepSleepAction', Action)
PreventDeepSleepAction = esphome_ns.class_('PreventDeepSleepAction', Action)

WakeupPinMode = esphome_ns.enum('WakeupPinMode')
WAKEUP_PIN_MODES = {
    'IGNORE': WakeupPinMode.WAKEUP_PIN_MODE_IGNORE,
    'KEEP_AWAKE': WakeupPinMode.WAKEUP_PIN_MODE_KEEP_AWAKE,
    'INVERT_WAKEUP': WakeupPinMode.WAKEUP_PIN_MODE_INVERT_WAKEUP,
}

esp_sleep_ext1_wakeup_mode_t = global_ns.enum('esp_sleep_ext1_wakeup_mode_t')
Ext1Wakeup = esphome_ns.struct('Ext1Wakeup')
EXT1_WAKEUP_MODES = {
    'ALL_LOW': esp_sleep_ext1_wakeup_mode_t.ESP_EXT1_WAKEUP_ALL_LOW,
    'ANY_HIGH': esp_sleep_ext1_wakeup_mode_t.ESP_EXT1_WAKEUP_ANY_HIGH,
}

CONF_WAKEUP_PIN_MODE = 'wakeup_pin_mode'
CONF_ESP32_EXT1_WAKEUP = 'esp32_ext1_wakeup'

CONFIG_SCHEMA = cv.Schema({
    cv.GenerateID():
    cv.declare_variable_id(DeepSleepComponent),
    vol.Optional(CONF_SLEEP_DURATION):
    cv.positive_time_period_milliseconds,
    vol.Optional(CONF_WAKEUP_PIN):