Im trying to use an integer array on lambda actions. some thing like:
globals:
- id: hours_on
type: int[3]
restore_value: no
initial_value: '{9,9,10}'
- id: minutes_on
type: int[3]
restore_value: no
initial_value: '{0,30,0}'
the action:
then:
- lambda: |-
int i=0;
for( i=0; i==2; i++)
{
ESP_LOGD("main", "Time on: %i:%i",id(hours_on)[i].state ,id(minutes_on)[i].state);
}
probably is something really easy but I have not enought expirence…
zoogara
(Daryl)
2
Without actually trying it myself - have you tried: id(hours_on).state[i]
yes, it does not work.
Also try:
- lambda: |-
int j=0;
int hr;
int minute;
for( j=0; j==2; j++)
{
hr = id(hours_on)[j];
minnute =id(minutes_on)[j];
ESP_LOGD("main", "Time on: %i : %i ", hr, minute);
}
It does not work either.
It seems like the for
conditional does not work. I can’t get ESP_LOGD
to print on the screan while inside the for loop.
I feel a little embarrassed…
This works!
for( j=0; j<=2; j++)
- lambda: |-
int j=0;
int hr;
int minute;
for( j=0; j<=2; j++)
{
hr = id(hours_on)[j];
minnute =id(minutes_on)[j];
ESP_LOGD("main", "Time on: %i : %i ", hr, minute);
}