- platform: tcp
name: 1-wire relay
host: 192.168.1.14
port: 5001
timeout: 10
payload: “dev “29-11C450-87” sense rsp=piosensed ; block ; close\n\r”
value_on: 254
The above binary_sensor tcp platform don’t work. When debugging the same but as a tcp sensor I get the reponse 254 and 255. I.e. the script works. My question is if the response has to be 1 or 0? It’s not very clear when reading the manual.
I have several 1-wire temp and humidity sensors read by Home Assistant and the tcp plaform and it works great.
Without proper code formatting (see box at the top of the page) it’s really hard to spot syntax errors.
But if I had to make a guess, I’d say that the payload
line looks odd with all those quotation marks.
- platform: tcp
name: 1-wire relay
host: 192.168.1.14
port: 5001
timeout: 10
payload: “dev \“29-11C450-87\” sense rsp=piosensed ; block ; close\n\r”
value_on: 254
I missed the two backslashes in the code above. This type of payload works fine when reading tempratures from the same 1-wire server. My concern is the value_on. Does it have to be 1 or 0 ?
I have to admit that I am not using the tcp
binary sensor myself. According to the documentation value_on
is supposed to contain the exact value returned by the server side. If your value does not work as expected, it may be due to type (maybe string vs. integer). I just saw that the tcp
binary sensor also supports value_template
which can be used to process the value returned by the server side, and convert it.
I just had a quick look into the code, and the binary sensor really just compares the value returned with whatever is defined as value_on
.