Esphome version: 2021.10.0 breaks my project

My project which is successfully compiled with esphome version 2021.9.3, now can’t be compiled.
Until now it can be compiled and it runs flawlessly.
Issue is definition of millis function which are differently defined in libraries.
Something is very wrong with this version.

Main yaml file:

substitutions:
  devicename: tagreader
  friendly_name: TagReader
  pn532_update_interval: 1s
  i2c_freq: 400kHz

# Logging
logger:
  #level: VERY_VERBOSE
  #level: VERBOSE
  #
  #level: ERROR
  #level: INFO
  level: INFO
  baud_rate: 0
  tx_buffer_size: 128
  id: mylogger
  logs:
    i2c: ERROR

wifi:
  networks:
    - ssid:  "IShome07"
      password: !secret wifi_password
    - ssid:  "IShome04"
      password: !secret wifi_password
    - ssid:  "IShome05"
      password: !secret wifi_password
    - ssid:  "IShome06"
      password: !secret wifi_password
  domain: !secret domain

  ap:
    ssid: ${devicename}
    password: !secret ap_password

# Enable the captive portal for inital WiFi setup
captive_portal:

esphome:
  name: $devicename
  platform: ESP32
  board: esp32doit-devkit-v1
  # Keypadtext begin
  includes:
    - keypad_sensor_textsensor.h
  libraries:
    #- "Keypad"
    - "chris--a/Keypad"
  # Keypadtext end

  on_boot:
    priority: -10
    then:
    - light.turn_on:
        id: group_led
        brightness: 100%
        red: 100%
        green: 100%
        blue: 100%
    - light.turn_off:
        id: group_led
    - light.turn_on:
        id: group_led
        brightness: 100%
        red: 100%
        green: 100%
        blue: 100%
        flash_length: 500ms
    - rtttl.play: "booted:d=64,o=7,b=120:c,p,p,c"
    - wait_until:
        api.connected:
    - lambda: |-
        id(api_was_connected) = 1;
    - logger.log: API is connected!
    #- rtttl.play: "startup:d=32,o=5,b=120:c,d,e,f,g,a,h"
    - rtttl.play: "startupA:d=32,o=5,b=120:c,d,e,f,g,a,h"
    - light.turn_on:
        id: group_led
        #id: led_p1
        brightness: 100%
        red: 0%
        green: 0%
        blue: 100%
        flash_length: 500ms
    - delay: 1s
    - light.turn_off:
        id: led_p1
    - delay: 1s
    - light.turn_off:
        id: led_p2

    - delay: 5s
    - homeassistant.service:
        service: script.tagreader_on_boot
    - delay: 1s

    - light.turn_on:
        id: group_led
        #id: led_p1
        brightness: 100%
        red: 100%
        green: 100%
        blue: 100%
        flash_length: 100ms
    - delay: 5s
    - rtttl.play: "startupB:d=32,o=5,b=120:e,e,e"
    - delay: 1s
    - light.turn_off:
        id: led_p2

  on_shutdown:
    then:
      - script.execute: hw_restart
      - rtttl.play: "shutdown:d=32,o=5,b=120:h,a,g,f,e,d,c"

# Define switches to control LED and buzzer from HA
switch:
  - platform: gpio
    pin: 22
    id: power_pn532
    name: power_pn532
    restore_mode: ALWAYS_OFF

  - platform: template
    name: "${friendly_name} Buzzer Enabled"
    id: buzzer_enabled
    icon: mdi:volume-high
    optimistic: true
    restore_state: true
  - platform: template
    name: "${friendly_name} LED enabled"
    id: led_enabled
    icon: mdi:alarm-light-outline
    optimistic: true
    restore_state: true
  # Restart switch
  - platform: restart
    id: restart_switch
    name: "${friendly_name} Restart"

