Skip to content

problem with text as variable name

github-actions[bot] edited this page Nov 20, 2023 · 1 revision

Own service calls

Skill-level: all

Up to esphome 2023.10.2 you colud do this:

The solution:

api:
  services:
    - service: alarm
      variables:
        icon_name: string
        text: string
      then:
        lambda: |-
          id(rgb8x32)->icon_screen(icon_name,text,7,20,true);
          id(rgb8x32)->force_screen(icon_name);

But sinde esphome 2023.11.0 textis a reserved word you have to use this:

The solution:

api:
  services:
    - service: alarm
      variables:
        icon_name: string
        message: string
      then:
        lambda: |-
          id(rgb8x32)->icon_screen(icon_name,message,7,20,true);
          id(rgb8x32)->force_screen(icon_name);

Just dont use text as variable name!

Clone this wiki locally