Value_template help please ssh sensor from remote pi one-wire temperature

Howdy. I am trying to get a readable F temperature visible on my HA frontend. I have the ssh platform sensor getting data well from another local Pi’s one wire temperature sensor like so…

  - platform: ssh
    host: 192.168.1.126
    name: 'Ice Pi Temp'
    username: ****
    password: *****
    command: "cat /sys/bus/w1/devices/28-3c01d607c9f6/w1_slave"  

The results from that command comes back as 2 lines (much of it different after remote pi is rebooted). Like so…

03 01 55 05 7f a5 a5 66 b7 : crc=b7 YES
03 01 55 05 7f a5 a5 66 b7 t=16187

I am trying to create a value template that will ignore all the (changing) text/data before those last five digits 16187 (the one-wire temp output). I’d also need to create a float? or a template? for converting it into a Fahrenheit reading for my lovely Lovelace. Been tweaking on it for a few hours but I’m at a lose. Thanks for any help.

The complete non working yaml.bit for this sensor as it is now. And again… after a reboot the “fb 00 55 05 7f a5 a5 66 87” bit will change. And again again. Thanks Loads!!!

  - platform: ssh
    host: 192.168.1.126
    name: 'Ice Pi Temp'
    username: ****
    password: *****
    command: "cat /sys/bus/w1/devices/28-3c01d607c9f6/w1_slave"  
    value_template: >-
      {%- set line = value.split('.')[0]|replace('fb 00 55 05 7f a5 a5 66 87 t=', ' ') -%}
      {{ line[2] }}
    unit_of_measurement: "°C"

If the value looks like this:

03 01 55 05 7f a5 a5 66 b7 t=16187

then this template will return 16187

value_template: "{{ value.split('=')[1] }}"
1 Like

Thank you.