# Enable Home Assistant API
api:
  password: !secret api_password
  services:
  - service: hw_reboot
    then:
    - script.execute: hw_restart

  - service: rfidreader_tag_ok
    then:
    - rtttl.play: "beep:d=16,o=5,b=100:b"

  - service: rfidreader_tag_ko
    then:
    - rtttl.play: "beep:d=8,o=5,b=100:b"

  - service: acknowledge
    variables:
      kind: bool
    then:
      - if:
          condition:
            lambda: !lambda 'return kind;'
          then:
            - script.execute: sign_yes
          else:
            - script.execute: sign_no

  - service: play_rtttl
    variables:
      song: string
    then:
    - rtttl.play: !lambda 'return song;'

  - service: beep
    then:
    - rtttl.play: "beep:d=4,o=5,b=140:32d6"
    
  - service: play_auld_lang_syne
    then:
    - rtttl.play: "AuldLangSyne:d=4,o=5,b=100:4g4,4c5,8c5,4c5,4e5,4d5,8c5,4d5,8e5,8d5,4c5,8c5,4e5,4g5,2a5,4a5,4g5,8e5,4e5,4c5,4d5,8c5,4d5,8e5,8d5,4c5,8a4,4a4,4g4,2c5"

  - service: write_tag_random
    then:
    - lambda: |-
        static const char alphanum[] = "0123456789abcdef";
        std::string uri = "https://www.home-assistant.io/tag/";
        for (int i = 0; i < 8; i++)
          uri += alphanum[random_uint32() % (sizeof(alphanum) - 1)];
        uri += "-";
        for (int j = 0; j < 3; j++) {
          for (int i = 0; i < 4; i++)
            uri += alphanum[random_uint32() % (sizeof(alphanum) - 1)];
          uri += "-";
        }
        for (int i = 0; i < 12; i++)
          uri += alphanum[random_uint32() % (sizeof(alphanum) - 1)];
        auto message = new nfc::NdefMessage();
        message->add_uri_record(uri);
        ESP_LOGD("tagreader", "Writing payload: %s", uri.c_str());
        id(pn532_board).write_mode(message);


  - service: write_tag_id
    variables:
      tag_id: string
    then:
    - lambda: |-
        auto message = new nfc::NdefMessage();
        std::string uri = "https://www.home-assistant.io/tag/";
        uri += tag_id;
        message->add_uri_record(uri);
        id(pn532_board).write_mode(message);

  - service: clean_tag
    then:
    - lambda: 'id(pn532_board).clean_mode();'

  - service: cancel_writing
    then:
    - lambda: 'id(pn532_board).read_mode();'

# Enable OTA upgrade
ota:
  password: !secret ota_password

i2c:
  - id: bus_a
    #sda: 21
    #scl: 22

    sda: 3
    scl: 1
    scan: True
    frequency: ${i2c_freq}

pn532_i2c:
  id: pn532_board
  i2c_id: bus_a
  update_interval: ${pn532_update_interval}
  on_tag:
    then:
    - homeassistant.tag_scanned: !lambda |
        if (!tag.has_ndef_message()) {
          ESP_LOGD("tagreader", "No NDEF");
          return x;
        }
        auto message = tag.get_ndef_message();
        auto records = message->get_records();
        for (auto &record : records) {
          std::string payload = record->get_payload();
          size_t pos = payload.find("https://www.home-assistant.io/tag/");
          if (pos != std::string::npos) {
            return payload.substr(pos + 34);
          }
        }
        ESP_LOGD("tagreader", "Bad NDEF, fallback to uid");
        return x;
    - if:
        condition:
          switch.is_on: buzzer_enabled
        then:
        - rtttl.play: "success:d=24,o=5,b=100:c,g,b"
    - if:
        condition:
          switch.is_on: led_enabled
        then:
        - light.turn_on:
            id: led_p2
            brightness: 100%
            red: 0%
            green: 0%
            blue: 100%
        - delay: 250ms
        - script.execute: led_p2_state

# Define the buzzer output
output:
  - platform: ledc
    pin: GPIO27
    #frequency: 1220Hz
    #frequency: 19531Hz
    frequency: 78124Hz
    #channel: 2
    inverted: True
    id: buzzer

# Define buzzer as output for RTTTL
rtttl:
  output: buzzer

# Define status LED
status_led:
  pin:
    number: GPIO2
    inverted: True

# Configure RGB LEDs and partitions
#light:
#  - platform: fastled_spi
#    chipset: WS2801
#    data_pin: GPIO4
#    clock_pin: GPIO15
#    default_transition_length: 10ms
#    num_leds: 2
#    rgb_order: RGB
#    id: group_led
#    name: "${friendly_name} LED base"
#    restore_mode: ALWAYS_OFF
#    internal: true

light:
  - platform: fastled_clockless
    chipset: APA106
    pin: GPIO4
    num_leds: 2
    #rgb_order: BRG
    rgb_order: RGB
    id: group_led
    name: "${friendly_name} LED base"
    restore_mode: ALWAYS_OFF
    default_transition_length: 0s
    internal: true

  - platform: partition
    name: "${friendly_name} LED P1"
    id: "led_p1"
    segments:
      - id: group_led
        from: 0
        to: 0
    effects: !include light_effects.yaml
    restore_mode: ALWAYS_OFF
    default_transition_length: 0s

  - platform: partition
    name: "${friendly_name} LED P2"
    id: "led_p2"
    segments:
      - id: group_led
        from: 1
        to: 1
    effects: !include light_effects.yaml
    restore_mode: ALWAYS_OFF
    default_transition_length: 0s
