GithubHelp home page GithubHelp logo

travisghansen / hass-pfsense Goto Github PK

View Code? Open in Web Editor NEW
182.0 11.0 27.0 162 KB

pfSense integration with Home Assistant

Python 100.00%
home-assistant home-automation pfsense hassio hass hassio-integration

hass-pfsense's People

Contributors

antbarney avatar ko94 avatar leandroissa avatar markfrancisonly avatar nikdoof avatar purcell-lab avatar raman325 avatar travisghansen avatar viper5000 avatar wrt54g avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hass-pfsense's Issues

Gateway status remains down

I had an internet service outage which was fixed by power-cycling the CPE. In HA the gateway went down, but after restoring the internet access, the sensor state didn't recover in HA. Also loss stays at 100%.
In pfSense dashboard everything is OK...

small issue

I would like to have option to choose for example WAN IN in Mbit instead of KB/s
Is this posible so I dont have to create more Entity and template ..

thnx in advance.

Integration spams pfSense with RADIUS requests

When using this integration with pfSense set to use RADIUS backend, and the integration is configured with a local user, the integration causes millions of authentication requests to the RADIUS server which as expected, fail, because its a local fallback user

Does the integration not cache the authentication state or is it creating a separate request for each sensor? On my system, the integration created 45 devices and 650 entities out of the box

error after update

After today's update to 0.5.1 at HA restart:

2022-07-06 20:26:23 ERROR (MainThread) [homeassistant.loader] Unexpected exception importing platform custom_components.pfsense.update
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/loader.py", line 618, in get_platform
    cache[full_name] = self._import_platform(platform_name)
  File "/usr/src/homeassistant/homeassistant/loader.py", line 635, in _import_platform
    return importlib.import_module(f"{self.pkg_path}.{platform_name}")
  File "/usr/local/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 850, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/config/custom_components/pfsense/update.py", line 93, in <module>
    class PfSenseFirmwareUpdatesAvailableUpdate(PfSenseUpdate):
  File "/config/custom_components/pfsense/update.py", line 107, in PfSenseFirmwareUpdatesAvailableUpdate
    def installed_version(self) -> str | None:
TypeError: unsupported operand type(s) for |: 'type' and 'NoneType'
2022-07-06 20:26:23 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform pfsense.update: Platform not found (Exception importing custom_components.pfsense.update).
2022-07-06

"Retrying in background" Setup loop

Initial setup, pfSense 2.5.0 and hass-pfsense 0.4.1 and Home Assistant 2022.3.5, configured for 5 max sessions.

HA shows "retrying setup" and pfSense shows:
192.168.0.100 - [email protected] [21/Mar/2022:18:36:30 -0400] "POST /xmlrpc.php HTTP/1.1" 200 170 "-" "Python-xmlrpc/3.9"
Basically 5 identical requests in sequence every 10 seconds.

My firewall leverages AD authentication, and I created a specific user in AD, gave it sufficient pfSense permissions, and put in [email protected] with the password in the setup. It reported success, but then appears to be "retrying setup" for the last 30+ minutes.

Otherwise on the firewall side, I'm running several VLANs and have 2 outgoing VPN circuits, and running several add on packages including suricata, zabbix, pimd, pfBlocker, and Avahi.

Ideas?

pfsense is running in a VM, integration shows 32F for temperature?

I'm only beginning to look into the various things this plug-in provides, and I have a past history of doing software QA. I tend to "find things". Don't shoot the messenger!

My pfsense install is on a VM. As such it doesn't have access to all the same things a bare-metal install might. One of which seems to be whatever value pfsense uses for "Temp". When I look at the pfsense main page for the router it does not show a temp variable. It's selected in the (wrench) submenu for the box, but no entry shows up for it in-between MBUF and Load Average. I gather this is because pfsense is being smart about not showing what it can't provide?

I still have the overview configured as a default dynamic one, so I don't miss anything new being added. I'll get to configuring my own cards at a later point.

When I look at the dashboard "Sensor" card the "router System Temperature" is showing as 32F. The sensor.router_system_temperature entity is enabled. I'm guessing the XMLRPC is returning something being interpreted as zero, and converted to Fahrenheit 32F?

I suppose I should look into whether it's possible for the VM to be configured to pass this info. I'll ignore the temp entity until then.

OpenVPN Sensor

Hi,
would it be possible to have a sensor that indicates the status of the VPN connection, in case some client connected?

Thanks

