Having issues compiling Dr ZZs automated blind code

Hi,

New to HA and wanted to implement the below Dr ZZs project, Probably should have talked something a little less daunting first :stuck_out_tongue: I am getting a compile error in his esphome/servo_device.yaml (see below). Motor raise/lower is working it is just the tilt servo that is not which makes sense since it wont compile. Any help would be appreciated as I am stuckā€¦

Project link:

Error message:

unknown tag !<!lambda> at line 31, column 51:
ā€¦ !lambda ā€˜return level / 100.0;ā€™
^

Full code link:

Impossible to tell without seeing the compile log.

Thanks for the reply. I linked the original code and am using exactly that

The compile log. You already posted your yaml.

not sure how to do that since it will not compile?

It scrolls past when you try to compile.

to be clear I am not a programmer am editing the file in both visual studio code as well as editing directly in home assistant > file editor. no real compiler that I see but both give errors. Latest under visual studio code editor = unknown tag <!lambda> line 30, 587 which is the id: ob_tilt

Read the esphome instructions. You compile using esphome.

I did that under esphome dashboard > under home assistant which is validate I believe and it compiles fine with no errors

INFO Reading configuration /config/esphome/servo_device.yamlā€¦
INFO Configuration is valid!

Well now compile it using esphome.

did that beforeā€¦just did it again and this is the only error I see. Cover is related to lift/descend and not tilt which is what is not working.