# RGB LED end

text_sensor:
  - platform: version
    name: "${friendly_name} ESPHome Version"

  - platform: custom
    id: keypad_sensor
    lambda: |-
      auto keytext_sensor = new KeypadTextSensor();
      App.register_component(keytext_sensor);
      return {keytext_sensor->phrase_sensor, keytext_sensor->char_sensor, keytext_sensor->current_phrase_sensor, keytext_sensor->keypad_enabled};

    text_sensors:
      # Line text, '#' is enter and send input to HA, '*' is clear, means clear all input, send empty string to HA
      - name: "${friendly_name} Keypad TextSensor"
        id: "keypad_textsensor"
        icon: "mdi:script-text-outline"
      # Pressed character as number, instantly sent to HA, valid for 500ms max.
      # Characters are 0,1,2,3,4,5,6,7,8,9 for numerics
      # 'A'=17, 'B'=18, 'C'=19, 'D'=20, '*'=-6, '#'=-13 '!'=-15
      - name: "${friendly_name} Keypad CharSensor"
        id: "keypad_charsensor"
        icon: "mdi:format-text-variant-outline"
        on_value:
          - if:
              condition:
                lambda: 'return id(keypad_charsensor).state == "-13";'
              then:
                - if:
                    condition:
                      switch.is_on: buzzer_enabled
                    then:
                      - rtttl.play: "enter_beep:d=32,o=4,b=120:c,e"
                - if:
                    condition:
                      switch.is_on: led_enabled
                    then:
                      - light.turn_off:
                          id: led_p2
                      - light.turn_on:
                          id: led_p2
                          brightness: 50%
                          red: 0%
                          green: 100%
                          blue: 0%
                      - delay: 250ms
                      - script.execute: led_p2_state
          - if:
              condition:
                lambda: 'return id(keypad_charsensor).state == "-6";'
              then:
                - if:
                    condition:
                      switch.is_on: buzzer_enabled
                    then:
                      - rtttl.play: "clear_beep:d=32,o=4,b=120:e,c,c"
                - if:
                    condition:
                      switch.is_on: led_enabled
                    then:
                      - light.turn_on:
                          id: led_p2
                          brightness: 50%
                          red: 100%
                          green: 0%
                          blue: 100%
                      - delay: 250ms
                      - script.execute: led_p2_state
          - if:
              condition:
                lambda: 'return id(keypad_charsensor).state == "-15";'
              then:
                - if:
                    condition:
                      switch.is_on: led_enabled
                    then:
                      - light.turn_off:
                          id: led_p2
          - if:
              condition:
                and:
                  - lambda: 'return id(keypad_charsensor).state != "-6";'
                  - lambda: 'return id(keypad_charsensor).state != "-13";'
                  - lambda: 'return id(keypad_charsensor).state != "-15";'
                  - lambda: 'return id(keypad_charsensor).state != "";'
              then:
                - if:
                    condition:
                      switch.is_on: buzzer_enabled
                    then:
                      - rtttl.play: "key_beep:d=32,o=7,b=120:g"
                - if:
                    condition:
                      switch.is_on: led_enabled
                    then:
                      #
                      - light.turn_on:
                          id: led_p2
                          red: 19%
                          green: 19%
                          blue: 0%
                          brightness: 60%
                      - delay: 250ms
                      - light.turn_on:
                          id: led_p2
                          red: 19%
                          green: 19%
                          blue: 0%
                          brightness: 20%
                      #
      #
      - name: "${friendly_name} Current Keypad TextSensor"
        id: "current_keypad_textsensor"
        icon: "mdi:script-text-play-outline"
      # keypad_enabled
      - name: "${friendly_name} Keypad Enabled"
        id: "keypad_enabled"
        icon: "mdi:dialpad"

  - platform: wifi_info
    ip_address:
      name: "${friendly_name} IP"
    ssid:
      name: "${friendly_name} Connected SSID"
      icon: "mdi:wifi"
    bssid:
      name: "${friendly_name} Connected BSSID"
    mac_address:
      name: "${friendly_name} Mac Wifi Address"

sensor:
  - platform: uptime
    name: "${devicename} uptime"
  # To replace ${ble_presence_timeout} with from home assistant adjustable value. See log.
  - platform: homeassistant
    name: "BLE presence timeout"
    entity_id: sensor.ble_presence_timeout_int
    id: ble_presence_timeout_int
    internal: true
  # To replace ${ble_presence_timeout} end
  - platform: wifi_signal
    name: "${devicename} WiFi Signal"
    update_interval: 60s

