I have made this work with my Vivotek cameras, but i struggle how to use the grep command to get the status i need.
Anyone who know how i can use the grep to get the right info?
You could pipe the output of curl to sed "s/privacymask_c0_enable='\([0-9]\)'/\1/" to extract the number in single quotes.
If you really wanted to use grep, you could do something like grep -q "privacymask_c0_enable='1'" && echo 1 || echo 0. Please note that this will echo 0 even if the real value is e.g. 4.
As for the value_template, I think the whole thing could be significantly simplified. According to Command line Switch - Home Assistant, we can use grep’s exit code.
Maybe something like
I will test them, thank you So far the switch just keeps going back to the state it was before i pressed it. After like 1-2 seconds.
But ill see what i figure out. This gave me a mile ahead of where i was
Found this, is your problem similar? Does the switch eventually go to the correct state? (Maybe you need to set scan_interval.) We need to make sure the command is actually working as expected.
I actually realized when i added my password back that i marked out as “XXXX” i wrote it wrong.
So when i changed that it does actually work as intended
On when on, and off when off. And it changes the privacy mask on the camera too.
And yes, it changes even state if i manually turn things on and off in my browser. Just a little slow.