esphome / issues

Issue Tracker for ESPHome
https://esphome.io/
290 stars 36 forks source link

2023.7.0 broke my YAML..... #4720

Closed andypnz closed 1 year ago

andypnz commented 1 year ago

The problem

YAML broken by 2023.7.0 - was working with 2023.6.x

Which version of ESPHome has the issue?

2023.7.0

What type of installation are you using?

Home Assistant Add-on

Which version of Home Assistant has the issue?

2023.7.2

What platform are you using?

ESP32

Board

esp-wrover-kit

Component causing the issue

No response

Example YAML snippet

esphome:
  name: esp32-solar-mon

esp32:
  board: esp-wrover-kit
  framework:
    type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "------------------"

ota:
  password: "--------------------------------------"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  manual_ip:
    # Set this to the IP of the ESP
    static_ip: -------------
    # Set this to the IP address of the router. Often ends with .1
    gateway: ----------------
    # The subnet of the network. 255.255.255.0 works for most home networks.
    subnet: 255.255.255.0

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Esp32-Solar-Mon Fallback Hotspot"
    password: "--------------"

captive_portal:

substitutions:

# Weather entity from home assistant
  weather_entity: weather.home
# Weather now icon size
  icon_xy: '20x20'

bluetooth_proxy:
  active: true

font:
  - file: "fonts/design.graffiti.comicsansmsgras.ttf"
    id: my_font
    size: 12

  - file: "fonts/design.graffiti.comicsansmsgras.ttf"
    id: my_font_s
    size: 10

#font date
  - file: 'fonts/Arial-Black.ttf'
    id: font1
    size: 10    #18
#Time
  - file: 'fonts/BebasNeue-Regular.ttf'
    id: font_clock
    size: 10    #40
#Temperature
  - file: 'fonts/BebasNeue-Regular.ttf'
    id: font2
    size: 10    #45
#Location sensors
  - file: 'fonts/arial.ttf'
    id: font8
    size: 10    #18
# Day name in forecast
  - file: 'fonts/Arial-Black.ttf'
    id: font_small
    size: 10    #12
#Forecast fonts
  - file: 'fonts/arial.ttf'
    id: font_small_1
    size: 10       #12
#Font icon various sensor
  - file: 'fonts/materialdesignicons-webfont.ttf'
    id: sensor_font
    size: 12    #18
    glyphs:
      - "\U000F059D" # Wind
      - "\U000F050F" # Temperature
      - "\U000F04C5" # Pression
      - "\U000F058E" # Humidity
      - "\U000F0238" # Fire
      - "\U000F0F55" # Home thermometer
#Big icons other home stuff
  - file: 'fonts/materialdesignicons-webfont.ttf'
    id: home_font
    size: 12       #52
    glyphs:
      - "\U000F02DC" # At home
      - "\U000F0F9B" # Outside home
      - "\U000F0238" # Fire
      - "\U000F072A" # Washing machine on
      - "\U000F11BD" # Washing machine off
      - "\U000F0100" # Camera on
      - "\U000F05DF" # Camera off
      - "\U000F0241" # Flash
      - "\U000F0EF7" # Flash alert
      - "\U000F06D0" # Eye
      - "\U000F0425" # OFF
      - "\U000F0415" # Plus
      - "\U000F0374" # Minus
#Forecast icons
  - file: 'fonts/materialdesignicons-webfont.ttf'
    id: weather_font
    size: 20              #50
    glyphs:
      - "\U000F0590" # weather-cloudy
      - "\U000F0F2F" # weather-cloudy-alert
      - "\U000F0E6E" # weather-cloudy-arrow-right
      - "\U000F0591" # weather-fog
      - "\U000F0592" # weather-hail
      - "\U000F0F30" # weather-hazy
      - "\U000F0898" # weather-hurricane
      - "\U000F0593" # weather-lightning
      - "\U000F067E" # weather-lightning-rainy
      - "\U000F0594" # weather-night
      - "\U000F0F31" # weather-night-partly-cloudy
      - "\U000F0595" # weather-partly-cloudy
      - "\U000F0F32" # weather-partly-lightning
      - "\U000F0F33" # weather-partly-rainy
      - "\U000F0F34" # weather-partly-snowy
      - "\U000F0F35" # weather-partly-snowy-rainy
      - "\U000F0596" # weather-pouring
      - "\U000F0597" # weather-rainy
      - "\U000F0598" # weather-snowy
      - "\U000F0F36" # weather-snowy-heavy
      - "\U000F067F" # weather-snowy-rainy
      - "\U000F0599" # weather-sunny
      - "\U000F0F37" # weather-sunny-alert
      - "\U000F14E4" # weather-sunny-off
      - "\U000F059A" # weather-sunset
      - "\U000F059B" # weather-sunset-down
      - "\U000F059C" # weather-sunset-up
      - "\U000F0F38" # weather-tornado
      - "\U000F059D" # weather-windy
      - "\U000F059E" # weather-windy-variant