script:
  - id: itag_red_timer
    mode: restart
    then:
      - binary_sensor.template.publish:
          id: itag_red
          state: ON
      #- delay: ${ble_presence_timeout} # Replaced with from home assistant adjustable value. See log.
      - delay: !lambda 'return id(ble_presence_timeout_int).state * 1000;'
      - binary_sensor.template.publish:
          id: itag_red
          state: OFF

  - id: itag_blue_timer
    mode: restart
    then:
      - binary_sensor.template.publish:
          id: itag_blue
          state: ON
      #- delay: ${ble_presence_timeout} # Replaced with from home assistant adjustable value. See log.
      - delay: !lambda 'return id(ble_presence_timeout_int).state * 1000;'
      - binary_sensor.template.publish:
          id: itag_blue
          state: OFF

  - id: itag_black_timer
    mode: restart
    then:
      - binary_sensor.template.publish:
          id: itag_black
          state: ON
      #- delay: ${ble_presence_timeout} # Replaced with from home assistant adjustable value. See log.
      - delay: !lambda 'return id(ble_presence_timeout_int).state * 1000;'
      - binary_sensor.template.publish:
          id: itag_black
          state: OFF
  - id: hw_restart
    then:
      - switch.turn_on: power_pn532
      - delay: 1s
      - switch.turn_on: restart_switch
  - id: sign_yes
    then:
      - if:
          condition:
            switch.is_on: buzzer_enabled
          then:
            - rtttl.play: "yes_beep:d=32,o=4,b=120:c,g"
      - if:
          condition:
            switch.is_on: led_enabled
          then:
            - light.turn_on:
                id: led_p2
                brightness: 100%
                red: 0%
                green: 100%
                blue: 0%
            - delay: 250ms
            - script.execute: led_p2_state
  - id: sign_no
    then:
      - if:
          condition:
            switch.is_on: buzzer_enabled
          then:
            - rtttl.play: "no_beep:d=32,o=4,b=120:c,c"
      - if:
          condition:
            switch.is_on: led_enabled
          then:
            - light.turn_on:
                id: led_p2
                brightness: 100%
                red: 100%
                green: 0%
                blue: 0%
            - delay: 250ms
            - script.execute: led_p2_state
  - id: led_p2_state
    then:
       - light.turn_off:
           id: led_p2
             

esp32_ble_tracker:
  scan_parameters:
    active: false
    interval: 300ms
    window: 200ms
    duration: 5s
  on_ble_advertise:
    - mac_address: 00:00:00:00:00:01
      then:
        - script.execute: itag_red_timer
    - mac_address: 00:00:00:00:00:02
      then:
        - script.execute: itag_blue_timer
    - mac_address: 00:00:00:00:00:03
      then:
        - script.execute: itag_black_timer

binary_sensor:
  - platform: status
    name: "${friendly_name} Status"

  - platform: gpio
    pin:
      number: 36
  #    mode: INPUT_PULLUP
    name: "${devicename} HW status"
    id: hw_status_input
    filters:
      - delayed_on: 2000ms

  - platform: template
    name: "iTag red"
    id: "itag_red"

  - platform: template
    name: "iTag blue"
    id: "itag_blue"

  - platform: template
    name: "iTag black"
    id: "itag_black"

globals:
   - id: reboot_counter
     type: int
     restore_value: no
     initial_value: '0'
   - id: api_was_connected
     type: int
     restore_value: no
     initial_value: '0'

interval:
  - interval: 20sec
    then:
      - if:
          condition:
            switch.is_off: led_enabled
          then:
            - if:
                condition:
                  light.is_on: led_p1
                then:
                  - light.turn_off:
                      id: led_p1
            - if:
                condition:
                  light.is_on: led_p2
                then:
                  - light.turn_off:
                      id: led_p2


      - if:
          condition:
            lambda: 'return id(api_was_connected) > 0;'
          then:
            - if:
                condition:
                  not:
                    api.connected:
                then:
                  - if:
                      condition:
                        lambda: 'return id(reboot_counter) == 0;'
                      then:
                        - light.turn_off:
                            id: led_p1
                        - rtttl.play: "startupB:d=32,o=5,b=120:e,e,e"
                  #-
                  # Reboot after 20 cycles (20 * 20sec = 5min)
                  - if:
                      condition:
                        lambda: 'return id(reboot_counter) > 20;'
                      then:
                        - script.execute: hw_restart
                        - lambda: |-
                            id(reboot_counter) = 0;
                  - lambda: |-
                      id(reboot_counter) += 1;
                  #-
                else:
                  - if:
                      condition:
                        lambda: 'return id(reboot_counter) > 0;'
                      then:
                        - rtttl.play: "startupB:d=32,o=5,b=120:e,e,e"
                  - lambda: |-
                      id(reboot_counter) = 0;

