You should be able to use a RESTful switch sensor and the pfSense API to accomplish this. Judging from the github commits, this is still in active development.
I don’t have a pfSense, so I can’t accurately answer that, but if you install the pfSense API on your pfSense box, there should be a menu under System → API. From there, it looks like all the API endpoints are documented there.
I’m just going based on the source code in the repo, but I think it might be something like /api/v1/interface/apply? You might have to dig around a bit and see. The other thing might be to ask in the pfSense forums or here?