Toggle interface from Homeassistant?
-
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
-
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.
-
@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?
-
@dennypage I am just trying to bring an interface up and down using a button from HA.
-
But like make it lose link? Block traffic? Disable the interface?
For what reason?
-
@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.
-
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.
-
@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
-
@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.
-
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.