home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
71.16k stars 29.83k forks source link

esphome 2023.12.0 #106155

Closed freddiemare closed 8 months ago

freddiemare commented 8 months ago

The problem

pi pico w wont update after esphome: 2023.12.0 update from esphome: 2023.11.6, errorlog below.

What version of Home Assistant Core has the issue?

2023.12.3

What was the last working version of Home Assistant Core?

2023.12.3

What type of installation are you running?

Home Assistant OS

Integration causing the issue

No response

Link to integration documentation on our website

No response

Diagnostics information

No response

Example YAML snippet

# ip: 192.168.2.145
substitutions:
  ipaddress: 192.168.2.145
  gate_way: 192.168.2.1
  sub_net: 255.255.255.0
  dns_1: 192.168.2.1
  dns_2: 1.1.1.1
  friendly_name: Plot35-lightning
  friendly_name_lower: lightining
  projectname: "plot35.pressurepump"
  device_name: "plot35lightning"
  device_description: "lightning sensor CJMCU AMS AS3935 (https://www.homeassistant-cz.cz/viewtopic.php?f=56&t=379&p=3711#p3711), Deep Sleep and internal meteoalarm integrate"
  created_by: "Freddie Mare 2023"
  devicename: light_1
  wifichannel: "7"

esphome:
  name: ${device_name}
  #id: plot35_lightining
  project:
    name: "${projectname}" 
    version: "1.2.3"

  on_boot:
    priority: -100.0
    then:
      #- component.update: batlevel
      - switch.turn_on: ${friendly_name_lower}_board_LED_switch
      #- output.turn_on: ${friendly_name_lower}_board_LED
      #- component.update: ${friendly_name_lower}_wifi_signal_db

rp2040:
  board: rpipicow
  framework:
    # Required until https://github.com/platformio/platform-raspberrypi/pull/36 is merged
    platform_version: https://github.com/maxgerhardt/platform-raspberrypi.git

# Enable logging
logger:

# Enable Home Assistant API
api:
  #encryption:
  #  key: !secret api_lightining_key

ota:
  password: !secret ota_lightining_password

wifi:
  reboot_timeout: 0s
  output_power: 20db
  power_save_mode: none
  fast_connect: True

# Single WiFi only 
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  #bssid: 56:AF:97:A3:47:EE # Plot35
  #bssid: F4:E5:F2:AC:52:9F # Private

  manual_ip:
  # Set this to the IP of the pi pico w
    static_ip: ${ipaddress}
    # Set this to the IP address of the router. Often ends with .1
    gateway: ${gate_way}
    #The subnet of the network. 255.255.255.0 works for most home networks.
    subnet: ${sub_net}
    dns1: ${dns_1}
    dns2: ${dns_2}

i2c:
  sda: 4
  scl: 5
  scan: True
  id: bme_680

globals:
  - id: connection_fail_count
    type: int
    restore_value: no
    initial_value: 'false'

interval:
  - interval: 500ms
    then:
      - if:
          condition:
              - binary_sensor.is_on: ${friendly_name_lower}_connected
          then:
            - globals.set:
                id: connection_fail_count
                value: '0'
            - lambda: |-
                static bool newstate = false;
                  if (newstate) {
                    id(${friendly_name_lower}_board_LED).turn_on();
                  } else {
                    id(${friendly_name_lower}_board_LED).turn_off();
                  }
                  newstate = !newstate;

  - interval: 500ms
    then:
      - if:
          condition:
              - binary_sensor.is_on: ${friendly_name_lower}_connected
          then:
            - lambda: |-
                static bool newstate = false;
                id(connection_fail_count) = 0;
                  if (newstate) {
                    id(${friendly_name_lower}_board_LED).turn_on();
                  } else {
                    id(${friendly_name_lower}_board_LED).turn_off();
                  }
                  newstate = !newstate;

  - interval: 5s 
    then:
      - if:
          condition:
              - binary_sensor.is_off: ${friendly_name_lower}_connected
          then:
            - lambda: |-
                static bool newstate = false;
                id(connection_fail_count)++;
                  if (newstate) {
                    id(${friendly_name_lower}_board_LED).turn_on();
                  } else {
                    id(${friendly_name_lower}_board_LED).turn_off();
                  }

                  // 5 minutes = 60 seconds, checking every 5 seconds, so 60 / 5 = 12
                  if (id(connection_fail_count) >= 12 ) {
                    id(five_second_50ms_loop).execute();
                    //delay(5000); // Wait 50ms
                    id(restart_controler).execute();  // Restart the ESP controller if no WiFi or API connection and generator is stopped
                  }
                  newstate = !newstate;
          else:

# Stop generator and restart ESP controller
script:
  - id: restart_controler
    then:
      - globals.set:
          id: connection_fail_count
          value: '0'
      - switch.turn_on: ${friendly_name_lower}_restart

  - id: five_second_500ms_loop # at 500ms per puls
    then:
      - lambda: |-
          for (int i = 0; i < 50; ++i) { // Each loop takes about 100ms, so we need 50 loops to get 5 seconds
            id(${friendly_name_lower}_board_LED).turn_on(); // Turn on some output
            delay(500); // Wait 500ms
            id(${friendly_name_lower}_board_LED).turn_off(); // Turn off some output
            delay(500); // Wait 500ms
          }

  - id: five_second_50ms_loop # at 50ms per puls
    then:
      - lambda: |-
          for (int i = 0; i < 50; ++i) { // Each loop takes about 100ms, so we need 50 loops to get 5 seconds
            id(${friendly_name_lower}_board_LED).turn_on(); // Turn on some output
            delay(50); // Wait 50ms
            id(${friendly_name_lower}_board_LED).turn_off(); // Turn off some output
            delay(50); // Wait 50ms
          }

