-
|
I do not see any example in the documentation of how to define "variables". I remember that I saw some docs about the topic (some Examples), but I'm wondering if this feature is being deprecated and if there is documentation still available. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
|
Do you mean like used here? https://community.home-assistant.io/t/floorplan-now-available-as-a-lovelace-card/115489/433?u=ozgav |
Beta Was this translation helpful? Give feedback.
-
|
Hi @OzGav , I mean, like described here in the code. And here in the floorplan actions. |
Beta Was this translation helpful? Give feedback.
-
|
I had forgotten about this. I don’t use it but here is someone who did it might help you? I don’t know why @pkozul didnt add reference to this in the docs? |
Beta Was this translation helpful? Give feedback.
-
|
I know this is a old discussion, but the variables is still in use. I've mentioned for @pkozul, that it's still missing in the docs. With that said, the following solution works as expected: variables:
# Name can also be something without the "floorplan." prefix
# it's just easier to handle and navigate in the keys
- name: floorplan.state_light_spotlys_gang
value: 'null'
- name: floorplan.example_variable
value: 'Bob example initiated'
startup_action:
# variable_set will only work as expected, if the variables has been declared in the variables: key
- service: floorplan.execute
service_data:
script1: |
> // Example
console.log("🥸 Floorplan started - I'm triggered by the startup_action config-key");
- service: floorplan.variable_set
service_data:
variable: floorplan.example_variable
value: |
> console.log("🥸 Hi, example_variable will now be defined");
return "Bob updated in startup_action";
- service: floorplan.variable_set
service_data:
variable: floorplan.state_light_spotlys_gang
value: |
> // Not used for anything, but examples to ha-floorplan
return "initiated";Hopefully other people can use this for something 😄 . |
Beta Was this translation helpful? Give feedback.
I know this is a old discussion, but the variables is still in use. I've mentioned for @pkozul, that it's still missing in the docs.
With that said, the following solution works as expected: