Closed N3rdix closed 9 months ago
I have to think about it, text
is now a reserved word in esphome :-(
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 compiled and tested, works fine 👍 Thanks for the quick response. Shall we adjust the samples anyways?
Just out of curiousity, how did you find out that "message" can be used? I could not find any hint in esphome PRs.
Its just a name, you can use more or less anything e.g. hotzenplotz but you can't use reserved words like `text, api, ....
Bug report
Since 2023.11 it is no longer possible to pass in variables into services with the name "text" as this seems now to be a reserved word from https://github.com/esphome/esphome/pull/5336. This breaks some yaml examples and won't compile correctly any longer due to YAML syntax errors like this:
[text] is an invalid option for [variables].
Describe the bug
Functions like icon_screen use "text" as an argument and cannot be called any longer from homeassistant api .
Additional information
To Reproduce
Take a service call as example and try to pass in a variable named "test"
Expected behavior
Update the yaml examples and warn for a breaking change as service calls (as in my example above) might not work any longer once the variable names were changed in the yaml. I could create at least a PR to adjust the sample YAMLs and use an adjusted variables name and
c_str()
for all calls of icon_screen and other affected methods.