time:
  - platform: homeassistant
    id: esptime
    timezone: Pacific/Auckland

# Example configuration entry
i2c:
  sda: GPIO21
  scl: GPIO22
  #frequency: 800kHz             ###############################

# Example configuration entry
esp32_ble_tracker:

binary_sensor:
  - platform: ble_presence
    mac_address: 34:08:BC:13:18:BA
    name: "ESP32 BLE Presence ARP iPhone"
  - platform: ble_presence
    mac_address: 94:EA:32:12:CF:F7
    name: "ESP32 BLE Presence SCP iPhone"

sensor:
  - platform: ble_rssi
    mac_address: 34:08:BC:13:18:BA
    name: "EPS32 BLE RSSI ARP iPhone"
  - platform: ble_rssi
    mac_address: 94:EA:32:12:CF:F7
    name: "EPS32 BLE RSSI SCP iPhone"    

  - platform: homeassistant
    entity_id: sensor.sa_my_clamp_5_power
    id: my_power_house

  - platform: homeassistant
    entity_id: sensor.sa_my_clamp_4_power
    id: my_power_cottage

  - platform: homeassistant
    entity_id: sensor.sa_my_clamp_3_power
    id: my_power_shed    

#Import external temperature
  - platform: homeassistant
    id: weather_temperature
    entity_id: ${weather_entity}
    attribute: temperature
    internal: true
#Import Wind
  - platform: homeassistant
    id: vento               #weather_windspeed
    entity_id: ${weather_entity}
    attribute: wind_speed
    internal: true
#Import external Humidity
  - platform: homeassistant
    id: umidita_ext              #weather_humidity
    entity_id: ${weather_entity}
    attribute: humidity
    internal: true

# Example configuration entry
  - platform: wifi_signal
    name: "ESP32 House Solar Mon WiFi Signal Sensor"
    update_interval: 60s    

json:

text_sensor:
#Import Location
  - platform: homeassistant
    id: weather_location
    entity_id: ${weather_entity}
    attribute: friendly_name
    internal: true

#Weather condition now
  - platform: homeassistant
    id: weather_condition
    entity_id: ${weather_entity}
    internal: true
#5 Day forecast
  - platform: homeassistant
    id: forecast_5
    entity_id: ${weather_entity}
    #entity_id: weather.casa
    #entity_id: weather.home
    attribute: forecast
    internal: true

#Weather now images
image:
#0-default.png
  - file: "images/0-default.png"
    id: wpng_0
    type: GRAYSCALE
    use_transparency: true
    dither: FLOYDSTEINBERG
    resize: ${icon_xy}
#1-clear-night.png
  - file: "images/1-clear-night.png"
    id: wpng_1
    type: GRAYSCALE
    use_transparency: true
    dither: FLOYDSTEINBERG
    resize: ${icon_xy}
#2-cloudy.png
  - file: "images/2-cloudy.png"
    id: wpng_2
    type: GRAYSCALE
    use_transparency: true
    dither: FLOYDSTEINBERG
    resize: ${icon_xy}
#3-fog.png
  - file: "images/3-fog.png"
    id: wpng_3
    type: GRAYSCALE
    use_transparency: true
    dither: FLOYDSTEINBERG
    resize: ${icon_xy}
#4-hail.png
  - file: "images/4-hail.png"
    id: wpng_4
    type: GRAYSCALE
    use_transparency: true
    dither: FLOYDSTEINBERG
    resize: ${icon_xy}
