[api] Support to optional parameters on ESPHome actions called from Home Assistant #3486
Unanswered
edwardtfn
asked this question in
Component enhancements
Replies: 1 comment
-
|
🏷️ I've automatically added the |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Component name
api
Link to component documentation on our website
https://esphome.io/components/api/
Describe the enhancement
Currently, when ESPHome publishes an action with specific parameters, all those parameters are required when Home Assistant is calling that action, otherwise the call will fail.
This makes harder to manage improvements, as additional parameters would require existing calls to be updated. Also, in some cases not all parameters may be required (there are lots of examples in Home Assistant, like
light.turn_on).I don't want to go on the direction of a solution, but would be fine either to have a flag when a parameter is not provided or, probably easier, to work with a default value for parameters that are optional.
Use cases
This would make easier evolving system without requiring users to rebuild their existing calls.
Also, on my specific project with NSPanel, I need 2 different actions when calling pages, as some pages requires an
entity_idto be shown (like a light page), while some pages (like home) aren't connected to entities and therefore wouldn't require any parameter.With the optional parameters I would be able to reduce one action and with this reduce memory consumption.
I could list lots of other cases like this. 😉
Anything else?
No response
Beta Was this translation helpful? Give feedback.
All reactions