Using arrays as global variables #1696
Unanswered
JamesSwift
asked this question in
Q&A
Replies: 1 comment
-
You should use lambdas to read/update global var. array. Maybe this example will be useful for https://github.com/corvis/esphome-packages/tree/main/packages/jb_irrigation.pkg |
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
-
Hi,
I've been reading through the docs on global variables. I can see how to set and manipulate them through the yaml and lambda style, but I'm not sure how to manipulate/read arrays through the yaml style. Any tips?
https://esphome.io/guides/automations.html#bonus-2-global-variables
My project is an automatic cat feeder which detects which cat is present based on their weight, and dispenses food if they are allowed more. I'd like to store data in a couple of global arrays instead of a handful of individual global variables for each cat, but can't see how to do it. It would making adding or removing cats much easier (could be done through the API rather than by editing the code).
Beta Was this translation helpful? Give feedback.
All reactions