Unexpected path traverse error when autocompleting in lambda
rk-exxec opened this issue · 1 comments
rk-exxec commented
While editing lambdas my vscode extension always opens the output panel and spams these messages. Am I doing something wrong or is this a bug?
The error also contains the entire lambda.
Validating file:///s%3A/git_repos/esphome/co2sensor_lcd_mini.yaml
send {"type":"validate","file":"s:\\git_repos\\esphome\\co2sensor_lcd_mini.yaml"}
rcvd {"type":"read_file","path":"s:\\git_repos\\esphome\\co2sensor_lcd_mini.yaml"}
send {"type":"file_response","content":"esphome:\n name: co2sensor\n\nesp32:\n board: esp32-c3-devkitm-1\n variant: esp32c3\n framework:\n type: ard
rcvd {"type":"read_file","path":"s:\\git_repos\\esphome\\secrets.yaml"}
send {"type":"file_response","content":"wifi_ssid: \"codo_der_iii\"\nwifi_password: \"pass4HASS.io_ap_isverysecure\"\n\nfritz_ssid: \"FRITZ!Box 7530 LR\"\n
rcvd {"type":"read_file","path":"s:\\git_repos\\esphome\\secrets.yaml"}
send {"type":"file_response","content":"wifi_ssid: \"codo_der_iii\"\nwifi_password: \"pass4HASS.io_ap_isverysecure\"\n\nfritz_ssid: \"FRITZ!Box 7530 LR\"\n
it.rectangle(0, 0, it.get_width(), it.get_height());
it.rectangle(32, 0, it.get_width()-32, 32);
it.rectangle(32, 32, it.get_width()-32, 32);
it.rectangle(32, 64, it.get_width()-32, 32);
it.rectangle(32, 96, it.get_width()-32, 32);
it.filled_rectangle(0,0, 32,32);
it.filled_rectangle(0,32,32,32);
it.filled_rectangle(0,64,32,32);
it.filled_rectangle(0,96,32,32);
it.print(1, 1, id(icon_font_30), COLOR_OFF, "\U000f0954"); // clock
it.print(1, 33, id(icon_font_30), COLOR_OFF, "\U000f07e4"); // co2
it.print(1, 65, id(icon_font_30), COLOR_OFF, "\U000f050f"); // temp
it.print(1, 97, id(icon_font_30), COLOR_OFF, "\U000f058e"); // water
it.strftime(38, 1, id(text_l), "%H:%M", id(my_time).now());
if(isnan(id(co2sens).state)){
it.printf( 38, 33, id(text_l), "---");
it.printf( 38, 65, id(text_l), "---");
it.printf( 38, 97, id(text_l), "---");
} else {
it.printf( 38, 33, id(text_l), "%4.0f", id(co2sens).state);
it.printf( 38, 65, id(text_l), "%4.1f", id(tempsens).state);
it.printf( 38, 97, id(text_l), "%4.1f", id(humsens).state);
}
it.print(96, 36, id(text_16), "ppm"); // ppm
it.print(96, 65, id(icon_font_30), "\U000f0504"); // degree celsius
it.print(96, 97, id(icon_font_30), "\U000f1278"); // percent
float co2_val = id(co2sens).state ; // get sensor value
if(isnan(co2_val)) co2_val = 400.0; // catch Nan
co2_val = co2_val < 400 ? 400 : co2_val; // clamp value
float co2_percent = ((co2_val - 400.0)/1600.0);
int width = (int) round(it.get_width() * co2_percent);
Color col;
if(co2_val < 800.0) col = COLOR_GREEN;
else if(co2_val < 1000.0) col = COLOR_GREYE;
else if(co2_val < 1400.0) col = COLOR_YELLOW;
else if(co2_val < 1600.0) col = Color_ORANGE
else col = COLOR_RED;
// int red = (int)round(255*co2_percent);
// int green = (int)round(255*(1-co2_percent));
// auto col = Color(red, green, 0);
// auto col = Color(255,255,0);
it.filled_rectangle(0, 128, width, 32, col);
// it.printf( 2, 129, id(text_l), "%d %4.2f", width, co2_percent);
component: lambda
[Error - 12:28:53 PM] Request textDocument/completion failed.
Message: Request textDocument/completion failed with message: Unexpected path traverse.
Code: -32603
rcvd {"type":"check_file_exists","path":"s:\\git_repos\\esphome\\fonts/materialdesignicons-webfont.ttf"}
send {"type":"file_exists_response","content":true}
rcvd {"type":"result","yaml_errors":[],"validation_errors":[]}
YAML file:
esphome:
name: co2sensor
esp32:
board: esp32-c3-devkitm-1
variant: esp32c3
framework:
type: arduino
version: latest
# Enable logging
logger:
# hardware_uart: uart0
# Enable Home Assistant API
api:
encryption:
key: <redacted>
ota:
password: <redacted>
wifi:
ssid: !secret fritz_ssid
password: !secret fritz_passw
# use_address: 192.168.99.5
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Co2Sensor Fallback Hotspot"
password: "24VuQlBcG0JP"
captive_portal:
# uart:
# tx_pin: GPIO21
# rx_pin: GPIO20
# baud_rate: 115200
i2c:
sda: GPIO6
scl: GPIO7
frequency: 800kHz
font:
- file: "gfonts://Roboto"
id: text_l
size: 24
- file: "gfonts://Roboto"
id: text_16
size: 16
- file: 'fonts/materialdesignicons-webfont.ttf'
id: icon_font_30
size: 30
glyphs: [
"\U000f050f", # mdi-thermometer
"\U000f058e", # mdi-water-percent
"\U000f07e4", # mdi-molecule-co2
"\U000f0504", # mdi-temperature-celsius
"\U000f0954", # mdi-clock
"\U000f1278", # mdi-percent-outline
]
color:
- id: COLOR_BLACK_CUST
white: 0%
- id: COLOR_GREEN
green: 80%
red: 30%
blue: 20%
- id: COLOR_GREYE
green: 80%
red: 60%
blue: 20%
- id: COLOR_YELLOW
red: 100%
green: 100%
- id: COLOR_ORANGE
red: 100%
green: 65%
- id: COLOR_RED
red: 100%
- id: COLOR_PURP
red: 100%
blue: 25%
sensor:
- platform: scd4x
update_interval: 30s
co2:
name: "Wohnzimmer CO2"
id: co2sens
temperature:
name: "Wohnzimmer Temperature"
id: tempsens
humidity:
name: "Wohnzimmer Humidity"
id: humsens
altitude_compensation: "337m"
time:
- platform: sntp
id: my_time
on_time:
- seconds: 0
minutes: "*"
then:
- component.update: screen
# - uart.write: 'Hello World'
spi:
clk_pin: GPIO8
miso_pin: GPIO9
mosi_pin: GPIO10
display:
- platform: st7735
model: "INITR_GREENTAB"
cs_pin: GPIO3
dc_pin: GPIO2
reset_pin: GPIO4
rotation: 0
device_width: 128
device_height: 160
col_start: 0
row_start: 0
eight_bit_color: true
update_interval: 5s
invert_colors: false
use_bgr: true
id: screen
lambda: |-
it.rectangle(0, 0, it.get_width(), it.get_height());
it.rectangle(32, 0, it.get_width()-32, 32);
it.rectangle(32, 32, it.get_width()-32, 32);
it.rectangle(32, 64, it.get_width()-32, 32);
it.rectangle(32, 96, it.get_width()-32, 32);
it.filled_rectangle(0,0, 32,32);
it.filled_rectangle(0,32,32,32);
it.filled_rectangle(0,64,32,32);
it.filled_rectangle(0,96,32,32);
it.print(1, 1, id(icon_font_30), COLOR_OFF, "\U000f0954"); // clock
it.print(1, 33, id(icon_font_30), COLOR_OFF, "\U000f07e4"); // co2
it.print(1, 65, id(icon_font_30), COLOR_OFF, "\U000f050f"); // temp
it.print(1, 97, id(icon_font_30), COLOR_OFF, "\U000f058e"); // water
it.strftime(38, 1, id(text_l), "%H:%M", id(my_time).now());
if(isnan(id(co2sens).state)){
it.printf( 38, 33, id(text_l), "---");
it.printf( 38, 65, id(text_l), "---");
it.printf( 38, 97, id(text_l), "---");
} else {
it.printf( 38, 33, id(text_l), "%4.0f", id(co2sens).state);
it.printf( 38, 65, id(text_l), "%4.1f", id(tempsens).state);
it.printf( 38, 97, id(text_l), "%4.1f", id(humsens).state);
}
it.print(96, 36, id(text_16), "ppm"); // ppm
it.print(96, 65, id(icon_font_30), "\U000f0504"); // degree celsius
it.print(96, 97, id(icon_font_30), "\U000f1278"); // percent
float co2_val = id(co2sens).state ; // get sensor value
if(isnan(co2_val)) co2_val = 400.0; // catch Nan
co2_val = co2_val < 400 ? 400 : co2_val; // clamp value
float co2_percent = ((co2_val - 400.0)/1600.0);
int width = (int) round(it.get_width() * co2_percent);
Color col;
if(co2_val < 800.0) col = COLOR_GREEN;
else if(co2_val < 1000.0) col = COLOR_GREYE;
else if(co2_val < 1400.0) col = COLOR_YELLOW;
else if(co2_val < 1600.0) col = COLOR_ORANGE;
else col = COLOR_RED;
// int red = (int)round(255*co2_percent);
// int green = (int)round(255*(1-co2_percent));
// auto col = Color(red, green, 0);
// auto col = Color(255,255,0);
it.filled_rectangle(0, 128, width, 32, col);
// it.printf( 2, 129, id(text_l), "%d %4.2f", width, co2_percent);
glmnet commented
Thanks for sharing, while the "unexpected path traverse" might be a valid error when validating an invalid file, the console spamming it's really annoying, I'll check both issues sometime, this really helps tracking those.