My custom library keypad_sensor_textsensor.h

#include "esphome.h"
#include "Keypad.h"

class KeypadTextSensor : public Component, public CustomAPIDevice {

    public:

    static const byte n_rows = 4;
    static const byte n_cols = 4;

    bool keyPublished = false;

    static const unsigned int resetTimeB = 500;
    unsigned int lastPublish = 0;

    char keys[n_rows][n_cols] = {
      {'1','2','3','A'},
      {'4','5','6','B'},
      {'7','8','9','C'},
      {'*','0','#','D'}
    };

    //byte colPins[n_cols] = {32, 33, 25, 26};
    //byte rowPins[n_rows] = {23, 18, 19, 17};

    byte rowPins[n_cols] = {32, 33, 25, 26};
    byte colPins[n_rows] = {23, 18, 17, 19};

    Keypad myKeypad = Keypad( makeKeymap(keys), rowPins, colPins, n_rows, n_cols);

    std::string keysequenz;

    static const unsigned int resetTimeA = 300;
    unsigned int resetCounter = 0;
    bool keyPressed = false;
    bool bufferCleared = false;
    bool bufferClearedSilent = false;
    bool enterSimulated = false;
    char simulatedKey = NO_KEY;
    bool keypadEnabled = true;


    TextSensor *phrase_sensor = new TextSensor();
    TextSensor *char_sensor = new TextSensor();
    TextSensor *current_phrase_sensor = new TextSensor();
    TextSensor *keypad_enabled = new TextSensor();



    void get_char(char ch) {
        char myKey = ch;
        
        if (myKey != NO_KEY){
            if (myKey == '#'){
                phrase_sensor->publish_state(keysequenz);
                keysequenz.clear();
                current_phrase_sensor->publish_state(keysequenz);
                resetCounter = 0;
                keyPressed = false;
            }
            else if (myKey == '*'){
                keysequenz.clear();
                current_phrase_sensor->publish_state(keysequenz);
                // In case of clear command we dont touch previously published value
                //phrase_sensor->publish_state(keysequenz);
                resetCounter = 0;
                keyPressed = false;
            }
            else if (myKey == '!'){
				keysequenz.clear();
                phrase_sensor->publish_state(keysequenz);
                resetCounter = 0;
                keyPressed = false;
            }
            else {
                keysequenz.push_back(myKey);
                current_phrase_sensor->publish_state(keysequenz);
                keyPressed = true;
            }
        }
        if (keyPressed){
            resetCounter++;
        }
        if (resetCounter >= resetTimeA){
            keysequenz.clear();
            phrase_sensor->publish_state(keysequenz);
            resetCounter = 0;
            keyPressed = false;
        }
    }

    void on_clear_textsensor_buffer() {
      bufferCleared = true;
    }
    
    void on_textsensor_null() {
      bufferClearedSilent = true;
    }
    
    void on_enter_key() {
      enterSimulated = true;
    }
    
    void on_put_ascii(int ascii) {
     
      if((ascii > 47) && (ascii < 58)){
	    // 0..9
	    simulatedKey = ascii;
	  } else {
	    if((ascii > 64) && (ascii < 69)){
	      // A..D
	      simulatedKey = ascii;
	    } else {
		  switch(ascii){
			case 33: // !
		    case 35: // #
		    case 42: // *
		      simulatedKey = ascii;
		      break;
		  }
		}
	  }
    }

    void publish_keypad_ena_dis() {
	  if(keypadEnabled){
	    keypad_enabled->publish_state("yes");
	  } else {
	    keypad_enabled->publish_state("no");
	  }
	}

    void on_enable_keypad() {
      keypadEnabled = true;
      publish_keypad_ena_dis();
    }

    void on_disable_keypad() {
      keypadEnabled = false;
      publish_keypad_ena_dis();
    }

    void setup() override {
	  myKeypad.setHoldTime(1000);  // Default is 1000mS, lets try longer hold time to avoid ghost A
	  myKeypad.setDebounceTime(50); // Default is 50mS, lets try longer debounce to avoid ghost A
	  register_service(&KeypadTextSensor::on_clear_textsensor_buffer, "clear_textsensor_buffer");
	  register_service(&KeypadTextSensor::on_textsensor_null, "textsensor_null");
	  register_service(&KeypadTextSensor:: on_enter_key, "simulate_enter_key");
	  register_service(&KeypadTextSensor:: on_put_ascii, "put_ascii", {"ascii"});
	  register_service(&KeypadTextSensor::on_enable_keypad, "enable_keypad");
	  register_service(&KeypadTextSensor::on_disable_keypad, "disable_keypad");
	  publish_keypad_ena_dis();

	  //
	  resetCounter = 0;
      keyPressed = false;
      bufferCleared = false;
      bufferClearedSilent = false;
      keysequenz.clear();
      current_phrase_sensor->publish_state(keysequenz);
      phrase_sensor->publish_state(keysequenz);
      char_sensor->publish_state("");
	  //
	}

