Command line Switch - How to read the current status

Hi Everyone!
I’m trying to implement HTTP switches in order to use HA with our current automation system “My-Gekko”.

switch:

  - platform: command_line

    switches:

      treppenlicht:

        command_on: curl http://192.168.1.3/api/v1/var/lights/item8/scmd/set\?value\=1\&username\=luca\&password\=2303

        command_off: curl http://192.168.1.3/api/v1/var/lights/item8/scmd/set\?value\=0\&username\=luca\&password\=2303

Got this working so far…

the guide didn’t work for me, but my way with just “curl etc.” has…

but how do i implement a read which state the light currently has?
command_state: “/usr/bin/curl -X GET http://192.168.1.10/digital/4
value_template: ‘{{ value == “1” }}’
doesnt work

can you help me out? TY
Luca

Oh yeah, the command to read the value is

http://192.168.1.3/api/v1/var/lights/item8/status?username=luca&password=2303

the response to that is

{
	"sumstate":	{
		"value":	"1;;;0;"
	}
}

the only interesting bit is the one at the front…
the other “;” and the zero are for things like RGB value which i do not have set up

Use a REST switch instead, then extract the state via is_on_template + value_json

please jump on