Doesnt work

Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/aiohttp/web_protocol.py", line 435, in _handle_request
resp = await request_handler(request)
File "/usr/local/lib/python3.9/site-packages/aiohttp/web_app.py", line 504, in _handle
resp = await handler(request)
File "/usr/local/lib/python3.9/site-packages/aiohttp/web_middlewares.py", line 117, in impl
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 222, in forwarded_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 79, in ban_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 220, in auth_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 137, in handle
result = await result
File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 266, in post
return await super().post(request, flow_id)
File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 62, in wrapper
result = await method(view, request, *args, **kwargs)
File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 109, in post
result = await self._flow_mgr.async_configure(flow_id, data)
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 260, in async_configure
result = await self._async_handle_step(
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 335, in _async_handle_step
result: FlowResult = await getattr(flow, method)(user_input)
File "/config/custom_components/pfsense/config_flow.py", line 197, in async_step_init
return await self.async_step_device_tracker()
File "/config/custom_components/pfsense/config_flow.py", line 240, in async_step_device_tracker
arp_table := await self.hass.async_add_executor_job(
File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/pfsense/pypfsense/init.py", line 305, in get_arp_table
response = self._exec_php(script)
File "/config/custom_components/pfsense/pypfsense/init.py", line 58, in inner
response = func(*args, **kwargs)
File "/config/custom_components/pfsense/pypfsense/init.py", line 91, in _exec_php
response = self._get_proxy().pfsense.exec_php(script)
File "/usr/local/lib/python3.9/xmlrpc/client.py", line 1122, in call
return self.__send(self.__name, args)
File "/usr/local/lib/python3.9/xmlrpc/client.py", line 1464, in __request
response = self.__transport.request(
File "/usr/local/lib/python3.9/xmlrpc/client.py", line 1166, in request
return self.single_request(host, handler, request_body, verbose)
File "/usr/local/lib/python3.9/xmlrpc/client.py", line 1179, in single_request
resp = http_conn.getresponse()
File "/usr/local/lib/python3.9/http/client.py", line 1377, in getresponse
response.begin()
File "/usr/local/lib/python3.9/http/client.py", line 320, in begin
version, status, reason = self._read_status()
File "/usr/local/lib/python3.9/http/client.py", line 281, in _read_status
line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
File "/usr/local/lib/python3.9/socket.py", line 704, in readinto
return self._sock.recv_into(b)
File "/usr/local/lib/python3.9/ssl.py", line 1241, in recv_into
return self.read(nbytes, buffer)
File "/usr/local/lib/python3.9/ssl.py", line 1099, in read
return self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out

Config flow could not be loaded

Good afternoon,

After installing Pfsense, I get the error "Config flow could not be loaded" when attempting to add the configuration through Configuration > Integrations.

I'm incredibly excited about this integration you've created and any assistance you might be able to provide would be incredibly appreciated! Thank you!

[BUG] Fails to load in Home Assistant 2022.7.0b0

Log:

2022-06-29 13:27:50 ERROR (MainThread) [homeassistant.components.sensor] Error adding entities for domain sensor with platform pfsense
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 397, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 641, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 775, in add_to_platform_finish
    await self.async_added_to_hass()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 332, in async_added_to_hass
    self._handle_coordinator_update, self.coordinator_context
AttributeError: 'PfSenseStaticKeySensor' object has no attribute 'coordinator_context'

Feature request

First off, great work - I appericiate the time and effort that would have been put into creating and maintaining this. I was trying to manipulate pfSense from HASS using an unofficial API and cURL requests..

I'd like to suggest a feature and I'm not sure where to put it?

I'm not sure if XML-RPC supports it, but I'd ideally like to remove and aliases (In pfSense, Firewall > Aliases > IP) from Home Assistant. I have a rule which redirects internet traffic out through a different gateway/connection, and the rule looks to an alias list in order to see what IP addresses to apply it against. I can use your integration to turn off the rule, but then it effects all the devices - where I would want to choose which IP to add/remove.

I was able to achieve this via RESTful switches worked but required a package on the pfSense firewall to be installed, and could get out of sync. I can currently work around this by having different rules for different single source hosts, but the alias route is neater and requires less rules.

image
image

Start using releases

It would be great if you start using releases to deliver updates. Otherwise, all changes in repo, like readme/docs should ship a new version to home assistant.

Error while connecting

I can't get it to work and I really don't know how to get any more logging to be able to solve it. Could you point me to any direction or do you know what is wrong?

I'm running pfSense 2.5.2.
This is the only thing I can see in my logs.

2021-11-22 21:48:45 ERROR (MainThread) [custom_components.pfsense] Unexpected error fetching router pfSense state data: syntax error: line 2, column 0
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 187, in _async_refresh
self.data = await self._async_update_data()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 147, in _async_update_data
return await self.update_method()
File "/config/custom_components/pfsense/__init__.py", line 94, in async_update_data
await hass.async_add_executor_job(lambda: data.update())
File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/pfsense/__init__.py", line 94, in <lambda>
await hass.async_add_executor_job(lambda: data.update())
File "/config/custom_components/pfsense/__init__.py", line 248, in update
self._state["telemetry"] = self._get_telemetry()
File "/config/custom_components/pfsense/__init__.py", line 224, in _get_telemetry
return self._client.get_telemetry()
File "/config/custom_components/pfsense/pypfsense/__init__.py", line 776, in get_telemetry
data = self._exec_php(script)
File "/config/custom_components/pfsense/pypfsense/__init__.py", line 58, in inner
response = func(*args, **kwargs)
File "/config/custom_components/pfsense/pypfsense/__init__.py", line 78, in _exec_php
return self._get_proxy().pfsense.exec_php(script)
File "/usr/local/lib/python3.9/xmlrpc/client.py", line 1116, in __call__
return self.__send(self.__name, args)
File "/usr/local/lib/python3.9/xmlrpc/client.py", line 1458, in __request
response = self.__transport.request(
File "/usr/local/lib/python3.9/xmlrpc/client.py", line 1160, in request
return self.single_request(host, handler, request_body, verbose)
File "/usr/local/lib/python3.9/xmlrpc/client.py", line 1176, in single_request
return self.parse_response(resp)
File "/usr/local/lib/python3.9/xmlrpc/client.py", line 1342, in parse_response
p.feed(data)
File "/usr/local/lib/python3.9/xmlrpc/client.py", line 445, in feed
self._parser.Parse(data, False)
xml.parsers.expat.ExpatError: syntax error: line 2, column 0
2021-11-22 21:48:45 DEBUG (MainThread) [custom_components.pfsense] Finished fetching router pfSense state data in 1.062 seconds (success: False)

Option Device Tracker Consider Home not there

Installed everything as described however I'm missing the "Device Tracker Consider Home" setting when setting up the integration. Where can I configure this?

I'm looking into using this for tracking phones around the house and I would like to tweak this value as I see some false negatives.
Thanks for the work!

XMLRPC errors - initial installation

Thanks for this exciting new integration! I am having an issue upon my initial set up the integration I wanted to report. I am installing via HACS default, release v0.1.0, Home Assistant 2021.11.3, pfsense 2.5.2-RELEASE

I followed the readme guide, created a user in pfsense with "System - HA node sync" privileges, configured the integration in the HA integration flow. After confirming success, I'm immediately presented with the below error. I attemted to connect via domain/IP, and verify/not verify SSL; but received the same error each time.

I was able to find a related error on another repository of yours here. Unfortunately I wasn't able to discern anything useful here.

Do you have any recommendations or suggestions for troubleshooting this error?

Here is the integration page:
image

Here are the log entries associated with the error:

Logger: homeassistant.config_entries
Source: config_entries.py:335
First occurred: 9:54:38 PM (5 occurrences)
Last logged: 10:23:21 PM

Config entry 'pfsenseha' for pfsense integration not ready yet: <Fault 1: "Unhandled XML_RPC2_InvalidTypeEncodeException exception:Impossible to encode value '' from type 'NULL'. No analogous type in XML_RPC.#0 /usr/local/share/pear/XML/RPC2/Backend/Php/Value/Struct.php(107): XML_RPC2_Backend_Php_Value::createFromNative(NULL)\n#1 /usr/local/share/pear/XML/RPC2/Backend/Php/Value/Struct.php(107): XML_RPC2_Backend_Php_Value_Struct->encode()\n#2 /usr/local/share/pear/XML/RPC2/Backend/Php/Value/Struct.php(107): XML_RPC2_Backend_Php_Value_Struct->encode()\n#3 /usr/local/share/pear/XML/RPC2/Backend/Php/Response.php(86): XML_RPC2_Backend_Php_Value_Struct->encode()\n#4 /usr/local/share/pear/XML/RPC2/Backend/Php/Server.php(135): XML_RPC2_Backend_Php_Response::encode(Object(XML_RPC2_Backend_Php_Value_Struct), 'utf-8')\n#5 /usr/local/share/pear/XML/RPC2/Backend/Php/Server.php(99): XML_RPC2_Backend_Php_Server->getResponse()\n#6 /usr/local/www/xmlrpc.php(954): XML_RPC2_Backend_Php_Server->handleCall()\n#7 {main}">; Retrying in background
This error originated from a custom integration.

Logger: custom_components.pfsense
Source: custom_components/pfsense/pypfsense/__init__.py:78
Integration: pfSense (documentation, issues)
First occurred: 9:54:38 PM (40 occurrences)
Last logged: 10:34:25 PM

Unexpected error fetching pfseneha pfSense state data: <Fault 1: "Unhandled XML_RPC2_InvalidTypeEncodeException exception:Impossible to encode value '' from type 'NULL'. No analogous type in XML_RPC.#0 /usr/local/share/pear/XML/RPC2/Backend/Php/Value/Struct.php(107): XML_RPC2_Backend_Php_Value::createFromNative(NULL)\n#1 /usr/local/share/pear/XML/RPC2/Backend/Php/Value/Struct.php(107): XML_RPC2_Backend_Php_Value_Struct->encode()\n#2 /usr/local/share/pear/XML/RPC2/Backend/Php/Value/Struct.php(107): XML_RPC2_Backend_Php_Value_Struct->encode()\n#3 /usr/local/share/pear/XML/RPC2/Backend/Php/Response.php(86): XML_RPC2_Backend_Php_Value_Struct->encode()\n#4 /usr/local/share/pear/XML/RPC2/Backend/Php/Server.php(135): XML_RPC2_Backend_Php_Response::encode(Object(XML_RPC2_Backend_Php_Value_Struct), 'utf-8')\n#5 /usr/local/share/pear/XML/RPC2/Backend/Php/Server.php(99): XML_RPC2_Backend_Php_Server->getResponse()\n#6 /usr/local/www/xmlrpc.php(954): XML_RPC2_Backend_Php_Server->handleCall()\n#7 {main}">
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 187, in _async_refresh
    self.data = await self._async_update_data()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 147, in _async_update_data
    return await self.update_method()
  File "/config/custom_components/pfsense/__init__.py", line 94, in async_update_data
    await hass.async_add_executor_job(lambda: data.update())
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/pfsense/__init__.py", line 94, in <lambda>
    await hass.async_add_executor_job(lambda: data.update())
  File "/config/custom_components/pfsense/__init__.py", line 248, in update
    self._state["telemetry"] = self._get_telemetry()
  File "/config/custom_components/pfsense/__init__.py", line 224, in _get_telemetry
    return self._client.get_telemetry()
  File "/config/custom_components/pfsense/pypfsense/__init__.py", line 776, in get_telemetry
    data = self._exec_php(script)
  File "/config/custom_components/pfsense/pypfsense/__init__.py", line 58, in inner
    response = func(*args, **kwargs)
  File "/config/custom_components/pfsense/pypfsense/__init__.py", line 78, in _exec_php
    return self._get_proxy().pfsense.exec_php(script)
  File "/usr/local/lib/python3.9/xmlrpc/client.py", line 1116, in __call__
    return self.__send(self.__name, args)
  File "/usr/local/lib/python3.9/xmlrpc/client.py", line 1458, in __request
    response = self.__transport.request(
  File "/usr/local/lib/python3.9/xmlrpc/client.py", line 1160, in request
    return self.single_request(host, handler, request_body, verbose)
  File "/usr/local/lib/python3.9/xmlrpc/client.py", line 1176, in single_request
    return self.parse_response(resp)
  File "/usr/local/lib/python3.9/xmlrpc/client.py", line 1348, in parse_response
    return u.close()
  File "/usr/local/lib/python3.9/xmlrpc/client.py", line 662, in close
    raise Fault(**self._stack[0])
xmlrpc.client.Fault: <Fault 1: "Unhandled XML_RPC2_InvalidTypeEncodeException exception:Impossible to encode value '' from type 'NULL'. No analogous type in XML_RPC.#0 /usr/local/share/pear/XML/RPC2/Backend/Php/Value/Struct.php(107): XML_RPC2_Backend_Php_Value::createFromNative(NULL)\n#1 /usr/local/share/pear/XML/RPC2/Backend/Php/Value/Struct.php(107): XML_RPC2_Backend_Php_Value_Struct->encode()\n#2 /usr/local/share/pear/XML/RPC2/Backend/Php/Value/Struct.php(107): XML_RPC2_Backend_Php_Value_Struct->encode()\n#3 /usr/local/share/pear/XML/RPC2/Backend/Php/Response.php(86): XML_RPC2_Backend_Php_Value_Struct->encode()\n#4 /usr/local/share/pear/XML/RPC2/Backend/Php/Server.php(135): XML_RPC2_Backend_Php_Response::encode(Object(XML_RPC2_Backend_Php_Value_Struct), 'utf-8')\n#5 /usr/local/share/pear/XML/RPC2/Backend/Php/Server.php(99): XML_RPC2_Backend_Php_Server->getResponse()\n#6 /usr/local/www/xmlrpc.php(954): XML_RPC2_Backend_Php_Server->handleCall()\n#7 {main}">

Fresh install XMLRPC error

2.5.2 release of pfsense. Nothing special, just LAN/WAN.

Seeing this error:

Logger: homeassistant.config_entries
Source: config_entries.py:335
First occurred: 7:40:10 AM (26 occurrences)
Last logged: 8:25:07 PM

Config entry 'pfsense' for pfsense integration not ready yet: <Fault 1: "Unhandled XML_RPC2_InvalidTypeEncodeException exception:Impossible to encode value '' from type 'NULL'. No analogous type in XML_RPC.#0 /usr/local/share/pear/XML/RPC2/Backend/Php/Value/Struct.php(107): XML_RPC2_Backend_Php_Value::createFromNative(NULL)\n#1 /usr/local/share/pear/XML/RPC2/Backend/Php/Value/Array.php(99): XML_RPC2_Backend_Php_Value_Struct->encode()\n#2 /usr/local/share/pear/XML/RPC2/Backend/Php/Value/Struct.php(107): XML_RPC2_Backend_Php_Value_Array->encode()\n#3 /usr/local/share/pear/XML/RPC2/Backend/Php/Value/Struct.php(107): XML_RPC2_Backend_Php_Value_Struct->encode()\n#4 /usr/local/share/pear/XML/RPC2/Backend/Php/Response.php(86): XML_RPC2_Backend_Php_Value_Struct->encode()\n#5 /usr/local/share/pear/XML/RPC2/Backend/Php/Server.php(135): XML_RPC2_Backend_Php_Response::encode(Object(XML_RPC2_Backend_Php_Value_Struct), 'utf-8')\n#6 /usr/local/share/pear/XML/RPC2/Backend/Php/Server.php(99): XML_RPC2_Backend_Php_Server->getResponse()\n#7 /usr/local/www/xmlrpc.php(954): XML_RPC2_Backend_Php_Server->handleCall()\n#8 {main}">; Retrying in background
Config entry 'router' for pfsense integration not ready yet: <Fault 1: "Unhandled XML_RPC2_InvalidTypeEncodeException exception:Impossible to encode value '' from type 'NULL'. No analogous type in XML_RPC.#0 /usr/local/share/pear/XML/RPC2/Backend/Php/Value/Struct.php(107): XML_RPC2_Backend_Php_Value::createFromNative(NULL)\n#1 /usr/local/share/pear/XML/RPC2/Backend/Php/Value/Array.php(99): XML_RPC2_Backend_Php_Value_Struct->encode()\n#2 /usr/local/share/pear/XML/RPC2/Backend/Php/Value/Struct.php(107): XML_RPC2_Backend_Php_Value_Array->encode()\n#3 /usr/local/share/pear/XML/RPC2/Backend/Php/Value/Struct.php(107): XML_RPC2_Backend_Php_Value_Struct->encode()\n#4 /usr/local/share/pear/XML/RPC2/Backend/Php/Response.php(86): XML_RPC2_Backend_Php_Value_Struct->encode()\n#5 /usr/local/share/pear/XML/RPC2/Backend/Php/Server.php(135): XML_RPC2_Backend_Php_Response::encode(Object(XML_RPC2_Backend_Php_Value_Struct), 'utf-8')\n#6 /usr/local/share/pear/XML/RPC2/Backend/Php/Server.php(99): XML_RPC2_Backend_Php_Server->getResponse()\n#7 /usr/local/www/xmlrpc.php(954): XML_RPC2_Backend_Php_Server->handleCall()\n#8 {main}">; Retrying in background
Config entry 'router' for pfsense integration not ready yet; Retrying in background

Tried using a different user, with the proper permissions set (basically, all of them) and no change.

logging on the router seems to think something's hitting the xmlrpc URL pretty hard:

Nov 18 20:33:13	nginx		192.168.12.199 - wkearney [18/Nov/2021:20:33:13 -0500] "POST /xmlrpc.php HTTP/1.1" 200 160 "-" "Python-xmlrpc/3.9"
Nov 18 20:33:13	nginx		192.168.12.199 - wkearney [18/Nov/2021:20:33:13 -0500] "POST /xmlrpc.php HTTP/1.1" 200 160 "-" "Python-xmlrpc/3.9"
Nov 18 20:33:13	nginx		192.168.12.199 - wkearney [18/Nov/2021:20:33:13 -0500] "POST /xmlrpc.php HTTP/1.1" 200 160 "-" "Python-xmlrpc/3.9"
Nov 18 20:33:13	nginx		192.168.12.199 - wkearney [18/Nov/2021:20:33:13 -0500] "POST /xmlrpc.php HTTP/1.1" 200 160 "-" "Python-xmlrpc/3.9"
Nov 18 20:33:13	nginx		192.168.12.199 - wkearney [18/Nov/2021:20:33:13 -0500] "POST /xmlrpc.php HTTP/1.1" 200 160 "-" "Python-xmlrpc/3.9"
Nov 18 20:33:13	nginx		192.168.12.199 - wkearney [18/Nov/2021:20:33:13 -0500] "POST /xmlrpc.php HTTP/1.1" 200 160 "-" "Python-xmlrpc/3.9"
Nov 18 20:33:13	nginx		192.168.12.199 - wkearney [18/Nov/2021:20:33:13 -0500] "POST /xmlrpc.php HTTP/1.1" 200 160 "-" "Python-xmlrpc/3.9"
Nov 18 20:33:13	nginx		192.168.12.199 - wkearney [18/Nov/2021:20:33:13 -0500] "POST /xmlrpc.php HTTP/1.1" 200 160 "-" "Python-xmlrpc/3.9"
Nov 18 20:33:13	nginx		192.168.12.199 - wkearney [18/Nov/2021:20:33:13 -0500] "POST /xmlrpc.php HTTP/1.1" 200 160 "-" "Python-xmlrpc/3.9"
Nov 18 20:33:13	nginx		192.168.12.199 - wkearney [18/Nov/2021:20:33:13 -0500] "POST /xmlrpc.php HTTP/1.1" 200 160 "-" "Python-xmlrpc/3.9"
Nov 18 20:33:13	nginx		192.168.12.199 - wkearney [18/Nov/2021:20:33:13 -0500] "POST /xmlrpc.php HTTP/1.1" 200 160 "-" "Python-xmlrpc/3.9"
Nov 18 20:33:13	nginx		192.168.12.199 - wkearney [18/Nov/2021:20:33:13 -0500] "POST /xmlrpc.php HTTP/1.1" 200 160 "-" "Python-xmlrpc/3.9"
Nov 18 20:33:13	nginx		192.168.12.199 - wkearney [18/Nov/2021:20:33:13 -0500] "POST /xmlrpc.php HTTP/1.1" 200 160 "-" "Python-xmlrpc/3.9"
Nov 18 20:33:14	nginx		192.168.12.199 - wkearney [18/Nov/2021:20:33:14 -0500] "POST /xmlrpc.php HTTP/1.1" 200 160 "-" "Python-xmlrpc/3.9"
Nov 18 20:33:14	nginx		192.168.12.199 - wkearney [18/Nov/2021:20:33:14 -0500] "POST /xmlrpc.php HTTP/1.1" 200 160 "-" "Python-xmlrpc/3.9"
Nov 18 20:33:14	nginx		192.168.12.199 - wkearney [18/Nov/2021:20:33:14 -0500] "POST /xmlrpc.php HTTP/1.1" 200 160 "-" "Python-xmlrpc/3.9"
Nov 18 20:33:14	nginx		192.168.12.199 - wkearney [18/Nov/2021:20:33:14 -0500] "POST /xmlrpc.php HTTP/1.1" 200 160 "-" "Python-xmlrpc/3.9"
Nov 18 20:33:14	nginx		192.168.12.199 - wkearney [18/Nov/2021:20:33:14 -0500] "POST /xmlrpc.php HTTP/1.1" 200 160 "-" "Python-xmlrpc/3.9"

I'm willing to debug further, just tell me what to tweak. I'm new to using HA, so bear with me if I don't know the ins/outs of troubleshooting with it.

missing function openvpn_get_active_servers

On latest update TAG 3.1 i get an error on the pfsense related to missing function openvpn_get_active_servers

Crash report begins.  Anonymous machine information:

amd64
12.2-STABLE
FreeBSD 12.2-STABLE 1b709158e581(RELENG_2_5_0) pfSense

Crash report details:

PHP Errors:
[25-Dec-2021 10:40:02 Europe/Luxembourg] PHP Fatal error:  Uncaught Error: Call to undefined function openvpn_get_active_servers() in /usr/local/www/xmlrpc.php(145) : eval()'d code:54
Stack trace:
#0 /usr/local/www/xmlrpc.php(145): eval()
#1 /usr/local/share/pear/XML/RPC2/Server/CallHandler/Instance.php(141): pfsense_xmlrpc_server->exec_php('\nini_set('displ...')
#2 /usr/local/share/pear/XML/RPC2/Backend/Php/Server.php(135): XML_RPC2_Server_Callhandler_Instance->__call('pfsense.exec_ph...', Array)
#3 /usr/local/share/pear/XML/RPC2/Backend/Php/Server.php(99): XML_RPC2_Backend_Php_Server->getResponse()
#4 /usr/local/www/xmlrpc.php(883): XML_RPC2_Backend_Php_Server->handleCall()
#5 {main}
  thrown in /usr/local/www/xmlrpc.php(145) : eval()'d code on line 54



No FreeBSD crash data found.

No configuation options

I just installed this component (custom repository via HACS) and when I search the integrations list, it does not show. I can see it in the custom_components folder, so I believe I connected the repository and installed it correctly.

How to I activate this integration?

Issue: Everything goes unavailable

Home Assistant version: 2021.11.1 (Home Assistant Operating System)
Component version: Latest

Several times a minute, all entities from the pfsense component go unavailable. It seems like this is only happening when I use one of the switches to turn on/off a firewall rule but I can't be certain
Logbook shows this (note: it shows the same for all entities)

LAN: firewall_rule turned on
6:58:45 PM - 4 minutes ago
LAN: firewall_rule became unavailable
6:58:07 PM - 5 minutes ago
LAN: firewall_rule turned on
6:57:27 PM - 5 minutes ago
LAN: firewall_rule turned off
6:55:59 PM - 7 minutes ago
LAN: firewall_rule became unavailable
6:55:55 PM - 7 minutes ago
LAN: firewall_rule turned off
6:55:15 PM - 8 minutes ago
LAN: firewall_rule became unavailable
6:55:11 PM - 8 minutes ago
LAN: firewall_rule turned on
6:49:51 PM - 13 minutes ago
LAN: firewall_rule became unavailable
6:49:47 PM - 13 minutes ago
LAN: firewall_rule turned on
6:43:52 PM - 19 minutes ago
LAN: firewall_rule became unavailable
6:43:17 PM - 20 minutes ago
LAN: firewall_rule turned on
6:35:43 PM - 27 minutes ago
LAN: firewall_rule became unavailable
6:35:03 PM - 28 minutes ago

For troubleshooting this issue, I have:

  • Increased System -> Advanced -> Max Processes to as high as 30 but it didn't seem to have any effect.
  • Confirmed firewall rules allow this traffic
  • Restarted Home Assistant
  • Restarted the router
  • Ensured the user I created had the 'System - HA node sync' permission and then tried with full admin permissions
  • Increased scan interval to 60 seconds
  • Ran continual ping tests, see results below (left is my PC, right is from the HA host
    image

Debug logs:

 18:38:14 DEBUG (MainThread) [custom_components.pfsense] Finished fetching pfSense state data in 5.329 seconds (success: True)
2021-11-07 18:38:50 DEBUG (MainThread) [custom_components.pfsense] Finished fetching pfSense state data in 5.925 seconds (success: True)
2021-11-07 18:39:26 DEBUG (MainThread) [custom_components.pfsense] Finished fetching pfSense state data in 6.019 seconds (success: True)
2021-11-07 18:40:02 DEBUG (MainThread) [custom_components.pfsense] Finished fetching pfSense state data in 6.439 seconds (success: True)
2021-11-07 18:40:37 DEBUG (MainThread) [custom_components.pfsense] Finished fetching pfSense state data in 5.122 seconds (success: True)
2021-11-07 18:41:12 DEBUG (MainThread) [custom_components.pfsense] Finished fetching pfSense state data in 5.169 seconds (success: True)
2021-11-07 18:41:47 DEBUG (MainThread) [custom_components.pfsense] Finished fetching pfSense state data in 5.410 seconds (success: True)
2021-11-07 18:42:24 DEBUG (MainThread) [custom_components.pfsense] Finished fetching pfSense state data in 7.120 seconds (success: True)
2021-11-07 18:43:00 DEBUG (MainThread) [custom_components.pfsense] Finished fetching pfSense state data in 6.950 seconds (success: True)
2021-11-07 18:43:09 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [139741298965040] The read operation timed out
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 185, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1495, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1530, in _execute_service
    await handler.job.target(service_call)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 213, in handle_service
    await self.hass.helpers.service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 667, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 863, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 704, in _handle_entity_call
    await result
  File "/config/custom_components/pfsense/switch.py", line 250, in async_turn_off
    await self.hass.async_add_executor_job(client.disable_filter_rule_by_tracker, tracker)
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/pfsense/pypfsense/__init__.py", line 163, in disable_filter_rule_by_tracker
    self._restore_config_section("filter", config["filter"])
  File "/config/custom_components/pfsense/pypfsense/__init__.py", line 53, in inner
    response = func(*args, **kwargs)
  File "/config/custom_components/pfsense/pypfsense/__init__.py", line 70, in _restore_config_section
    response = self._get_proxy().pfsense.restore_config_section(params, 60)
  File "/usr/local/lib/python3.9/xmlrpc/client.py", line 1116, in __call__
    return self.__send(self.__name, args)
  File "/usr/local/lib/python3.9/xmlrpc/client.py", line 1458, in __request
    response = self.__transport.request(
  File "/usr/local/lib/python3.9/xmlrpc/client.py", line 1160, in request
    return self.single_request(host, handler, request_body, verbose)
  File "/usr/local/lib/python3.9/xmlrpc/client.py", line 1173, in single_request
    resp = http_conn.getresponse()
  File "/usr/local/lib/python3.9/http/client.py", line 1371, in getresponse
    response.begin()
  File "/usr/local/lib/python3.9/http/client.py", line 319, in begin
    version, status, reason = self._read_status()
  File "/usr/local/lib/python3.9/http/client.py", line 280, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "/usr/local/lib/python3.9/socket.py", line 704, in readinto
    return self._sock.recv_into(b)
  File "/usr/local/lib/python3.9/ssl.py", line 1241, in recv_into
    return self.read(nbytes, buffer)
  File "/usr/local/lib/python3.9/ssl.py", line 1099, in read
    return self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out
2021-11-07 18:43:17 ERROR (MainThread) [custom_components.pfsense] Timeout fetching pfSense state data
2021-11-07 18:43:17 DEBUG (MainThread) [custom_components.pfsense] Finished fetching pfSense state data in 10.002 seconds (success: False)
2021-11-07 18:43:18 ERROR (MainThread) [homeassistant.core] Error executing service: <ServiceCall switch.turn_off (c:f479d0c743a0c126144d6fbd1237eb01): entity_id=['switch.router_filter_rule_1604272216_ha_lan_routevpn']>
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/core.py", line 1511, in catch_exceptions
    await coro_or_task
  File "/usr/src/homeassistant/homeassistant/core.py", line 1530, in _execute_service
    await handler.job.target(service_call)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 213, in handle_service
    await self.hass.helpers.service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 667, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 863, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 704, in _handle_entity_call
    await result
  File "/config/custom_components/pfsense/switch.py", line 251, in async_turn_off
    await self.coordinator.async_refresh()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 165, in async_refresh
    await self._async_refresh(log_failures=True)
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 265, in _async_refresh
    update_callback()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 325, in _handle_coordinator_update
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 486, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 538, in _async_write_ha_state
    if (icon := (entry and entry.icon) or self.icon) is not None:
  File "/config/custom_components/pfsense/sensor.py", line 427, in icon
    if property == "status" and self.native_value != "online":
  File "/config/custom_components/pfsense/sensor.py", line 437, in native_value
    value = gateway[property]
TypeError: 'NoneType' object is not subscriptable
2021-11-07 18:43:52 INFO (MainThread) [custom_components.pfsense] Fetching pfSense state data recovered
2021-11-07 18:43:52 DEBUG (MainThread) [custom_components.pfsense] Finished fetching pfSense state data in 5.462 seconds (success: True)
2021-11-07 18:43:52 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 134, in _handle_refresh_interval
    await self._async_refresh(log_failures=True, scheduled=True)
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 265, in _async_refresh
    update_callback()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 325, in _handle_coordinator_update
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 486, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 519, in _async_write_ha_state
    state = self._stringify_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 492, in _stringify_state
    if (state := self.state) is None:
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 273, in state
    value = self.native_value
  File "/config/custom_components/pfsense/sensor.py", line 437, in native_value
    value = gateway[property]
TypeError: 'NoneType' object is not subscriptable
2021-11-07 18:44:27 DEBUG (MainThread) [custom_components.pfsense] Finished fetching pfSense state data in 5.113 seconds (success: True)
2021-11-07 18:44:27 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 134, in _handle_refresh_interval
    await self._async_refresh(log_failures=True, scheduled=True)
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 265, in _async_refresh
    update_callback()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 325, in _handle_coordinator_update
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 486, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 519, in _async_write_ha_state
    state = self._stringify_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 492, in _stringify_state
    if (state := self.state) is None:
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 273, in state
    value = self.native_value
  File "/config/custom_components/pfsense/sensor.py", line 437, in native_value
    value = gateway[property]
TypeError: 'NoneType' object is not subscriptable
2021-11-07 18:45:02 DEBUG (MainThread) [custom_components.pfsense] Finished fetching pfSense state data in 5.220 seconds (success: True)
2021-11-07 18:45:02 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 134, in _handle_refresh_interval
    await self._async_refresh(log_failures=True, scheduled=True)
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 265, in _async_refresh
    update_callback()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 325, in _handle_coordinator_update
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 486, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 519, in _async_write_ha_state
    state = self._stringify_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 492, in _stringify_state
    if (state := self.state) is None:
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 273, in state
    value = self.native_value
  File "/config/custom_components/pfsense/sensor.py", line 437, in native_value
    value = gateway[property]
TypeError: 'NoneType' object is not subscriptable
2021-11-07 18:45:37 DEBUG (MainThread) [custom_components.pfsense] Finished fetching pfSense state data in 5.209 seconds (success: True)
2021-11-07 18:45:37 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 134, in _handle_refresh_interval
    await self._async_refresh(log_failures=True, scheduled=True)
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 265, in _async_refresh
    update_callback()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 325, in _handle_coordinator_update
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 486, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 519, in _async_write_ha_state
    state = self._stringify_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 492, in _stringify_state
    if (state := self.state) is None:
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 273, in state
    value = self.native_value
  File "/config/custom_components/pfsense/sensor.py", line 437, in native_value
    value = gateway[property]
TypeError: 'NoneType' object is not subscriptable
2021-11-07 18:46:12 DEBUG (MainThread) [custom_components.pfsense] Finished fetching pfSense state data in 5.075 seconds (success: True)
2021-11-07 18:46:12 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 134, in _handle_refresh_interval
    await self._async_refresh(log_failures=True, scheduled=True)
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 265, in _async_refresh
    update_callback()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 325, in _handle_coordinator_update
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 486, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 519, in _async_write_ha_state
    state = self._stringify_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 492, in _stringify_state
    if (state := self.state) is None:
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 273, in state
    value = self.native_value
  File "/config/custom_components/pfsense/sensor.py", line 437, in native_value
    value = gateway[property]
TypeError: 'NoneType' object is not subscriptable
2021-11-07 18:46:47 DEBUG (MainThread) [custom_components.pfsense] Finished fetching pfSense state data in 5.436 seconds (success: True)
2021-11-07 18:46:47 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 134, in _handle_refresh_interval
    await self._async_refresh(log_failures=True, scheduled=True)
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 265, in _async_refresh
    update_callback()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 325, in _handle_coordinator_update
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 486, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 519, in _async_write_ha_state
    state = self._stringify_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 492, in _stringify_state
    if (state := self.state) is None:
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 273, in state
    value = self.native_value
  File "/config/custom_components/pfsense/sensor.py", line 437, in native_value
    value = gateway[property]
TypeError: 'NoneType' object is not subscriptable
2021-11-07 18:47:22 DEBUG (MainThread) [custom_components.pfsense] Finished fetching pfSense state data in 5.095 seconds (success: True)
2021-11-07 18:47:22 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 134, in _handle_refresh_interval
    await self._async_refresh(log_failures=True, scheduled=True)
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 265, in _async_refresh
    update_callback()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 325, in _handle_coordinator_update
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 486, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 519, in _async_write_ha_state
    state = self._stringify_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 492, in _stringify_state
    if (state := self.state) is None:
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 273, in state
    value = self.native_value
  File "/config/custom_components/pfsense/sensor.py", line 437, in native_value
    value = gateway[property]
TypeError: 'NoneType' object is not subscriptable
2021-11-07 18:47:57 DEBUG (MainThread) [custom_components.pfsense] Finished fetching pfSense state data in 5.081 seconds (success: True)
2021-11-07 18:47:57 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 134, in _handle_refresh_interval
    await self._async_refresh(log_failures=True, scheduled=True)
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 265, in _async_refresh
    update_callback()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 325, in _handle_coordinator_update
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 486, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 519, in _async_write_ha_state
    state = self._stringify_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 492, in _stringify_state
    if (state := self.state) is None:
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 273, in state
    value = self.native_value
  File "/config/custom_components/pfsense/sensor.py", line 437, in native_value
    value = gateway[property]
TypeError: 'NoneType' object is not subscriptable
2021-11-07 18:48:32 DEBUG (MainThread) [custom_components.pfsense] Finished fetching pfSense state data in 5.276 seconds (success: True)
2021-11-07 18:48:32 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 134, in _handle_refresh_interval
    await self._async_refresh(log_failures=True, scheduled=True)
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 265, in _async_refresh
    update_callback()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 325, in _handle_coordinator_update
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 486, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 519, in _async_write_ha_state
    state = self._stringify_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 492, in _stringify_state
    if (state := self.state) is None:
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 273, in state
    value = self.native_value
  File "/config/custom_components/pfsense/sensor.py", line 437, in native_value
    value = gateway[property]
TypeError: 'NoneType' object is not subscriptable
2021-11-07 18:49:07 DEBUG (MainThread) [custom_components.pfsense] Finished fetching pfSense state data in 5.105 seconds (success: True)
2021-11-07 18:49:07 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 134, in _handle_refresh_interval
    await self._async_refresh(log_failures=True, scheduled=True)
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 265, in _async_refresh
    update_callback()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 325, in _handle_coordinator_update
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 486, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 519, in _async_write_ha_state
    state = self._stringify_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 492, in _stringify_state
    if (state := self.state) is None:
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 273, in state
    value = self.native_value
  File "/config/custom_components/pfsense/sensor.py", line 437, in native_value
    value = gateway[property]
TypeError: 'NoneType' object is not subscriptable

Login SSL Issue

Hi Folks,

Perhaps a bit of dumb question. But Yeah, eventually you can help.

I am already stuck on the initial setup of PfSense integration, choosing SSL and w/o SSL connect.
When running w/ SSL I do receive prompt "SSL Failure", so I changed to
When running w/o SSL I do receive "%key:common::config_flow::error::invalid_auth%"

The format of URL is actually straight forward ://(ip):(port)
Scheme running over https.

Reading network trace, Wireshark, I see Homeassistant exchanging the certificate but reporting "Alert" Unknown CA.

I assume I am not the only user discovering that obstacle. But Yeah, as said, I hope reported issue is not to dumb... .

Thanks for the help.

[FR] Get this baby in the HACS integrations!

Wow, this integration is awesome! I've been looking for something like this for a while and was using the telegraf plugin on pfsense, but it didn't quite have everything I wanted. This integration has exactly what I need.
With that said, you should get this published in the HACS store so that it is more easily discovered.

Errors in pfSense

Hi,

Great integration and was looking forward to this.
Now tested 0.1.0, 0.2.0 and 0.3.0 versions.

I pretty quick get problems with my pfSense, it gets unresponsive and cannot log in using the web interface.
Trying to log on gives me "502 Bad Gateway, nginx".
Often this can be solved by using SSH and select option “16. Restart PHP-FFM”.
But I am in the same situation after a while.

Any ideas?

//AseKarlsson

force release/renew interface

HI,
first thanks for your hard work here guys.

in ssh if we need to force release/renew interface ip specially those WANs configured as DHCP we just do

service dhclient restart interface_name

is this something can be done by this script? and if yes how?

Thanks

Error creating the integration

I am trying to install the latest version. This is what I am getting when I click on Submit:

image

Am I missing something? I am not using SSL.

Cannot be installed anymore - not via repository nor via add integration

Hi,
I just tried installing this but haven't been successful:

  • adding the repository in the add-on section returns an error "Invalid add-on repository" with following log entries:

22-03-23 12:38:21 INFO (MainThread) [supervisor.store.git] Cloning add-on https://github.com/travisghansen/hass-pfsense repository 22-03-23 12:38:21 ERROR (MainThread) [supervisor.store] https://github.com/travisghansen/hass-pfsense is not a valid add-on repository 22-03-23 12:38:21 INFO (MainThread) [supervisor.resolution.module] Create new issue IssueType.CORRUPT_REPOSITORY - ContextType.STORE / e71748ad 22-03-23 12:38:21 INFO (MainThread) [supervisor.resolution.module] Create new suggestion SuggestionType.EXECUTE_REMOVE - ContextType.STORE / e71748ad 22-03-23 12:38:22 WARNING (SyncWorker_4) [supervisor.store.data] No repository information exists at /data/addons/git/e71748ad 22-03-23 12:38:22 INFO (MainThread) [supervisor.store] Loading add-ons from store: 24 all - 0 new - 0 remove 22-03-23 12:38:22 INFO (MainThread) [supervisor.resolution.fixups.store_execute_remove] Remove invalid Store: e71748ad

  • looking for it in the list of integrations (as suggested in another issue) doesn't show it either (I did try a hard refresh & even an entire cache clean in multiple browsers)

image

I've updated to core-2022.3.6 and supervisor-2022.03.5 earlier today so perhaps that has something to do with it?

Thanks!

Please...

Sorry, not really an issue, but Please add a pay link or buy me a coffee or something.
This is fantastic and I've been looking for something like it for years. My nmap only gave me 3 entities.

Add something to your readme so I can say THANK YOU properly...

Also I want to do a video about this on my YT page and want to suggest that folks also drop you some thank-you's.

ZeroDivisionError: division by zero

PfSense 21.05 running on NetGate SG-3100
Was working fine for a few days and then started throwing this error message. Once this happens all entities become unavailable.

Unexpected error fetching rt01.home pfSense state data: division by zero
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 191, in _async_refresh
    self.data = await self._async_update_data()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 150, in _async_update_data
    return await self.update_method()
  File "/config/custom_components/pfsense/__init__.py", line 95, in async_update_data
    await hass.async_add_executor_job(lambda: data.update())
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/pfsense/__init__.py", line 95, in <lambda>
    await hass.async_add_executor_job(lambda: data.update())
  File "/config/custom_components/pfsense/__init__.py", line 367, in update
    ((total_change - idle_change) / total_change) * 100
ZeroDivisionError: division by zero

I temporarily modified line 367 to get the actual values of total_change and idle_change individually within the CPU Usage entity value
total_change = 0
idle_change = 7451

The total_change value of 0 explains the error, but I am not sure if this is expected. Any tips on further troubleshooting?

sensor.py assumes each interface has a media type

I was getting errors and no ping data because I had interfaces (OpenVPN on ovpnc2 and a disconnected opt interface) with no media type defined.

sensor.py line 482 was erroring out because interface[media] was null and didn't like to be used in an assignment.

For my local case, I simply removed "media" from the for attr list... figuring out how to trap the null exceeds my current Python skills.

[Feature request] Uncompatible with FreeBSD 12.3-PRERELEASE 2.6.0-DEVELOPMENT (amd64)

Hello,
amd64
12.3-PRERELEASE
FreeBSD 12.3-PRERELEASE devel-12-n226715-1de26c41319 pfSense

[IN PFSENSE] a lot of these PHP crashes:

Crash report details:

PHP Errors:
[13-Nov-2021 23:18:29 Europe/Vilnius] PHP Warning:  Use of undefined constant ifdescr - assumed 'ifdescr' (this will throw an Error in a future version of PHP) in /usr/local/www/xmlrpc.php(147) : eval()'d code on line 118
[13-Nov-2021 23:18:29 Europe/Vilnius] PHP Warning:  Use of undefined constant ifdescr - assumed 'ifdescr' (this will throw an Error in a future version of PHP) in /usr/local/www/xmlrpc.php(147) : eval()'d code on line 118
[13-Nov-2021 23:18:29 Europe/Vilnius] PHP Warning:  Use of undefined constant ifdescr - assumed 'ifdescr' (this will throw an Error in a future version of PHP) in /usr/local/www/xmlrpc.php(147) : eval()'d code on line 118
[13-Nov-2021 23:18:29 Europe/Vilnius] PHP Warning:  Use of undefined constant ifdescr - assumed 'ifdescr' (this will throw an Error in a future version of PHP) in /usr/local/www/xmlrpc.php(147) : eval()'d code on line 118
[13-Nov-2021 23:18:29 Europe/Vilnius] PHP Warning:  Use of undefined constant ifdescr - assumed 'ifdescr' (this will throw an Error in a future version of PHP) in /usr/local/www/xmlrpc.php(147) : eval()'d code on line 118
[13-Nov-2021 23:18:29 Europe/Vilnius] PHP Warning:  Cannot modify header information - headers already sent by (output started at /usr/local/www/xmlrpc.php(147) : eval()'d code:118) in /usr/local/share/pear/XML/RPC2/Backend/Php/Server.php on line 100
[13-Nov-2021 23:18:29 Europe/Vilnius] PHP Warning:  Cannot modify header information - headers already sent by (output started at /usr/local/www/xmlrpc.php(147) : eval()'d code:118) in /usr/local/share/pear/XML/RPC2/Backend/Php/Server.php on line 101
[13-Nov-2021 23:18:29 Europe/Vilnius] PHP Warning:  Use of undefined constant ifdescr - assumed 'ifdescr' (this will throw an Error in a future version of PHP) in /usr/local/www/xmlrpc.php(147) : eval()'d code on line 118
[13-Nov-2021 23:18:29 Europe/Vilnius] PHP Warning:  Use of undefined constant ifdescr - assumed 'ifdescr' (this will throw an Error in a future version of PHP) in /usr/local/www/xmlrpc.php(147) : eval()'d code on line 118
[13-Nov-2021 23:18:29 Europe/Vilnius] PHP Warning:  Use of undefined constant ifdescr - assumed 'ifdescr' (this will throw an Error in a future version of PHP) in /usr/local/www/xmlrpc.php(147) : eval()'d code on line 118
[13-Nov-2021 23:18:29 Europe/Vilnius] PHP Warning:  Use of undefined constant ifdescr - assumed 'ifdescr' (this will throw an Error in a future version of PHP) in /usr/local/www/xmlrpc.php(147) : eval()'d code on line 118
[13-Nov-2021 23:18:29 Europe/Vilnius] PHP Warning:  Use of undefined constant ifdescr - assumed 'ifdescr' (this will throw an Error in a future version of PHP) in /usr/local/www/xmlrpc.php(147) : eval()'d code on line 118
[13-Nov-2021 23:18:29 Europe/Vilnius] PHP Warning:  Cannot modify header information - headers already sent by (output started at /usr/local/www/xmlrpc.php(147) : eval()'d code:118) in /usr/local/share/pear/XML/RPC2/Backend/Php/Server.php on line 100
[13-Nov-2021 23:18:29 Europe/Vilnius] PHP Warning:  Cannot modify header information - headers already sent by (output started at /usr/local/www/xmlrpc.php(147) : eval()'d code:118) in /usr/local/share/pear/XML/RPC2/Backend/Php/Server.php on line 101
[13-Nov-2021 23:18:29 Europe/Vilnius] PHP Warning:  Use of undefined constant ifdescr - assumed 'ifdescr' (this will throw an Error in a future version of PHP) in /usr/local/www/xmlrpc.php(147) : eval()'d code on line 118
[13-Nov-2021 23:18:29 Europe/Vilnius] PHP Warning:  Use of undefined constant ifdescr - assumed 'ifdescr' (this will throw an Error in a future version of PHP) in /usr/local/www/xmlrpc.php(147) : eval()'d code on line 118
[13-Nov-2021 23:18:29 Europe/Vilnius] PHP Warning:  Use of undefined constant ifdescr - assumed 'ifdescr' (this will throw an Error in a future version of PHP) in /usr/local/www/xmlrpc.php(147) : eval()'d code on line 118
[13-Nov-2021 23:18:29 Europe/Vilnius] PHP Warning:  Use of undefined constant ifdescr - assumed 'ifdescr' (this will throw an Error in a future version of PHP) in /usr/local/www/xmlrpc.php(147) : eval()'d code on line 118
[13-Nov-2021 23:18:29 Europe/Vilnius] PHP Warning:  Use of undefined constant ifdescr - assumed 'ifdescr' (this will throw an Error in a future version of PHP) in /usr/local/www/xmlrpc.php(147) : eval()'d code on line 118
[13-Nov-2021 23:18:29 Europe/Vilnius] PHP Warning:  Cannot modify header information - headers already sent by (output started at /usr/local/www/xmlrpc.php(147) : eval()'d code:118) in /usr/local/share/pear/XML/RPC2/Backend/Php/Server.php on line 100
[13-Nov-2021 23:18:29 Europe/Vilnius] PHP Warning:  Cannot modify header information - headers already sent by (output started at /usr/local/www/xmlrpc.php(147) : eval()'d code:118) in /usr/local/share/pear/XML/RPC2/Backend/Php/Server.php on line 101
[13-Nov-2021 23:19:49 Europe/Vilnius] PHP Warning:  Use of undefined constant ifdescr - assumed 'ifdescr' (this will throw an Error in a future version of PHP) in /usr/local/www/xmlrpc.php(147) : eval()'d code on line 118
[13-Nov-2021 23:19:49 Europe/Vilnius] PHP Warning:  Use of undefined constant ifdescr - assumed 'ifdescr' (this will throw an Error in a future version of PHP) in /usr/local/www/xmlrpc.php(147) : eval()'d code on line 118
[13-Nov-2021 23:19:49 Europe/Vilnius] PHP Warning:  Use of undefined constant ifdescr - assumed 'ifdescr' (this will throw an Error in a future version of PHP) in /usr/local/www/xmlrpc.php(147) : eval()'d code on line 118
[13-Nov-2021 23:19:49 Europe/Vilnius] PHP Warning:  Use of undefined constant ifdescr - assumed 'ifdescr' (this will throw an Error in a future version of PHP) in /usr/local/www/xmlrpc.php(147) : eval()'d code on line 118
[13-Nov-2021 23:19:49 Europe/Vilnius] PHP Warning:  Use of undefined constant ifdescr - assumed 'ifdescr' (this will throw an Error in a future version of PHP) in /usr/local/www/xmlrpc.php(147) : eval()'d code on line 118
[13-Nov-2021 23:19:49 Europe/Vilnius] PHP Warning:  Cannot modify header information - headers already sent by (output started at /usr/local/www/xmlrpc.php(147) : eval()'d code:118) in /usr/local/share/pear/XML/RPC2/Backend/Php/Server.php on line 100
[13-Nov-2021 23:19:49 Europe/Vilnius] PHP Warning:  Cannot modify header information - headers already sent by (output started at /usr/local/www/xmlrpc.php(147) : eval()'d code:118) in /usr/local/share/pear/XML/RPC2/Backend/Php/Server.php on line 101
[13-Nov-2021 23:19:49 Europe/Vilnius] PHP Warning:  Use of undefined constant ifdescr - assumed 'ifdescr' (this will throw an Error in a future version of PHP) in /usr/local/www/xmlrpc.php(147) : eval()'d code on line 118
[13-Nov-2021 23:19:49 Europe/Vilnius] PHP Warning:  Use of undefined constant ifdescr - assumed 'ifdescr' (this will throw an Error in a future version of PHP) in /usr/local/www/xmlrpc.php(147) : eval()'d code on line 118
[13-Nov-2021 23:19:49 Europe/Vilnius] PHP Warning:  Use of undefined constant ifdescr - assumed 'ifdescr' (this will throw an Error in a future version of PHP) in /usr/local/www/xmlrpc.php(147) : eval()'d code on line 118
[13-Nov-2021 23:19:49 Europe/Vilnius] PHP Warning:  Use of undefined constant ifdescr - assumed 'ifdescr' (this will throw an Error in a future version of PHP) in /usr/local/www/xmlrpc.php(147) : eval()'d code on line 118
[13-Nov-2021 23:19:49 Europe/Vilnius] PHP Warning:  Use of undefined constant ifdescr - assumed 'ifdescr' (this will throw an Error in a future version of PHP) in /usr/local/www/xmlrpc.php(147) : eval()'d code on line 118
[13-Nov-2021 23:19:49 Europe/Vilnius] PHP Warning:  Cannot modify header information - headers already sent by (output started at /usr/local/www/xmlrpc.php(147) : eval()'d code:118) in /usr/local/share/pear/XML/RPC2/Backend/Php/Server.php on line 100
[13-Nov-2021 23:19:49 Europe/Vilnius] PHP Warning:  Cannot modify header information - headers already sent by (output started at /usr/local/www/xmlrpc.php(147) : eval()'d code:118) in /usr/local/share/pear/XML/RPC2/Backend/Php/Server.php on line 101
[13-Nov-2021 23:19:49 Europe/Vilnius] PHP Warning:  Use of undefined constant ifdescr - assumed 'ifdescr' (this will throw an Error in a future version of PHP) in /usr/local/www/xmlrpc.php(147) : eval()'d code on line 118
[13-Nov-2021 23:19:49 Europe/Vilnius] PHP Warning:  Use of undefined constant ifdescr - assumed 'ifdescr' (this will throw an Error in a future version of PHP) in /usr/local/www/xmlrpc.php(147) : eval()'d code on line 118
[13-Nov-2021 23:19:49 Europe/Vilnius] PHP Warning:  Use of undefined constant ifdescr - assumed 'ifdescr' (this will throw an Error in a future version of PHP) in /usr/local/www/xmlrpc.php(147) : eval()'d code on line 118
[13-Nov-2021 23:19:49 Europe/Vilnius] PHP Warning:  Use of undefined constant ifdescr - assumed 'ifdescr' (this will throw an Error in a future version of PHP) in /usr/local/www/xmlrpc.php(147) : eval()'d code on line 118
[13-Nov-2021 23:19:49 Europe/Vilnius] PHP Warning:  Use of undefined constant ifdescr - assumed 'ifdescr' (this will throw an Error in a future version of PHP) in /usr/local/www/xmlrpc.php(147) : eval()'d code on line 118
[13-Nov-2021 23:19:49 Europe/Vilnius] PHP Warning:  Cannot modify header information - headers already sent by (output started at /usr/local/www/xmlrpc.php(147) : eval()'d code:118) in /usr/local/share/pear/XML/RPC2/Backend/Php/Server.php on line 100
[13-Nov-2021 23:19:49 Europe/Vilnius] PHP Warning:  Cannot modify header information - headers already sent by (output started at /usr/local/www/xmlrpc.php(147) : eval()'d code:118) in /usr/local/share/pear/XML/RPC2/Backend/Php/Server.php on line 101

[IN HA] see these:

2021-11-14 00:14:49 ERROR (MainThread) [custom_components.pfsense] Unexpected error fetching firewall.custom.ua pfSense state data: syntax error: line 2, column 0
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 187, in _async_refresh
    self.data = await self._async_update_data()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 147, in _async_update_data
    return await self.update_method()
  File "/config/custom_components/pfsense/__init__.py", line 94, in async_update_data
    await hass.async_add_executor_job(lambda: data.update())
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/pfsense/__init__.py", line 94, in 
    await hass.async_add_executor_job(lambda: data.update())
  File "/config/custom_components/pfsense/__init__.py", line 248, in update
    self._state["telemetry"] = self._get_telemetry()
  File "/config/custom_components/pfsense/__init__.py", line 224, in _get_telemetry
    return self._client.get_telemetry()
  File "/config/custom_components/pfsense/pypfsense/__init__.py", line 776, in get_telemetry
    data = self._exec_php(script)
  File "/config/custom_components/pfsense/pypfsense/__init__.py", line 58, in inner
    response = func(*args, **kwargs)
  File "/config/custom_components/pfsense/pypfsense/__init__.py", line 78, in _exec_php
    return self._get_proxy().pfsense.exec_php(script)
  File "/usr/local/lib/python3.9/xmlrpc/client.py", line 1116, in __call__
    return self.__send(self.__name, args)
  File "/usr/local/lib/python3.9/xmlrpc/client.py", line 1458, in __request
    response = self.__transport.request(
  File "/usr/local/lib/python3.9/xmlrpc/client.py", line 1160, in request
    return self.single_request(host, handler, request_body, verbose)
  File "/usr/local/lib/python3.9/xmlrpc/client.py", line 1176, in single_request
    return self.parse_response(resp)
  File "/usr/local/lib/python3.9/xmlrpc/client.py", line 1342, in parse_response
    p.feed(data)
  File "/usr/local/lib/python3.9/xmlrpc/client.py", line 445, in feed
    self._parser.Parse(data, False)
xml.parsers.expat.ExpatError: syntax error: line 2, column 0

Nice Job!

Very good integration,
Now I can toggle some fire rule from HA!!!

No Issues, just feedback.

First, wow... This is great! I always hoped for a pfSense integration, but after not finding an API, gave up. I never knew about the XMLRPC stuff. So, Thanks!

  1. Is CPU utilization available? (Instead of just load).

  2. Could there be an option to make the integration read-only during config flow? I realize the switches are disabled by default, but they could easily be enabled by a bad actor if my publicly reachable HA instance was breached somehow. If the switches were never created during config flow, the pw would be required to make changes to the integration.

Fortunately, my firewall rules are all "allow" type, so a bad actor could only make things more restrictive by turning them off. But, I'm sure not all people are configured that way. Just a thought, perhaps being paranoid.

  1. Is there access to any of the data from installed packages?

Thanks again!

Timeout fetching pfSense state data

I'm getting this error for some time already.
HA v 2021.12.2
HACS 1.18.0
pfSense integration 0.3.1
pfSense 2.5.2

This error originated from a custom integration.

Logger: custom_components.pfsense
Source: helpers/update_coordinator.py:193
Integration: pfSense (documentation, issues)
First occurred: 1:01:21 PM (2 occurrences)
Last logged: 1:30:06 PM

Timeout fetching RTR01 pfSense state data 

Feature request: service/switch to change default gateways

First off thanks for making a great pfSense Home Assistant integration!

For my use-case It would be nice if I could have Home Assistant change pfSense's default gateways (IPv4 & IPv6).
I think this could be implemented as either a service call or a switch/toggle.

Feature Request: Interface Duplex Attribute

Thank you for the excellent integration! I am wondering if it is possible to add the current media/duplex of interfaces as an attribute to the interface sensors? I am hoping this is possible with xmlrpc, but I am not knowledgeable on this feature to know if it is possible.

Screenshot 2022-02-18 131143
tempsnip

My use case for this would be to set up a template sensor in HA for if the duplex changes to anything from full duplex. I have the unfortunate issue where my WAN interface, very occasionally and silently, drops to 100baseTX and requires me to reseat the cable between modem and router. However, I don't usually realize this until streaming a movie and it buffers. Checking this issue is usually the last thing I think of 😅. It is a long run and replacing, and further troubleshooting, is not worth it yet, given the infrequency of the issue. But an alert from HA would be perfect!

Error, Timeout

I get this error when trying to get signed in.
pfsense: 2.5.1
HA: 2021.11.5

Logger: aiohttp.server
Source: custom_components/pfsense/pypfsense/init.py:91

Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/aiohttp/web_protocol.py", line 422, in _handle_request
resp = await self._request_handler(request)
File "/usr/local/lib/python3.9/site-packages/aiohttp/web_app.py", line 499, in _handle
resp = await handler(request)
File "/usr/local/lib/python3.9/site-packages/aiohttp/web_middlewares.py", line 119, in impl
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 98, in forwarded_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 24, in request_context_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 78, in ban_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 138, in auth_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 135, in handle
result = await result
File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 215, in post
return await super().post(request, flow_id)
File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 62, in wrapper
result = await method(view, request, *args, **kwargs)
File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 110, in post
result = await self._flow_mgr.async_configure(flow_id, data)
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 246, in async_configure
result = await self._async_handle_step(flow, cur_step["step_id"], user_input)
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 320, in _async_handle_step
result: FlowResult = await getattr(flow, method)(user_input)
File "/config/custom_components/pfsense/config_flow.py", line 195, in async_step_init
return await self.async_step_device_tracker()
File "/config/custom_components/pfsense/config_flow.py", line 231, in async_step_device_tracker
arp_table := await self.hass.async_add_executor_job(
File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/pfsense/pypfsense/init.py", line 284, in get_arp_table
response = self._exec_php(script)
File "/config/custom_components/pfsense/pypfsense/init.py", line 58, in inner
response = func(*args, **kwargs)
File "/config/custom_components/pfsense/pypfsense/init.py", line 91, in _exec_php
response = self._get_proxy().pfsense.exec_php(script)
File "/usr/local/lib/python3.9/xmlrpc/client.py", line 1116, in call
return self.__send(self.__name, args)
File "/usr/local/lib/python3.9/xmlrpc/client.py", line 1458, in __request
response = self.__transport.request(
File "/usr/local/lib/python3.9/xmlrpc/client.py", line 1160, in request
return self.single_request(host, handler, request_body, verbose)
File "/usr/local/lib/python3.9/xmlrpc/client.py", line 1173, in single_request
resp = http_conn.getresponse()
File "/usr/local/lib/python3.9/http/client.py", line 1371, in getresponse
response.begin()
File "/usr/local/lib/python3.9/http/client.py", line 319, in begin
version, status, reason = self._read_status()
File "/usr/local/lib/python3.9/http/client.py", line 280, in _read_status
line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
File "/usr/local/lib/python3.9/socket.py", line 704, in readinto
return self._sock.recv_into(b)
File "/usr/local/lib/python3.9/ssl.py", line 1241, in recv_into
return self.read(nbytes, buffer)
File "/usr/local/lib/python3.9/ssl.py", line 1099, in read
return self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out

Sensor to get OpenVPN client public IP address possible?

Thanks for work with this great integration!

I have a feature request.
When you run a OpenVPN server on your pfsense and a client connect to it, pfsense will show the client public ip address in the dashboard. Also the time connection was established show on the dashboard and would be nice to be an entity in HA.
I would like a sensor to monitor this ip address.
The purpose is to send me a notification if this address changes (ie if the client switch to connect to OpenVPN server using a failover connection).

Have tried using SNMP, but did not find it possible because the oid is the client ipaddress itself and if it changes it is unknow for me.
oid 1.3.6.1.2.1.6.13.1.4.x.x.x.x.portx.y.y.y.y.porty = "y.y.y.y"
i.e: 1.3.6.1.2.1.6.13.1.4.10.11.12.13.1142.63.64.65.66.42000 = "63.64.65.66"

x.x.x.x is local wan address.
y.y.y.y is client public ip address.

So I was looking for a way to detect this address as an entity in HA and send me a notification if changes is detected.

I am unknown to xmlrpc so can not really tell if this is possible.

Feature request

Hi,

Would be good to add sensors for the status of IPSec VPNs. P1 and P2 statuses, bytes/packets in/out.

Thanks,
Kev

Integration not showing up after installing

Hi,

I installed the Hass-Pfsense integration in HACS. But after restarting the server I don't see the integration anywhere.
In the readme it says 'Configuration is managed entirely from the UI using config_flow semantics.' so i expected the integration under configuration->Integrations.
Also when i try to add in manually it can't find it in the list.

I checked the log of Home assistant and the only event with a reference to pfSense is this:
2021-10-21 16:31:12 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration pfsense which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant

Login Issue

I've tried setting up the connection between pfSense and Home Assistant, but can't seem to get it to connect. I've set up the connection with https://192.168.1.1, with verify SSL unchecked and I get the following error on pfSense:

PHP ERROR: Type: 1, File: /usr/local/www/xmlrpc.php(141) : eval()'d code, Line: 6, Message: Uncaught Error: Call to undefined function system_get_dhcpleases() in /usr/local/www/xmlrpc.php(141) : eval()'d code:6
Stack trace:
#0 /usr/local/www/xmlrpc.php(141): eval()
#1 /usr/local/share/pear/XML/RPC2/Server/CallHandler/Instance.php(141): pfsense_xmlrpc_server->exec_php('\nini_set('displ...')
#2 /usr/local/share/pear/XML/RPC2/Backend/Php/Server.php(135): XML_RPC2_Server_Callhandler_Instance->__call('pfsense.exec_ph...', Array)
#3 /usr/local/share/pear/XML/RPC2/Backend/Php/Server.php(99): XML_RPC2_Backend_Php_Server->getResponse()
#4 /usr/local/www/xmlrpc.php(771): XML_RPC2_Backend_Php_Server->handleCall()
#5 {main}

Here is the log on Home Assistant:
2022-06-04 09:32:15 ERROR (MainThread) [custom_components.pfsense] Unexpected error fetching pfSense pfSense state data: <ProtocolError for user:[email protected]/xmlrpc.php: 500 Internal Server Error>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.