Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    Toggle interface from Homeassistant?

    Scheduled Pinned Locked Moved General pfSense Questions
    10 Posts 3 Posters 463 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • D
      deanfourie
      last edited by

      Hi,

      I need some assistance to toggle a interface from Homeassistant use the pfSense API.

      Does anyone have experience doing this? I am looking for a simple On Off switch to bring an interface Up and Down.

      Any ideas?

      Thanks

      dennypageD 1 Reply Last reply Reply Quote 0
      • stephenw10S
        stephenw10 Netgate Administrator
        last edited by

        You would need to ssh and send a command. You can bring down an interface directly like that but the system may bring it back up when something reloads.

        1 Reply Last reply Reply Quote 0
        • dennypageD
          dennypage @deanfourie
          last edited by

          @deanfourie I find the concept of Home Assistant having privileged access to my firewall very disconcerting. What is it you are trying to accomplish, and is there any other way?

          D 1 Reply Last reply Reply Quote 1
          • D
            deanfourie @dennypage
            last edited by

            @dennypage I am just trying to bring an interface up and down using a button from HA.

            1 Reply Last reply Reply Quote 0
            • stephenw10S
              stephenw10 Netgate Administrator
              last edited by

              But like make it lose link? Block traffic? Disable the interface?

              For what reason?

              D 1 Reply Last reply Reply Quote 0
              • D
                deanfourie @stephenw10
                last edited by

                @stephenw10 My internet goes down @ 2am every night via a CRON task,

                I want a option to enable it without having to login, as its not always me wanting to enable it.

                Hence a switch in homeassistant to turn the WAN interface back on would be idea.

                1 Reply Last reply Reply Quote 0
                • stephenw10S
                  stephenw10 Netgate Administrator
                  last edited by

                  Ok well I assume you have another cron-job to re-enable it?

                  You can just use an ssh command with the same command as the cronjob.

                  D 1 Reply Last reply Reply Quote 0
                  • D
                    deanfourie @stephenw10
                    last edited by

                    @stephenw10 Yes, I have another CRON rule to reenable at like 7am.

                    I dont want to enable SSH.

                    I thought I could do this via the pfSense API.

                    https://github.com/jaredhendrickson13/pfsense-api

                    dennypageD 1 Reply Last reply Reply Quote 0
                    • dennypageD
                      dennypage @deanfourie
                      last edited by

                      @deanfourie That integration just uses the pfSense php interface, which is the same as the web interface. It requires an admin user on pfSense which would make me nervous. I would prefer a cron job on pfSense that called out to Home Assistant to check instead.

                      1 Reply Last reply Reply Quote 1
                      • stephenw10S
                        stephenw10 Netgate Administrator
                        last edited by

                        Yup, that. But also I'd consider ssh with key only more secure if you're going to open anything.

                        I've never used that 3rd party API so can't offer anything there.

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post
                        Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.