Skip to content

Commit 95b3332

Browse files
icicimovjesserockz
andauthored
Fix m5stack compile warnings esphome::select::Select::state is deprecated: Use current_option() instead (#161)
Co-authored-by: Jesse Hills <[email protected]>
1 parent e84e5f3 commit 95b3332

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

m5stack-atom-echo/m5stack-atom-echo.yaml

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,8 @@ voice_assistant:
126126
# Restart only mWW if enabled; streaming wake words automatically restart
127127
- if:
128128
condition:
129-
- lambda: return id(wake_word_engine_location).state == "On device";
129+
- lambda: |-
130+
return strcmp(id(wake_word_engine_location).current_option(), "On device") == 0;
130131
then:
131132
- wait_until:
132133
- and:
@@ -229,7 +230,8 @@ script:
229230
then:
230231
- if:
231232
condition:
232-
- lambda: return id(wake_word_engine_location).state == "On device";
233+
- lambda: |-
234+
return strcmp(id(wake_word_engine_location).current_option(), "On device") == 0;
233235
- switch.is_on: use_listen_light
234236
then:
235237
- light.turn_on:
@@ -242,7 +244,8 @@ script:
242244
else:
243245
- if:
244246
condition:
245-
- lambda: return id(wake_word_engine_location).state != "On device";
247+
- lambda: |-
248+
return strcmp(id(wake_word_engine_location).current_option(), "On device") == 0;
246249
- switch.is_on: use_listen_light
247250
then:
248251
- light.turn_on:
@@ -261,7 +264,8 @@ script:
261264
and:
262265
- not:
263266
- voice_assistant.is_running:
264-
- lambda: return id(wake_word_engine_location).state == "On device";
267+
- lambda: |-
268+
return strcmp(id(wake_word_engine_location).current_option(), "On device") == 0;
265269
then:
266270
- lambda: id(va).set_use_wake_word(false);
267271
- micro_wake_word.start:
@@ -270,21 +274,24 @@ script:
270274
and:
271275
- not:
272276
- voice_assistant.is_running:
273-
- lambda: return id(wake_word_engine_location).state == "In Home Assistant";
277+
- lambda: |-
278+
return strcmp(id(wake_word_engine_location).current_option(), "In Home Assistant") == 0;
274279
then:
275280
- lambda: id(va).set_use_wake_word(true);
276281
- voice_assistant.start_continuous:
277282
- id: stop_wake_word
278283
then:
279284
- if:
280285
condition:
281-
lambda: return id(wake_word_engine_location).state == "In Home Assistant";
286+
lambda: |-
287+
return strcmp(id(wake_word_engine_location).current_option(), "In Home Assistant") == 0;
282288
then:
283289
- lambda: id(va).set_use_wake_word(false);
284290
- voice_assistant.stop:
285291
- if:
286292
condition:
287-
lambda: return id(wake_word_engine_location).state == "On device";
293+
lambda: |-
294+
return strcmp(id(wake_word_engine_location).current_option(), "On device") == 0;
288295
then:
289296
- micro_wake_word.stop:
290297

0 commit comments

Comments
 (0)