#5-lightning.png
  - file: "images/5-lightning.png"
    id: wpng_5
    type: GRAYSCALE
    use_transparency: true
    dither: FLOYDSTEINBERG
    resize: ${icon_xy}
#6-lightning-rainy.png
  - file: "images/6-lightning-rainy.png"
    id: wpng_6
    type: GRAYSCALE
    use_transparency: true
    dither: FLOYDSTEINBERG
    resize: ${icon_xy}
#7-partlycloudy.png
  - file: "images/7-partlycloudy.png"
    id: wpng_7
    type: GRAYSCALE
    use_transparency: true
    dither: FLOYDSTEINBERG
    resize: ${icon_xy}
#8-pouring.png // rgb565
  - file: "images/8-pouring.png"
    id: wpng_8
    type: GRAYSCALE
    use_transparency: true
    dither: FLOYDSTEINBERG
    resize: ${icon_xy}
#9-rainy.png
  - file: "images/9-rainy.png"
    id: wpng_9
    type: GRAYSCALE
    use_transparency: true
    dither: FLOYDSTEINBERG
    resize: ${icon_xy}
#10-snowy.png
  - file: "images/10-snowy.png"
    id: wpng_10
    type: GRAYSCALE
    use_transparency: true
    dither: FLOYDSTEINBERG
    resize: ${icon_xy}
#11-snowy-rainy.png
  - file: "images/11-snowy-rainy.png"
    id: wpng_11
    type: GRAYSCALE
    use_transparency: true
    dither: FLOYDSTEINBERG
    resize: ${icon_xy}
#12-sunny.png
  - file: "images/12-sunny.png"
    id: wpng_12
    type: GRAYSCALE
    use_transparency: true
    dither: FLOYDSTEINBERG
    resize: ${icon_xy}
#13-windy.png
  - file: "images/13-windy.png"
    id: wpng_13
    type: GRAYSCALE
    use_transparency: true
    dither: FLOYDSTEINBERG
    resize: ${icon_xy}
#14-windy-variant.png
  - file: "images/14-windy-variant.png"
    id: wpng_14
    type: GRAYSCALE
    use_transparency: true
    dither: FLOYDSTEINBERG
    resize: ${icon_xy}
#15-exceptional.png
  - file: "images/15-exceptional.png"
    id: wpng_15
    type: GRAYSCALE
    use_transparency: true
    dither: FLOYDSTEINBERG
    resize: ${icon_xy}    

animation:
  - file: "cat2aaa.gif"
    id: my_animation
    #type: GRAYSCALE
    #use_transparency: true
    #resize: 128x64
    resize: 192x96