    void loop() override {
    // This will be called by App.loop()

        char myKey = myKeypad.getKey();
        
        if (myKey == NO_KEY){
		  if(simulatedKey != NO_KEY){
		    myKey = simulatedKey;
		    simulatedKey = NO_KEY;
		  }
		}

        if (myKey == NO_KEY){
		  if (bufferClearedSilent) {
		    bufferClearedSilent = false;
		    myKey = '!';
		  } else {
		    if(bufferCleared){
			  bufferCleared = false;
		      myKey = '*';
		    } else {
		      if(enterSimulated){
			    enterSimulated = false;
		        myKey = '#';
		      }
		    }
	      }
		}

		if(keypadEnabled){
          if (myKey != NO_KEY){
              int key = myKey - 48;
              char_sensor->publish_state(to_string(key));
              keyPublished = true;
              lastPublish = millis();
              get_char(myKey);
          }
          else{
              if (keyPublished && (millis() - lastPublish) >= resetTimeB){
                  char_sensor->publish_state("");
                  keyPublished = false;
              }
          }
	    }
    }

};

Compilation messages:

igor@atomicpi:~/programming/esphome/tagreader_keypad.2021.10.0$ esphome compile tagreader_keypadtext.yaml
INFO Reading configuration tagreader_keypadtext.yaml...
INFO Generating C++ source...
INFO Compiling app...
Processing tagreader (board: esp32doit-devkit-v1; framework: arduino; platform: espressif32 @ 3.3.2)
-------------------------------------------------------------------------------------------------------------------------------
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
PACKAGES: 
 - framework-arduinoespressif32 3.10006.210326 (1.0.6) 
 - tool-esptoolpy 1.30100.210531 (3.1.0) 
 - toolchain-xtensa32 2.50200.97 (5.2.0)
LDF Modes: Finder ~ off, Compatibility ~ soft
Dependency Graph
|-- <AsyncTCP-esphome> 1.2.2
|-- <Keypad> 3.1.1
|-- <WiFi> 1.0
|-- <FS> 1.0
|-- <Update> 1.0
|-- <ESPAsyncWebServer-esphome> 1.3.0
|   |-- <AsyncTCP-esphome> 1.2.2
|-- <DNSServer> 1.1.0
|-- <Wire> 1.0.1
|-- <FastLED> 3.3.2
|-- <ESPmDNS> 1.0
Compiling .pioenvs/tagreader/src/main.cpp.o
Compiling .pioenvs/tagreader/lib66b/ESPAsyncWebServer-esphome/WebServer.cpp.o
Compiling .pioenvs/tagreader/libbf7/DNSServer/DNSServer.cpp.o
Compiling .pioenvs/tagreader/lib5d1/Wire/Wire.cpp.o
Archiving .pioenvs/tagreader/libbf7/libDNSServer.a
Indexing .pioenvs/tagreader/libbf7/libDNSServer.a
Compiling .pioenvs/tagreader/lib8ba/ESPmDNS/ESPmDNS.cpp.o
Archiving .pioenvs/tagreader/lib5d1/libWire.a
Indexing .pioenvs/tagreader/lib5d1/libWire.a
Archiving .pioenvs/tagreader/libFrameworkArduinoVariant.a
Indexing .pioenvs/tagreader/libFrameworkArduinoVariant.a
Compiling .pioenvs/tagreader/FrameworkArduino/Esp.cpp.o
In file included from src/main.cpp:281:0:
src/keypad_sensor_textsensor.h: In member function 'virtual void KeypadTextSensor::loop()':
src/keypad_sensor_textsensor.h:203:36: error: call of overloaded 'millis()' is ambiguous
               lastPublish = millis();
                                    ^
In file included from /home/igor/.platformio/packages/framework-arduinoespressif32/cores/esp32/Arduino.h:35:0,
                 from /home/igor/.platformio/packages/framework-arduinoespressif32/libraries/WiFi/src/WiFiUdp.h:38,
                 from /home/igor/.platformio/packages/framework-arduinoespressif32/libraries/DNSServer/src/DNSServer.h:3,
                 from src/esphome/components/captive_portal/captive_portal.h:6,
                 from src/esphome.h:18,
                 from src/main.cpp:3:
/home/igor/.platformio/packages/framework-arduinoespressif32/cores/esp32/esp32-hal.h:104:15: note: candidate: long unsigned int millis()
 unsigned long millis();
               ^
