borisw37
(Boris)
1
I’m trying to create a global variable which is a structure containing int, int and a float.
- id: sensor_metadata
type: struct { int index; int number_of_cycles_without_update; float last_reported_reading;}
restore_value: yes
initial_value: '{0, 0, 0.0}'
But get the following error:
error: types may not be defined in template arguments
What am I doing wrong or are “struct” not allowed in ESPHome?
neel-m
(Neel Malik)
2
The message seems clear to me, you can’t DEFINE a type there. You likely need to define it in a header file. Then you can likely use it there.
is an example (that does not appear to be complete) that might get you closer.