display:
  - platform: ssd1306_i2c
    model: "SSD1306 128x64"
    #reset_pin: D0
    address: 0x3C
    update_interval: 4s

    id: my_display

    pages:

      - id: page1
        lambda: |-

          if (id(my_power_house).has_state()) {      
            if (id(my_power_house).state > 0)
            {
              it.print(0, 0, id(my_font_s), "House Grid IMPORT");
              it.printf(20, 40, id(my_font), TextAlign::BASELINE_LEFT, "%.0f Watts", id(my_power_house).state);
              it.strftime(0, 25, id(my_font_s), TextAlign::BASELINE_LEFT, "%A %H:%M", id(esptime).now());
            }
            else
            {
              it.print(0, 0, id(my_font_s), "House Grid EXPORT");
              it.printf(20, 40, id(my_font), TextAlign::BASELINE_LEFT, "%.0f Watts", id(my_power_house).state);
              it.strftime(0, 25, id(my_font_s), TextAlign::BASELINE_LEFT, "%A %H:%M", id(esptime).now());
            }    
          }       
          else
          {
            it.print(0, 20, id(my_font_s), "Waiting on solar data......");
          }

      - id: page2
        lambda: |-

          if (id(my_power_cottage).has_state()) {      
            if (id(my_power_cottage).state > 0)
            {
              it.print(0, 0, id(my_font_s), "C IMPORT");
              it.printf(0, 40, id(my_font), TextAlign::BASELINE_LEFT, "%.0f W", id(my_power_cottage).state);
              it.strftime(0, 25, id(my_font_s), TextAlign::BASELINE_LEFT, "%A %H:%M", id(esptime).now());
            }
            else
            {
              it.print(0, 0, id(my_font_s), "C EXPORT");
              it.printf(0, 40, id(my_font), TextAlign::BASELINE_LEFT, "%.0f W", id(my_power_cottage).state);
              it.strftime(0, 25, id(my_font_s), TextAlign::BASELINE_LEFT, "%A %H:%M", id(esptime).now());
            }    
          }       
          else
          {
            it.print(0, 20, id(my_font_s), "Waiting on solar data......");
          }          
          if (id(my_power_shed).has_state()) {      
            if (id(my_power_shed).state > 0)
            {
              it.print(60, 0, id(my_font_s), "S IMPORT");
              it.printf(65, 40, id(my_font), TextAlign::BASELINE_LEFT, "%.0f W", id(my_power_shed).state);
              //it.strftime(65, 25, id(my_font_s), TextAlign::BASELINE_LEFT, "%A %H:%M", id(esptime).now());
            }
            else
            {
              it.print(60, 0, id(my_font_s), "S EXPORT");
              it.printf(65, 40, id(my_font), TextAlign::BASELINE_LEFT, "%.0f W", id(my_power_shed).state);
              //it.strftime(65, 25, id(my_font_s), TextAlign::BASELINE_LEFT, "%A %H:%M", id(esptime).now());
            }    
          }       
          else
          {

          }                    

      - id: page3
        lambda: |-
          id(my_animation).next_frame();
          it.image(30, -33, id(my_animation), COLOR_ON, COLOR_OFF);

      - id: page4               
        lambda: |-

         //Map icons//
         std::map<std::string, Image *> imgDict;
         imgDict["clear-night"] = id(wpng_1);
         imgDict["cloudy"] = id(wpng_2);
         imgDict["fog"] = id(wpng_3);
         imgDict["hail"] = id(wpng_4);
         imgDict["lightning"] = id(wpng_5);
         imgDict["lightning-rainy"] = id(wpng_6);
         imgDict["partlycloudy"] = id(wpng_7);
         imgDict["pouring"] = id(wpng_8);
         imgDict["rainy"] = id(wpng_9);
         imgDict["snowy"] = id(wpng_10);
         imgDict["snowy-rainy"] = id(wpng_11);
         imgDict["sunny"] = id(wpng_12);
         imgDict["windy"] = id(wpng_13);
         imgDict["windy-variant"] = id(wpng_14);
         imgDict["exceptional"] = id(wpng_15);
         imgDict[""] = id(wpng_0);

         //Map condition//
         std::map<std::string, const char *> conDict;
         conDict["clear-night"] = "Clear night";
         conDict["cloudy"] = "Cloudy";
         conDict["fog"] = "Fog";
         conDict["hail"] = "Hail";
         conDict["lightning"] = "Lightening";
         conDict["lightning-rainy"] = "Lightening-Rainy";
         conDict["partlycloudy"] = "Partly cloudy";
         conDict["pouring"] = "Pouring";
         conDict["rainy"] = "Rainy";
         conDict["snowy"] = "Snowy";
         conDict["snowy-rainy"] = "Snowy-Rain";
         conDict["sunny"] = "Sunny";
         conDict["windy"] = "Windy";
         conDict["windy-variant"] = "Windy variant";
         conDict["exceptional"] = "Exceptional";
         conDict[""] = "Sconosciuto";

         //Map weather fonts//
         std::map<std::string, const char *> fonDict;
         fonDict["clear-night"] = "\U000F0594";
         fonDict["cloudy"] = "\U000F0590";
         fonDict["fog"] = "\U000F0591";
         fonDict["hail"] = "\U000F0592";
         fonDict["lightning"] = "\U000F0593";
         fonDict["lightning-rainy"] = "\U000F067E";
         fonDict["partlycloudy"] = "\U000F0595";
         fonDict["pouring"] = "\U000F0596";
         fonDict["rainy"] = "\U000F0597";
         fonDict["snowy"] = "\U000F0598";
         fonDict["snowy-rainy"] = "\U000F067F";
         fonDict["sunny"] = "\U000F0599";
         fonDict["windy"] = "\U000F059D";
         fonDict["windy-variant"] = "\U000F059E";
         fonDict["exceptional"] = "";

         //Map days of week//
         std::map<int, const char *> dayDict;
         dayDict[1] = "Sun";
         dayDict[2] = "Mon";
         dayDict[3] = "Tue";
         dayDict[4] = "Wed";
         dayDict[5] = "Thu";
         dayDict[6] = "Fri";
         dayDict[7] = "Sat";

         //Map days of week extended//
         std::map<int, const char *> dayDict_ext;
         dayDict_ext[1] = "Sunday";
         dayDict_ext[2] = "Monday";
         dayDict_ext[3] = "Tuesday";
         dayDict_ext[4] = "Wednesday";
         dayDict_ext[5] = "Thursday";
         dayDict_ext[6] = "Friday";
         dayDict_ext[7] = "Saturday";

         //Map month//
         std::map<int, const char *> monDict;
         monDict[1] = "Jan";
         monDict[2] = "Feb";
         monDict[3] = "Mar";
         monDict[4] = "Apr";
         monDict[5] = "May";
         monDict[6] = "Jun";
         monDict[7] = "Jul";
         monDict[8] = "Aug";
         monDict[9] = "Sep";
         monDict[10] = "Oct";
         monDict[11] = "Nov";
         monDict[12] = "Dec";

         //Today weekday as number
         int day = id(esptime).now().day_of_week;
         //Month as number
         auto month = id(esptime).now().month;
         //Day of month as number
         auto dom = id(esptime).now().day_of_month;

         //Height 1 day of week, day of month, month       128x64
         int h1 = 0;
         //Height 2 time
         int h2 = 10;
         //Height 3 weather icons, location, home name
         int h3 = 10;
         //Height 4 temperature ext, int, 
         int h4 = 20;
         //Heiht 6 humidity ext, int
         int h6 = 14;
         //Height 7 wind, Pressure int
         int h7 = 24;
         //Height wy forecast
         int wy = 32;
         //Width wx forecast
         int wx = 34;
         //Width 1 Weather location name, outside temp
         int w1 = 40;
         //Width 2 Outside sensor icon
         int w2 = 70;  
         //Width 3 Home name, home temperature
         int w3 = 80;
         //Width 4 Home sensor icon
         int w4 = 100;

         //Time
         //it.printf((it.get_width()/2), h1, id(font1), TextAlign::TOP_CENTER, "%s %i %s", dayDict[day], dom, monDict[month]);
         it.strftime(it.get_width(), h1, id(font_clock), TextAlign::TOP_RIGHT, "%H:%M", id(esptime).now());
         //Weather today
         if (id(weather_condition).has_state())
         {
           //Icon of weather condition now
           it.image(0, h2, imgDict[id(weather_condition).state]);
           //Translated weather condition state as text
           it.printf(0, h1, id(font_small), "%s", conDict[id(weather_condition).state]);
         }
         //Outside temp
         if (id(weather_temperature).has_state())
         {
          //it.printf(w1 , h4, id(font8), "%.0f°", id(weather_temperature).state);
          it.printf(w1 , h4, id(my_font), "%.0f°", id(weather_temperature).state);
         }
         //Location
         if (id(weather_location).has_state())
         {
          //it.printf(w1, h3, id(font8), "%s", id(weather_location).state.c_str());
         }

         //Today wind
         if (id(vento).has_state())
         {
           it.printf(w2, h7, id(sensor_font), "\U000F059D");
           it.printf(w2 +20, h7, id(font8), "%.0f km/h", id(vento).state);
         }
         //External humidity
         if (id(umidita_ext).has_state())
         {
           it.printf(w2, h6, id(sensor_font), "\U000F058E");
           it.printf(w2 +20, h6, id(font8), "%.0f%%", id(umidita_ext).state);
         }

         //Imported forecast json deserialization
         if (id(forecast_5).has_state())
         {
          int wxx = 0;
          int wyy = 0;
          int forday = 1;
          DynamicJsonDocument doc(2048);
          deserializeJson(doc, (id(forecast_5).state.c_str()));
          JsonArray root = doc.as<JsonArray>();
          for (int i=0; i <= 1; ++i)
           {
           JsonObject root_0 = root[i];
           if (i == 0) {wxx = wx;}
           if (i == 0) {wyy = wy;}
           if (i == 0) {forday = (id(esptime).now().day_of_week +1);
           }
           if (forday == 8)
           {
             forday = 1;
           }
           //Day 3-4 go down 
           //if (i == 2) {wyy += 15;}
           //if (i == 2) {wxx = 0;}
           //std::string root_0_condition = root_0["condition"];
           float root_0_precipitation = root_0["precipitation"];
           float root_0_temperature = root_0["temperature"];
           //float root_0_templow = root_0["templow"];
           //std::string root_0_datetime = root_0["datetime"];
           //int root_0_wind_bearing = root_0["wind_bearing"];
           //float root_0_wind_speed = root_0["wind_speed"];

           //Print to screen
           //Translated day
           it.printf(wxx, wyy, id(font_small), TextAlign::TOP_CENTER, "%s", dayDict_ext[forday]);
           //Icon condition
           //it.printf(wxx, wyy +8, id(weather_font), TextAlign::TOP_CENTER, "%s", fonDict[root_0_condition.c_str()]);
           //Temp max
           //it.printf(wxx, wyy+10, id(font_small_1), TextAlign::TOP_CENTER, "max %.0f°", root_0_temperature);
           it.printf(wxx, wyy+10, id(my_font), TextAlign::TOP_CENTER, "max %.0f°", root_0_temperature);
           //Temp min
           //it.printf(wxx, wyy+20, id(font_small_1), TextAlign::TOP_CENTER, "min %.0f°", root_0_templow);
           //Rain in mm
           //it.printf(wxx, wyy+20, id(font_small_1), TextAlign::TOP_CENTER, "%.0f mm", root_0_precipitation);
           it.printf(wxx, wyy+20, id(my_font), TextAlign::TOP_CENTER, "%.0f mm", root_0_precipitation);
           //lines
           //it.line(0, wy, it.get_width(), wy);
           //it.line(0, wy+30, it.get_width(), wy+30);
           wxx += 60;
           forday += 1;
          }          
         }

    # For example cycle through pages on a timer