In file included from src/esphome/components/light/light_transformer.h:4:0,
                 from src/esphome/components/light/light_state.h:11,
                 from src/esphome/core/application.h:30,
                 from src/esphome/components/api/api_connection.h:4,
                 from src/esphome.h:2,
                 from src/main.cpp:3:
src/esphome/core/hal.h:37:10: note: candidate: uint32_t esphome::millis()
 uint32_t millis();
          ^
In file included from src/main.cpp:281:0:
src/keypad_sensor_textsensor.h:207:43: error: call of overloaded 'millis()' is ambiguous
               if (keyPublished && (millis() - lastPublish) >= resetTimeB){
                                           ^
In file included from /home/igor/.platformio/packages/framework-arduinoespressif32/cores/esp32/Arduino.h:35:0,
                 from /home/igor/.platformio/packages/framework-arduinoespressif32/libraries/WiFi/src/WiFiUdp.h:38,
                 from /home/igor/.platformio/packages/framework-arduinoespressif32/libraries/DNSServer/src/DNSServer.h:3,
                 from src/esphome/components/captive_portal/captive_portal.h:6,
                 from src/esphome.h:18,
                 from src/main.cpp:3:
/home/igor/.platformio/packages/framework-arduinoespressif32/cores/esp32/esp32-hal.h:104:15: note: candidate: long unsigned int millis()
 unsigned long millis();
               ^
In file included from src/esphome/components/light/light_transformer.h:4:0,
                 from src/esphome/components/light/light_state.h:11,
                 from src/esphome/core/application.h:30,
                 from src/esphome/components/api/api_connection.h:4,
                 from src/esphome.h:2,
                 from src/main.cpp:3:
src/esphome/core/hal.h:37:10: note: candidate: uint32_t esphome::millis()
 uint32_t millis();
          ^
Archiving .pioenvs/tagreader/lib66b/libESPAsyncWebServer-esphome.a
Indexing .pioenvs/tagreader/lib66b/libESPAsyncWebServer-esphome.a
Compiling .pioenvs/tagreader/FrameworkArduino/FunctionalInterrupt.cpp.o
Archiving .pioenvs/tagreader/lib8ba/libESPmDNS.a
Indexing .pioenvs/tagreader/lib8ba/libESPmDNS.a
Compiling .pioenvs/tagreader/FrameworkArduino/HardwareSerial.cpp.o
Compiling .pioenvs/tagreader/FrameworkArduino/IPAddress.cpp.o
Compiling .pioenvs/tagreader/FrameworkArduino/IPv6Address.cpp.o
Compiling .pioenvs/tagreader/FrameworkArduino/MD5Builder.cpp.o
Compiling .pioenvs/tagreader/FrameworkArduino/Print.cpp.o
Compiling .pioenvs/tagreader/FrameworkArduino/Stream.cpp.o
Compiling .pioenvs/tagreader/FrameworkArduino/StreamString.cpp.o
Compiling .pioenvs/tagreader/FrameworkArduino/WMath.cpp.o
*** [.pioenvs/tagreader/src/main.cpp.o] Error 1
================================================= [FAILED] Took 26.78 seconds =================================================

Wrap your keypad_sensor_textsensor.h class code in a “namespace esphome {” statement to avoid the conflicting definitions.

1 Like

Thank you very much @Dilbert66. that was really helpful.

how dit jou add that namespace ??
do you have a example ?

Nico

put this around your class definitiion:

namespace esphome {
  //your class is here
}

Try Release 2021.10.1 - October 21

just like dilbert says, complete .h contett placed between { }

However,
it looks like lot of things was changed in this release, particularry something about initializing GPIO’s and restore switch states, resulting that my hardware restarts over and over. I will need to change something in hardware.

@mcarty, just installed it, compiling…

That release will also fix the namespace millis issue as well.

Yes, indeed, 2021.10.1 fixed namespace millis issue, but my reseting issue is still there. I need grab solder iron and put out my auto reset circuit, then I will know more. Tomorow. But thanks a lot @Dilbert66, @mcarty.

2021.10.2 is released.

Thanks. I’ll try it now.
Unfortunately, the same issue is still there. Basically, after connecting HA api eso32 restarts, ove and over.
Same compiled with 2021.9.3 or earlier works good.

Well, yaml compiled in following enviroment works just fine:

(.esphome.2021.9.3) (sub: 2) igor@atomicpi:~/programming/esphome/tagreader_keypad$ esphome version
Version: 2021.9.3

(.esphome.2021.9.3) (sub: 2) igor@atomicpi:~/programming/esphome/tagreader_keypad$ platformio --version
PlatformIO Core, version 5.2.0

(.esphome.2021.9.3) (sub: 2) igor@atomicpi:~/programming/esphome/tagreader_keypad$ esphome compile tagreader_keypadtext.yaml
INFO Reading configuration tagreader_keypadtext.yaml...
INFO Generating C++ source...
INFO Compiling app...
INFO Running:  platformio run -d tagreader
*******************************************************************************************************************************
Obsolete PIO Core v5.2.0 is used (previous was 5.2.1)
Please remove multiple PIO Cores from a system:
https://docs.platformio.org/page/faq.html#multiple-platformio-cores-in-a-system
*******************************************************************************************************************************
Processing tagreader (board: esp32doit-devkit-v1; framework: arduino; platform: platformio/[email protected])
-------------------------------------------------------------------------------------------------------------------------------
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
PACKAGES: 
 - framework-arduinoespressif32 3.10006.210326 (1.0.6) 
 - tool-esptoolpy 1.30000.201119 (3.0.0) 
 - toolchain-xtensa32 2.50200.97 (5.2.0)
Library Manager: Installing Hash
Library Manager: Already installed, built-in library
Dependency Graph
|-- <AsyncTCP-esphome> 1.2.2
|-- <Keypad> 3.1.1
|-- <FS> 1.0
|-- <ESPAsyncWebServer-esphome> 1.3.0
|   |-- <AsyncTCP-esphome> 1.2.2
|   |-- <FS> 1.0
|   |-- <WiFi> 1.0
|-- <ESPmDNS> 1.0
|   |-- <WiFi> 1.0
|-- <Wire> 1.0.1
|-- <FastLED> 3.3.2
|   |-- <SPI> 1.0
|-- <DNSServer> 1.1.0
|   |-- <WiFi> 1.0
|-- <Update> 1.0
|-- <WiFi> 1.0
Compiling .pioenvs/tagreader/src/main.cpp.o
Linking .pioenvs/tagreader/firmware.elf
Retrieving maximum program size .pioenvs/tagreader/firmware.elf
Checking size .pioenvs/tagreader/firmware.elf
RAM:   [==        ]  17.2% (used 56372 bytes from 327680 bytes)
Flash: [========= ]  92.6% (used 1699818 bytes from 1835008 bytes)
Building .pioenvs/tagreader/firmware.bin
================================================ [SUCCESS] Took 170.32 seconds ================================================
INFO Successfully compiled program

while same yaml compiled in following environment not working:

(.esphomedev) (sub: 2) 2:igor@atomicpi:~/programming/esphome/tagreader_keypad$ esphome version
Version: 2021.10.2

(.esphomedev) (sub: 2) igor@atomicpi:~/programming/esphome/tagreader_keypad$ platformio --version
PlatformIO Core, version 5.2.1

(.esphomedev) (sub: 2) igor@atomicpi:~/programming/esphome/tagreader_keypad$ esphome compile tagreader_keypadtext.yaml
INFO Reading configuration tagreader_keypadtext.yaml...
INFO Generating C++ source...
INFO Compiling app...
Processing tagreader (board: esp32doit-devkit-v1; framework: arduino; platform: espressif32 @ 3.3.2)
-------------------------------------------------------------------------------------------------------------------------------
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
Dependency Graph
|-- <AsyncTCP-esphome> 1.2.2
|-- <Keypad> 3.1.1
|-- <WiFi> 1.0
|-- <FS> 1.0
|-- <Update> 1.0
|-- <ESPAsyncWebServer-esphome> 2.0.0
|   |-- <AsyncTCP-esphome> 1.2.2
|-- <DNSServer> 1.1.0
|-- <Wire> 1.0.1
|-- <FastLED> 3.3.2
|-- <ESPmDNS> 1.0
Compiling .pioenvs/tagreader/src/main.cpp.o
Linking .pioenvs/tagreader/firmware.elf
RAM:   [==        ]  17.2% (used 56292 bytes from 327680 bytes)
Flash: [========= ]  92.4% (used 1695850 bytes from 1835008 bytes)
Building .pioenvs/tagreader/firmware.bin
================================================ [SUCCESS] Took 169.04 seconds ================================================
INFO Successfully compiled program.

It restarting randomly. It cannot be updated via wireless, because it resets.
On scanning nfc tag it resets.
Without pn532_i2c component, it works just fine.
I checked power supply with osciloscope, there ar eno issues, so brown out can be excluded.
It is software problem, and conclusion is: esphome versions 2021.10.0, 2021.10.1 and 2021.10.2 are broken!

Post an issue on github.

it would also be helpful if you can capture the reboot messages from the serial port. That will tell you the reboot reason and hopefully a stack trace to identify the code responsible.

I’m also suprised at how much flash space your program is using? That’s a lot of code.