# Example lightning and energy sensor
sensor:
  - platform: uptime
    name: ${friendly_name} Uptime
    id: ${friendly_name_lower}_upt

  - platform: wifi_signal # Reports the WiFi signal strength/RSSI in dB
    id: ${friendly_name_lower}_wifi_signal_db
    name: "${friendly_name} WiFi Signal dB"
    update_interval: 6s
    unit_of_measurement: "dB"
    entity_category: "diagnostic"
    device_class: "volume"
    state_class: "measurement"

  - platform: copy
    name: "${friendly_name} WiFi Signal Percent"
    source_id: ${friendly_name_lower}_wifi_signal_db
    id: ${friendly_name_lower}_wifi_signal
    unit_of_measurement: "%"
    entity_category: diagnostic
    filters:
      - lambda: return min(max(2 * (x + 100.0), 0.0), 100.0);

  - platform: adc
    id: ${friendly_name_lower}_CPU_Temp
    pin: TEMPERATURE
    name: "${friendly_name} CPU Core Temperature"
    update_interval: 30s
    unit_of_measurement: "°C"
    entity_category: "diagnostic"
    device_class: "TEMPERATURE"
    state_class: "measurement"
    filters:
      - lambda: return 27 - (x - 0.706f) / 0.001721f;

#counter
  - platform: template
    name: "${friendly_name} Lightning Counter"
    id: light_counter_temp
    lambda: |-
      return (id(light_counter).state);
    unit_of_measurement: "pcs"
    accuracy_decimals: 0
    icon: mdi:lightning-bolt-circle
#    internal: true

  - platform: bme680
    temperature:
      name: "BME680 Temperature"
      oversampling: 16x
    pressure:
      name: "BME680 Pressure"
    humidity:
      name: "BME680 Humidity"
      id: hum
    gas_resistance:
      name: "BME680 Gas Resistance"
      id: g_res
    address: 0x77
    update_interval: 60s
# comp_gas = log(R_gas[ohm]) + 0.04 log(Ohm)/%rh * hum[%rh]    
  - platform: template
    name: "BME680 IAQ"
    id: IAQ
    unit_of_measurement: IAQ
    lambda: 'return log(id(g_res).state) + 0.04 *  id(hum).state;' 

output:
  # Built-in LED
  - platform: gpio
    pin:
      number: 32  # 25 for Pico (non-W)
      mode: output
    id: ${friendly_name_lower}_board_LED

text_sensor:
    # WiFi Status
  - platform: wifi_info
    ip_address:
      name: "${friendly_name} IP Address"
    ssid:
      name: "${friendly_name} Connected SSID"
    bssid:
      name: "${friendly_name} Connected BSSID"
    mac_address:
      name: "${friendly_name} Mac Wifi Address"
    scan_results:
      name: "${friendly_name} Latest Scan Results"

number:
  - platform: template
    name: "${friendly_name} Lightning Counter number"
    optimistic: true
    min_value: 0
    max_value: 1000
    step: 1
    id: light_counter
    internal: true

binary_sensor:
  - platform: status
    name: "${friendly_name} Connection Status"
    id: ${friendly_name_lower}_connection_status
    on_state:
      then:
        - lambda: |-
            if (id(${friendly_name_lower}_connection_status).state){
                id(${friendly_name_lower}_connected).publish_state(true);
              }else{
                id(${friendly_name_lower}_connected).publish_state(false);
            }

  - platform: template
    id: ${friendly_name_lower}_connected
    icon:  "mdi:engine"
    name: "${friendly_name} Connected"

switch:
##RESTART ESP

  - platform: factory_reset
    name: ${friendly_name} Restart with Factory Default Settings

  - platform: restart
    id: ${friendly_name_lower}_restart
    name: "${friendly_name} Restart"

  - platform: safe_mode
    name: "${friendly_name} Restart (Safe Mode)"

  - platform: shutdown
    name: "${friendly_name} Shutdown"

  - platform: output
    id: ${friendly_name_lower}_board_LED_switch
    output: ${friendly_name_lower}_board_LED
    name: "${friendly_name} Board LED"

Anything in the logs that might be useful for us?

Linking .pioenvs/plot35lightning/firmware.elf
/data/cache/platformio/packages/toolchain-rp2040-earlephilhower/bin/../lib/gcc/arm-none-eabi/10.3.0/../../../../arm-none-eabi/bin/ld: unrecognized option '--no-warn-rwx-segments'
/data/cache/platformio/packages/toolchain-rp2040-earlephilhower/bin/../lib/gcc/arm-none-eabi/10.3.0/../../../../arm-none-eabi/bin/ld: use the --help option for usage information
collect2: error: ld returned 1 exit status
*** [.pioenvs/plot35lightning/firmware.elf] Error 1
========================= [FAILED] Took 15.53 seconds =========================

Additional information

No response

joostlek commented 8 months ago

Hey 👋,

Looks like you got a bit lost. Please open this issue over at the esphome repository :).