Hi, I have a cover template that controls a linear actuator to open my TV unit when TV is powered on and Close when powered off. All has been working well for around 9 months. However on attempting to update the ESP home device through HA I get an error which I cannot decipher.
/config/esphome/wardrobe_tv.yaml: In lambda function:
config/esphome/wardrobe_tv.yaml:86:24: error: 'class esphome::template_::TemplateCover' has no member named 'state'
if (id(tv_position).state == cover::COVER_OPEN) {
^
*** [/data/wardrobe_tv/.pioenvs/wardrobe_tv/src/main.cpp.o] Error 1
My Full ESP code is as follows:
### DEFAULT ###
substitutions:
friendly_name: TVControl
esphome:
name: wardrobe_tv
platform: ESP8266
board: nodemcuv2
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_pass
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "$friendly_name Hotspot"
password: !secret fall_pass
captive_portal:
# Enable logging
logger:
# Enable Home Assistant API
api:
password: !secret api_pass
ota:
password: !secret ota_pass
sensor:
- platform: wifi_signal
name: $friendly_name WiFi Strength
update_interval: 60s
### DEFAULT ###
output:
- platform: gpio
id: 'tv_2'
pin: D1
- platform: gpio
id: 'tv_1'
pin: D2
switch:
- platform: output
name: "tv1"
output: 'tv_1'
id: tv1
- platform: output
name: "tv2"
output: 'tv_2'
id: tv2
cover:
- platform: template
device_class: gate
name: "TV Control"
id: tv_position
optimistic: true
open_action:
- switch.turn_off: tv1
- switch.turn_on: tv2
- delay: 20s
- switch.turn_off: tv2
close_action:
- switch.turn_off: tv2
- switch.turn_on: tv1
- delay: 20s
- switch.turn_off: tv1
stop_action:
- switch.turn_off: tv2
- switch.turn_off: tv1
binary_sensor:
- platform: gpio
pin: D3
name: "TV Position Sensor"
filters:
invert:
on_press:
then:
- lambda: |
if (id(tv_position).state == cover::COVER_OPEN) {
if (id(tv2).state){
// tv is opening
id(tv_position).stop();
} else {
// tv is open and not moving
id(tv_position).close();
}
} else {
if (id(tv1).state){
// tv is closing
id(tv_position).stop();
} else {
// tv is closed and not moving
id(tv_position).open();
}
}
Any pointers greatly appreciated?Preformatted text