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

Value_template used truncate, but want type 'slice'

$
0
0

@TheStigh wrote:

Hi,

I have a sensor today where I get a long value in return.
I’ve used truncate earlier that works fine, but it takes the first X letters of the value.

Now I want to grab some text in the ‘middle’ and was hoping ‘slice’ would work, but no…

This is the current code:

  - platform: command_line
    name: NUC BIOS
    command: "cat /sys/class/dmi/id/bios_vendor"
    value_template: '{{value|truncate(18,True)}}'

The reason for value ‘18’ is to include the 18 periods after the truncated value.

How can I use my ‘value_template’ to get characters 7 to 15 to be the value of the sensor?

Posts: 3

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 96123

Trending Articles



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