Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 95919

Need help reading data from file sensor

$
0
0

@Joseph_Hare wrote:

So I have been able to setup my config.yaml to read the .CSV file but it only seems to want to read it as a string. What I see on the front end is “77.7” °F, rather than 77.7 °F

sensor:
  - platform: file
    name: Acurite Outdoor Temperature
    file_path: external_data/AcuRite Weather Station/acuriteweather.CSV
    value_template: >
      {{ (value.split(',')[1])}}
    unit_of_measurement: '°F'

using the above in the config will read the values from the file. However, they are being read as a string rather than an integer or a float.

sensor:
  - platform: file
    name: Acurite Outdoor Temperature
    file_path: external_data/AcuRite Weather Station/acuriteweather.CSV
    value_template: >
      {{ (value.split(',')[1] | float)}}
    unit_of_measurement: '°F'

If I use the | float as I have seen in other examples it reads nothing and comes back with a 0°F. Rather than “77.7” °F. So it does turn it into a number but then reads nothing.

In the other examples I have seen they wrote it as:

{{ (value.split(',')[1] | float) | round(2)}}

I am not very good with the template aspect of HA and nay help would be appropriated.

Posts: 5

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 95919

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>