Hi,
I need to create binary_sensor, that reads input from single line text-file. I think templates are tool to use, but so far, haven’t been able to create suitable valuable template. The code I have in binarysensor.yaml
:
- platform: command_line
name: Oumanltptila
command: cut -b 17 /config/oumanltp.txt
Cut -b 17
extracts value from byte 17 in text file, this can beeither 0 or 1. Text-file is created by another system command. This part works, tested on command shell and I use similar code to get temperature data. This passes also all syntax-checking, but it causes state to be undefined.
What kind of template configuration I need to simply set binarysensor to true for value 1, and false for 0? Device tha outputs file is heating controller and its output is easiest to read from these files, its web-interface data is hard to extract, so no REST or SCRAPE.
Contents of text-file is:
result?S_135_85=1;
and result code is after = mark, 135_85 is static register number.