This is my yaml (based on this solution: Timestamp) which in 2019, they reported as working. I know it is a subtly different context (but its a start):
text_sensor:
- platform: custom
#/homeassistant/esphome/uart_read_line_sensor.h
lambda: |-
char str[17];
time_t currTime = id(homeassistant_time).now().timestamp;
strftime(str, sizeof(str), "%H:%M:%f", localtime(&currTime));
return {str};
text_sensors:
- id: "odb_timestamp"
name: "OBD Timestamp"
I think that the lamda compilation is complaining about the return datatype?
Compiling .pioenvs/tinypico/src/main.cpp.o
<unicode string>: In lambda function:
<unicode string>:51:18: error: could not convert '{str}' from '<brace-enclosed initializer list>' to 'std::vector<esphome::text_sensor::TextSensor*>'
*** [.pioenvs/tinypico/src/main.cpp.o] Error 1
========================== [FAILED] Took 6.64 seconds ==========================
Any suggests to get me moving again, will be most welcome.
Regards, M.