interval:
  - interval: 5s
    then:
      - display.page.show_next: my_display
      - component.update: my_display 

  - interval: 0.1s
    then:
       lambda: |-
         id(my_animation).next_frame();

Anything in the logs that might be useful for us?

Compiling /data/esp32-solar-mon/.pioenvs/esp32-solar-mon/src/main.cpp.o
Archiving /data/esp32-solar-mon/.pioenvs/esp32-solar-mon/libbc6/libUpdate.a
Compiling /data/esp32-solar-mon/.pioenvs/esp32-solar-mon/lib280/ESPAsyncWebServer-esphome/WebAuthentication.cpp.o
Compiling /data/esp32-solar-mon/.pioenvs/esp32-solar-mon/lib280/ESPAsyncWebServer-esphome/WebHandlers.cpp.o
Compiling /data/esp32-solar-mon/.pioenvs/esp32-solar-mon/lib280/ESPAsyncWebServer-esphome/WebRequest.cpp.o
/config/esphome/esp32-solar-mon.yaml: In lambda function:
/config/esphome/esp32-solar-mon.yaml:468:29: error: 'Image' was not declared in this scope
          std::map<std::string, Image *> imgDict;
                             ^~~~~
/config/esphome/esp32-solar-mon.yaml:468:29: note: suggested alternative:
In file included from src/esphome/components/animation/animation.h:2,
                 from src/esphome.h:3,
                 from src/main.cpp:3:
src/esphome/components/image/image.h:34:7: note:   'esphome::image::Image'
 class Image : public display::BaseImage {
       ^~~~~
/config/esphome/esp32-solar-mon.yaml:468:36: error: template argument 2 is invalid
          std::map<std::string, Image *> imgDict;
                                    ^
/config/esphome/esp32-solar-mon.yaml:468:36: error: template argument 4 is invalid
/config/esphome/esp32-solar-mon.yaml:469:32: error: assignment of read-only location '"clear-night"[imgDict]'
          imgDict["clear-night"] = id(wpng_1);
                                ^~~~~~
/config/esphome/esp32-solar-mon.yaml:470:27: error: assignment of read-only location '"cloudy"[imgDict]'
          imgDict["cloudy"] = id(wpng_2);
                           ^~~~~~
/config/esphome/esp32-solar-mon.yaml:471:24: error: assignment of read-only location '"fog"[imgDict]'
          imgDict["fog"] = id(wpng_3);
                        ^~~~~~
/config/esphome/esp32-solar-mon.yaml:472:25: error: assignment of read-only location '"hail"[imgDict]'
          imgDict["hail"] = id(wpng_4);
                         ^~~~~~
/config/esphome/esp32-solar-mon.yaml:473:30: error: assignment of read-only location '"lightning"[imgDict]'
          imgDict["lightning"] = id(wpng_5);
                              ^~~~~~
/config/esphome/esp32-solar-mon.yaml:474:36: error: assignment of read-only location '"lightning-rainy"[imgDict]'
          imgDict["lightning-rainy"] = id(wpng_6);
                                    ^~~~~~
/config/esphome/esp32-solar-mon.yaml:475:33: error: assignment of read-only location '"partlycloudy"[imgDict]'
          imgDict["partlycloudy"] = id(wpng_7);
                                 ^~~~~~
/config/esphome/esp32-solar-mon.yaml:476:28: error: assignment of read-only location '"pouring"[imgDict]'
          imgDict["pouring"] = id(wpng_8);
                            ^~~~~~
/config/esphome/esp32-solar-mon.yaml:477:26: error: assignment of read-only location '"rainy"[imgDict]'
          imgDict["rainy"] = id(wpng_9);
                          ^~~~~~
/config/esphome/esp32-solar-mon.yaml:478:26: error: assignment of read-only location '"snowy"[imgDict]'
          imgDict["snowy"] = id(wpng_10);
                          ^~~~~~~
/config/esphome/esp32-solar-mon.yaml:479:32: error: assignment of read-only location '"snowy-rainy"[imgDict]'
          imgDict["snowy-rainy"] = id(wpng_11);
                                ^~~~~~~
/config/esphome/esp32-solar-mon.yaml:480:26: error: assignment of read-only location '"sunny"[imgDict]'
          imgDict["sunny"] = id(wpng_12);
                          ^~~~~~~
/config/esphome/esp32-solar-mon.yaml:481:26: error: assignment of read-only location '"windy"[imgDict]'
          imgDict["windy"] = id(wpng_13);
                          ^~~~~~~
/config/esphome/esp32-solar-mon.yaml:482:34: error: assignment of read-only location '"windy-variant"[imgDict]'
          imgDict["windy-variant"] = id(wpng_14);
                                  ^~~~~~~
/config/esphome/esp32-solar-mon.yaml:483:32: error: assignment of read-only location '"exceptional"[imgDict]'
          imgDict["exceptional"] = id(wpng_15);
                                ^~~~~~~
/config/esphome/esp32-solar-mon.yaml:484:21: error: assignment of read-only location '""[imgDict]'
          imgDict[""] = id(wpng_0);
                     ^~~~~~
/config/esphome/esp32-solar-mon.yaml:597:32: error: no match for 'operator[]' (operand types are 'int' and 'std::__cxx11::string' {aka 'std::__cxx11::basic_string<char>'})
            it.image(0, h2, imgDict[id(weather_condition).state]);
                                ^
Compiling /data/esp32-solar-mon/.pioenvs/esp32-solar-mon/lib280/ESPAsyncWebServer-esphome/WebResponses.cpp.o
Compiling /data/esp32-solar-mon/.pioenvs/esp32-solar-mon/lib280/ESPAsyncWebServer-esphome/WebServer.cpp.o
*** [/data/esp32-solar-mon/.pioenvs/esp32-solar-mon/src/main.cpp.o] Error 1
========================= [FAILED] Took 31.27 seconds =========================

Additional information

Was working with 2023.6.x

nielsnl68 commented 1 year ago

We are aware of this issue. From my knowledge it should have been fixed in a PR, but somehow it did not got merged yet.

For now could you add a small image this will add the image class and your YAML script should work again.

andypnz commented 1 year ago

Thanks...

Changing this Image to image (I presume that is what you are referring to?)

//Map icons//
         std::map<std::string, image *> imgDict;

Just results in a slightly changed error list:

Compiling /data/esp32-solar-mon/.pioenvs/esp32-solar-mon/libbd6/libsodium/crypto_aead/chacha20poly1305/sodium/aead_chacha20poly1305.c.o
/config/esphome/esp32-solar-mon.yaml: In lambda function:
/config/esphome/esp32-solar-mon.yaml:468:36: error: template argument 2 is invalid
          std::map<std::string, image *> imgDict;
                                    ^
/config/esphome/esp32-solar-mon.yaml:468:36: error: template argument 4 is invalid
/config/esphome/esp32-solar-mon.yaml:469:32: error: assignment of read-only location '"clear-night"[imgDict]'
          imgDict["clear-night"] = id(wpng_1);
                                ^~~~~~
/config/esphome/esp32-solar-mon.yaml:470:27: error: assignment of read-only location '"cloudy"[imgDict]'
          imgDict["cloudy"] = id(wpng_2);
                           ^~~~~~
/config/esphome/esp32-solar-mon.yaml:471:24: error: assignment of read-only location '"fog"[imgDict]'
          imgDict["fog"] = id(wpng_3);
                        ^~~~~~
/config/esphome/esp32-solar-mon.yaml:472:25: error: assignment of read-only location '"hail"[imgDict]'
          imgDict["hail"] = id(wpng_4);
                         ^~~~~~
/config/esphome/esp32-solar-mon.yaml:473:30: error: assignment of read-only location '"lightning"[imgDict]'
          imgDict["lightning"] = id(wpng_5);
                              ^~~~~~
/config/esphome/esp32-solar-mon.yaml:474:36: error: assignment of read-only location '"lightning-rainy"[imgDict]'
          imgDict["lightning-rainy"] = id(wpng_6);
                                    ^~~~~~
/config/esphome/esp32-solar-mon.yaml:475:33: error: assignment of read-only location '"partlycloudy"[imgDict]'
          imgDict["partlycloudy"] = id(wpng_7);
                                 ^~~~~~
/config/esphome/esp32-solar-mon.yaml:476:28: error: assignment of read-only location '"pouring"[imgDict]'
          imgDict["pouring"] = id(wpng_8);
                            ^~~~~~
/config/esphome/esp32-solar-mon.yaml:477:26: error: assignment of read-only location '"rainy"[imgDict]'
          imgDict["rainy"] = id(wpng_9);
                          ^~~~~~
/config/esphome/esp32-solar-mon.yaml:478:26: error: assignment of read-only location '"snowy"[imgDict]'
          imgDict["snowy"] = id(wpng_10);
                          ^~~~~~~
/config/esphome/esp32-solar-mon.yaml:479:32: error: assignment of read-only location '"snowy-rainy"[imgDict]'
          imgDict["snowy-rainy"] = id(wpng_11);
                                ^~~~~~~
/config/esphome/esp32-solar-mon.yaml:480:26: error: assignment of read-only location '"sunny"[imgDict]'
          imgDict["sunny"] = id(wpng_12);
                          ^~~~~~~
/config/esphome/esp32-solar-mon.yaml:481:26: error: assignment of read-only location '"windy"[imgDict]'
          imgDict["windy"] = id(wpng_13);
                          ^~~~~~~
/config/esphome/esp32-solar-mon.yaml:482:34: error: assignment of read-only location '"windy-variant"[imgDict]'
          imgDict["windy-variant"] = id(wpng_14);
                                  ^~~~~~~
/config/esphome/esp32-solar-mon.yaml:483:32: error: assignment of read-only location '"exceptional"[imgDict]'
          imgDict["exceptional"] = id(wpng_15);
                                ^~~~~~~
/config/esphome/esp32-solar-mon.yaml:484:21: error: assignment of read-only location '""[imgDict]'
          imgDict[""] = id(wpng_0);
                     ^~~~~~
/config/esphome/esp32-solar-mon.yaml:597:32: error: no match for 'operator[]' (operand types are 'int' and 'std::__cxx11::string' {aka 'std::__cxx11::basic_string<char>'})
            it.image(0, h2, imgDict[id(weather_condition).state]);
jesserockz commented 1 year ago

The issue here is that the Image class was moved from the display namespace (which lambdas have direct access to) to the image namespace.

The fix is to simply change to std::map<std::string, image::Image *> imgDict;

andypnz commented 1 year ago

Thanks very much! Solved with that change :-)