Compiling /data/office_blinds/.pioenvs/office_blinds/src/main.cpp.o
src/main.cpp: In lambda function:
src/main.cpp:422:20: warning: ā€˜esphome::cover::Cover::::stateā€™ is deprecated (declared at src/esphome/components/cover/cover.h:120): .state is deprecated, please use .position instead [-Wdeprecated-declarations]
if (ob_open->state == cover::COVER_OPEN) {
^
src/main.cpp:422:20: warning: ā€˜esphome::cover::Cover::::stateā€™ is deprecated (declared at src/esphome/components/cover/cover.h:120): .state is deprecated, please use .position instead [-Wdeprecated-declarations]

For lordā€™s sake post the entire log. To pastebin if it is too long.

This is all there is after the compile up upload

INFO Reading configuration /config/esphome/servo_device.yamlā€¦
INFO Starting log output from office_blinds.local using esphome API
INFO Connecting to office_blinds.local:6053 (172.16.20.6)
INFO Successfully connected to office_blinds.local
[17:06:47][I][app:100]: ESPHome version 1.14.3 compiled on Mar 28 2020, 16:57:04
[17:06:47][C][wifi:415]: WiFi:
[17:06:47][C][wifi:283]: SSID: [redacted]
[17:06:47][C][wifi:284]: IP Address: 172.16.20.6
[17:06:47][C][wifi:286]: BSSID: [redacted]
[17:06:47][C][wifi:287]: Hostname: ā€˜office_blindsā€™
[17:06:47][C][wifi:291]: Signal strength: -68 dB ā–‚ā–„ā–†ā–ˆ
[17:06:47][C][wifi:295]: Channel: 1
[17:06:47][C][wifi:296]: Subnet: 255.255.255.0
[17:06:47][C][wifi:297]: Gateway: 172.16.20.1
[17:06:47][C][wifi:298]: DNS1: 172.16.20.1
[17:06:47][C][wifi:299]: DNS2: (IP unset)
[17:06:47][C][esp8266_pwm:022]: ESP8266 PWM:
[17:06:47][C][esp8266_pwm:023]: Pin: GPIO16 (Mode: OUTPUT)
[17:06:47][C][esp8266_pwm:024]: Frequency: 50.0 Hz
[17:06:47][C][output.switch:009]: Output Switch ā€˜ob1ā€™
[17:06:47][C][output.switch:009]: Output Switch ā€˜ob2ā€™
[17:06:47][C][gpio.binary_sensor:015]: GPIO Binary Sensor ā€˜Office Blinds End Stopā€™
[17:06:47][C][gpio.binary_sensor:016]: Pin: GPIO14 (Mode: INPUT)
[17:06:47][C][gpio.binary_sensor:015]: GPIO Binary Sensor ā€˜OB Buttonā€™
[17:06:47][C][gpio.binary_sensor:016]: Pin: GPIO0 (Mode: INPUT)
[17:06:47][C][template.cover:071]: Template Cover ā€˜Office Blinds Fullā€™
[17:06:47][C][template.cover:071]: Template Cover ā€˜Office Blinds Controlā€™
[17:06:47][C][template.cover:071]: Assumed State: YES
[17:06:47][C][gpio.output:010]: GPIO Binary Output:
[17:06:47][C][gpio.output:011]: Pin: GPIO5 (Mode: OUTPUT)
[17:06:47][C][gpio.output:010]: GPIO Binary Output:
[17:06:47][C][gpio.output:011]: Pin: GPIO4 (Mode: OUTPUT)
[17:06:47][C][logger:175]: Logger:
[17:06:47][C][logger:176]: Level: DEBUG
[17:06:47][C][logger:177]: Log Baud Rate: 115200
[17:06:47][C][logger:178]: Hardware UART: UART0
[17:06:47][C][servo:012]: Servo:
[17:06:47][C][servo:013]: Idle Level: 7.5%
[17:06:47][C][servo:014]: Min Level: 3.0%
[17:06:47][C][servo:015]: Max Level: 12.0%
[17:06:47][C][captive_portal:169]: Captive Portal:
[17:06:47][C][ota:029]: Over-The-Air Updates:
[17:06:47][C][ota:030]: Address: office_blinds.local:8266
[17:06:47][C][api:095]: API Server:
[17:06:47][C][api:096]: Address: office_blinds.local:6053
[17:06:47][D][debug:023]: ESPHome version 1.14.3
[17:06:47][D][debug:025]: Free Heap Size: 32064 bytes
[17:06:47][D][debug:053]: Flash Chip: Size=4096kB Speed=40MHz Mode=DOUT
[17:06:48][D][debug:190]: Chip ID: 0x00D44CB9
[17:06:48][D][debug:191]: SDK Version: 2.2.1(cfd48f3)
[17:06:48][D][debug:192]: Core Version: 2_5_2
[17:06:48][D][debug:193]: Boot Version=31 Mode=1
[17:06:48][D][debug:194]: CPU Frequency: 80
[17:06:48][D][debug:195]: Flash Chip ID=0x001640EF
[17:06:48][D][debug:196]: Reset Reason: Software/System restart
[17:06:48][D][debug:197]: Reset Info: Fatal exception:0 flag:4 (SOFT_RESTART) epc1:0x00000000 epc2:0x00000000 epc3:0x00000000 excvaddr:0x00000000 depc:0x00000000

There is no compilation going on there.

INFO Reading configuration /config/esphome/servo_device.yamlā€¦
INFO Generating C++ sourceā€¦
INFO Compiling appā€¦
INFO Running: platformio run -d /config/esphome/office_blinds
Processing office_blinds (board: d1_mini; framework: arduino; platform: [email protected])

HARDWARE: ESP8266 80MHz, 80KB RAM, 4MB Flash
Dependency Graph
|-- 1.2.2
| |-- 1.0
|-- 1.0
|-- 1.2
| |-- 1.0
|-- 1.2.6
| |-- 1.2.2
| | |-- 1.0
| |-- 1.0
| |-- 1.0
|-- 1.1.1
| |-- 1.0
Compiling /data/office_blinds/.pioenvs/office_blinds/src/main.cpp.o
src/main.cpp: In lambda function:
src/main.cpp:422:20: warning: ā€˜esphome::cover::Cover::::stateā€™ is deprecated (declared at src/esphome/components/cover/cover.h:120): .state is deprecated, please use .position instead [-Wdeprecated-declarations]
if (ob_open->state == cover::COVER_OPEN) {
^
src/main.cpp:422:20: warning: ā€˜esphome::cover::Cover::::stateā€™ is deprecated (declared at src/esphome/components/cover/cover.h:120): .state is deprecated, please use .position instead [-Wdeprecated-declarations]
Linking /data/office_blinds/.pioenvs/office_blinds/firmware.elf
Building /data/office_blinds/.pioenvs/office_blinds/firmware.bin
Retrieving maximum program size /data/office_blinds/.pioenvs/office_blinds/firmware.elf
Checking size /data/office_blinds/.pioenvs/office_blinds/firmware.elf
DATA: [===== ] 45.5% (used 37256 bytes from 81920 bytes)
PROGRAM: [==== ] 40.4% (used 422068 bytes from 1044464 bytes)
Creating BIN file ā€œ/data/office_blinds/.pioenvs/office_blinds/firmware.binā€ using ā€œ/data/office_blinds/.pioenvs/office_blinds/firmware.elfā€
========================= [SUCCESS] Took 4.71 seconds =========================
INFO Successfully compiled program.

Looks good.

yea thats my concern as everything looks ok from esphome but errors in yaml file when opened in file editor. I will just assume the file editor is wrong. Thanksā€¦will keep hacking at it.

I donā€™t know what file editor you are using, but maybe its synrax checker doesnā€™t understand lambdas.

1 Like