Command_line switch curl commands problem

I’m trying to create switch entity for Ouman-EH800 valve. Switch is not workin in UI but sensor showing the state shows right state with same curl commands. Please review my yaml code if you can spot where it fails?

- switch:
    name: Lattialämmitys kotona-poissa
    unique_id: lattia_kotonapoissa
    command_on: curl "http://192.168.86.10:80/update?S_135_85=1;"
    command_off: curl "http://192.168.86.10:80/update?S_135_85=0;"
    command_state: curl "http://192.168.86.10:80/request?S_135_85" | cut -d "=" -f2 | cut -d ";" -f1
    value_template: '{{ value == "1" }}'

What is returned by that curl, exactly?

It returns (if state is “home”)

request?S_135_85=0;

If I explore this from browsers dev tools when using Ouman’s own web interface I can see that it sends two values. I tried to add this 222_85 value to the curl command, but it didn’t help.

qyery parameters from dev tools
image

Also tried to fetch the command_state from register 222_85 but no effect.
response for update query from dev tools
image

In Home Assistant UI shows the switch but if I turn it on it changes back to off in a while. Another sensor entity showing the state of the value works (in the screenshot “kotona” means “At home”)

That test works for me (the switch is on), so not sure what’s wrong on your side

- switch:
    name: Lattialämmitys kotona-poissa
    unique_id: lattia_kotonapoissa
    command_on: echo "1"
    command_off: echo "0"
    command_state: echo "request?S_135_85=1;" | cut -d "=" -f2 | cut -d ";" -f1
    value_template: '{{ value == "1" }}'  

What do you mean by that? Isn’t request?S_135_85=0; the “state of the value”?

Sorry, bad phrase. I have another sensor (also command_line) which shows the current state of the “switch”. It works, if I change the state from Ouman web interface it shows new state. But Home Assistant UI Switch based on that command_line switch cannot change the state.

other sensor

Please just show the yaml of that other sensor :wink:

- binary_sensor:
    device_class: presence
    name: Lattialämmitys kotona-poissa
    command: curl "{{ states('input_text.ouman_eh800_ip')}}request?S_135_85" | cut -d "=" -f2 | cut -d ";" -f1
    payload_on: 0
    payload_off: 1

I replaced IP-adders with input_text but it is the same IP