pfSense Rule Switch

Wow. That one looks quite powerful as well. Nice.

I’m using this API with great success, and enable/disable rules with a rest_command.

1 Like

I updated the code per fmagn’s code edits and I updated the SwitchEntity class to fix this error:

SwitchDevice is deprecated, modify pfSense to extend SwitchEntity

I put in a pull request @dgshue

You can’t just say, Hey, it works, and not give any details man!

Sure I can :slight_smile:

But here is an example of how I enable a pfsense rule with a simple REST command (called from a script using, in this case, rest_command.enable_volume_sync):

rest_command:
  enable_volume_sync:
    url: http://[firewall address]/api/v1/firewall/rule
    method: PUT
    content_type: "application/json"
    payload: '{"client-id": "[API username]", "client-token": "[API token]", "tracker":[ rule tracker ID], "disabled": false}'
1 Like

I have tryed to adapt the code to opnsense here:

Thanks for your update @gremblin

Awesome, was going to write my own today, but I’ll take a look at yours thanks for this!

I made a proper integration with switches for rules and hundreds of sensors. Enjoy! pfSense Integration

I have officially announced my opnsense integration here (which includes support for toggling rules among many other things): OPNsense Integration

This is great news. Thanks for this. I can’t wait to get home from my trip to try it out.