mprowe
(Martin)
February 3, 2024, 3:01pm
1
This is my (non-working) yaml:
text_sensor:
- platform: custom
#/homeassistant/esphome/uart_read_line_sensor.h
lambda: |-
auto my_custom_sensor = new UartReadLineSensor(id(myUART23));
App.register_component(my_custom_sensor);
return {my_custom_sensor};
text_sensors:
- id: "odb_tx"
name: "OBD TX"
filters:###############Red squiggly line here?
- prepend: "TX="
- platform: custom
#/homeassistant/esphome/uart_read_line_sensor.h
lambda: |-
auto my_custom_sensor = new UartReadLineSensor(id(myUART18));
App.register_component(my_custom_sensor);
return {my_custom_sensor};
text_sensors:
- id: "obd_rx"
name: "OBD RX"
This: Text Sensor Component doesn’t do it for me!
Regards, M.
tom_l
February 3, 2024, 9:16pm
2
What about indented like this:
text_sensors:
- id: "odb_tx"
name: "OBD TX"
filters:
- prepend: "TX="
mprowe
(Martin)
February 4, 2024, 6:47am
3
Arrggh… I hate this yaml indenting - with a passion!
I had spent ages trying various combinations (honest).
Is there a (linux) IDE that can check this for me? A sort-of LINT for yaml?
Many thanks Tom.
PS - the Documentation I linked in post one has the “filters” at the platform level.
tom_l
February 4, 2024, 7:16am
4
There’s the ESPHome add-on editor. It’s pretty good at pointing out errors.
I don’t think so. Pretty sure they are always at the sensor level (same level as id:
). Those examples are for template text sensors.
mprowe
(Martin)
February 4, 2024, 10:07am
7
Just my point. Tabs to one level in one context, and at another in another context.
But thanks for pointing out that distinction for me.
Regards, M.
Yeah I recall being caught out a few times early on until I realised sensors can be nested in a bit sometimes (when the component supports multiple), and then you need to start from that level.
tom_l
February 4, 2024, 10:23am
9
For some reason this note is above the filter section:
https://esphome.io/components/sensor/#sensor-filters
1 Like