Got ip firewall rules state/flag

Hello all, I am tried to find my issue but with no success.

So, I have a custom application with a Switch button. I want to allow this button to enable and disable the firewall filter rule with id=1.

Enable event:

ssh -i /config/ssh/id_rsa -o StrictHostKeyChecking=no ha@192.168.1.1 '/ip firewall filter enable 1'

1
Disable event:

ssh -i /config/ssh/id_rsa -o StrictHostKeyChecking=no ha@192.168.1.1 '/ip firewall filter disable 1'

1

check state event: ???

What’s the best way to get state enabled/disabled of rule?
Thanks in advance!

ok, I already found it.:

/put [ip firewall filter get number=1 disabled]

You should never use index in scripts, that will break! Instead find the correct rule with whatever criteria it has, for example giving it the comment “first”:

:put [ /ip firewall filter get [ find where comment="first" ] disabled ]