Sending commands to pfSense from Home Assistant

My primary goal in asking this question is how to kill established connections when turning on a firewall rule – though know how to run CLI in general would be great too. Turning FW rules on and off is easy. Setting up an automation to watch that and firing off a related action (like sending a command to pfSense) is easy. But the actual sending of the command to pfSense is what eludes me.

My current attempt uses the “kill_states” service. (I’ve also notice that the stub Yaml config for the pfSense integration has also has an “exec_command” service which seems to be used for sending an CLI command over ssh to the pfSense host. But I’ve tried using the Dev tools and haven’t been able to figure out how to configure the service to actually send a command.). My current attempt to use kill_states as an action in my automation is:

action:
  - service: pfsense.kill_states
    data:
      entity_id: binary_sensor.pfsense_localdomain_pending_notices_present
      source: 0.0.0.0/0
      destination: 192.168.0.193/24
  - service: pfsense.kill_states
    data:
      entity_id: binary_sensor.pfsense_localdomain_pending_notices_present
      source: 192.168.0.193/24
      destination: 0.0.0.0/0

(.193 is my son’s gaming laptop :smiling_imp: )

But I do not see “pfsense_lan_pending_notices_present” nor anything like it in all of my pfSense entities in HA (enable or disabled.). In fact, I hav no idea what it means, I just saw this binary_sensor in another post.

How can I move forward with this?

Thanks.

There is a similar discussion happening here. But no resolution yet.

Edit: The pfSense developer seems to be using GitHub more than this forum.

Thanks MaxK. I’ve seen that HA forum thread and browsed the Github repo. My overall goal with HA is to keep things simple and what I see within the integration’s documentation are services that sure sound like they should be able to do this with the right incantations. The last thing I want is to get stuck on a version of HA or pfSense integration because I hav to update some local code to make the update worth my while. TBH, I’d rather just keep on doing this stuff by hand by ssh’ing to pfSense if it comes to that. My avoidance of anything truly custom has been key to my having had a rock solid HA deployment that my family members actually appreciate and want to use.

1 Like