I created a Helper in HA - wash_person
In my ESPHome YAML program, I have a global string - laundry_person_wash
In my nested loop, I want to assign whatever/whomever is in my global string laundry_person_wash to my HA helper - wash_person. I can’t get my my second IF to work
'return !id(laundry_person_wash).state.empty();'
This line keeps throwing an error.
/config/esphome/cyd-esp32.yaml: In lambda function:
/config/esphome/cyd-esp32.yaml:218:60: error: expected ';' before '}' token
218 | 'return !id(laundry_person_wash).state.empty();'
| ^
| ;
219 | then:
|
/config/esphome/cyd-esp32.yaml:219:3: warning: no return statement in function returning non-void [-Wreturn-type]
219 | then:
I also tried this (below) without the lambda, but that did not work either. This is what I tried before try Google’s recommendation above.
id(laundry_person_wash) != ""
Here is my full interval code
interval:
- interval: 15s
then:
- if:
condition:
- lambda: |-
return !id(recent_touch);
then:
- light.turn_off:
id: backlight
- if:
condition: # id(laundry_person_wash) != ""
lambda: |-
'return !id(laundry_person_wash).state.empty();'
then:
homeassistant.service:
service: input_text.wash_person #HELPER input_text in HA
data:
value: id(laundry_person_wash) #Global string in ESPHome
- lambda: |-
id(bool_wash) = false;
id(bool_dry) = false;
id(laundry_person_wash) = "";
id(laundry_person_dry) = "";
else:
- lambda: |-
id(recent_touch) = false;
What is code that will work for me ?