hass-opnsense: Cannot setup integration: Retrying setup:

I’m having problems setting up the integration.

I have followed the guide in the README.md file on how to setup this integration and after the first install it worked fine. I could turn on/off firewall rules from within Home-Assistant. This was about 14 days ago.

I’m not sure if it failed during change of IP of my opnsense box or an update to my opnsense.

But at the moment I cannot get the integration to work anymore. I have removed it the integration and reinstalled it and the same issue. I have also tried removing the plugin from opnsense and reinstall it.

The errors I get are as follow:

home-assistant logs:

Logger: custom_components.opnsense
Source: custom_components/opnsense/pyopnsense/__init__.py:112 
Integration: OPNsense ([documentation](https://github.com/travisghansen/hass-opnsense), [issues](https://github.com/travisghansen/hass-opnsense/issues)) 
First occurred: 14:12:35 (28 occurrences) 
Last logged: 14:33:49

Unexpected error fetching opnsense OPNsense state data: <ProtocolError for ***:***@***/xmlrpc.php: 500 Internal Server Error>
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 205, in _async_refresh
    self.data = await self._async_update_data()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 164, in _async_update_data
    return await self.update_method()
  File "/config/custom_components/opnsense/__init__.py", line 96, in async_update_data
    await hass.async_add_executor_job(lambda: data.update())
  File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/opnsense/__init__.py", line 96, in <lambda>
    await hass.async_add_executor_job(lambda: data.update())
  File "/config/custom_components/opnsense/__init__.py", line 318, in update
    self._state["carp_interfaces"] = self._get_carp_interfaces()
  File "/config/custom_components/opnsense/__init__.py", line 224, in inner
    response = func(*args, **kwargs)
  File "/config/custom_components/opnsense/__init__.py", line 267, in _get_carp_interfaces
    return self._client.get_carp_interfaces()
  File "/config/custom_components/opnsense/pyopnsense/__init__.py", line 634, in get_carp_interfaces
    response = self._exec_php(script)
  File "/config/custom_components/opnsense/pyopnsense/__init__.py", line 79, in inner
    response = func(*args, **kwargs)
  File "/config/custom_components/opnsense/pyopnsense/__init__.py", line 112, in _exec_php
    response = self._get_proxy().opnsense.exec_php(script)
  File "/usr/local/lib/python3.10/xmlrpc/client.py", line 1122, in __call__
    return self.__send(self.__name, args)
  File "/usr/local/lib/python3.10/xmlrpc/client.py", line 1464, in __request
    response = self.__transport.request(
  File "/usr/local/lib/python3.10/xmlrpc/client.py", line 1166, in request
    return self.single_request(host, handler, request_body, verbose)
  File "/usr/local/lib/python3.10/xmlrpc/client.py", line 1196, in single_request
    raise ProtocolError(
xmlrpc.client.ProtocolError: <ProtocolError for ***:***@***/xmlrpc.php: 500 Internal Server Error>

I have removed any reference to my API keys and IPs.

From the opnsense log, I get this error:

System Information:

User-Agent Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.0 Safari/605.1.15
FreeBSD 13.1-RELEASE-p2 stable/22.7-n250239-dde4437e8f2 SMP amd64
OPNsense 22.7.5 5d65a72c6
Plugins os-homeassistant-maxit-1.0 os-netdata-1.2 os-ntopng-1.2_1 os-redis-1.1_1 os-speedtest-community-0.9_3 os-theme-vicuna-1.41 os-wireguard-1.12 os-zerotier-1.3.2_3 
Time Thu, 06 Oct 2022 12:38:16 +0000
OpenSSL 1.1.1q  5 Jul 2022
Python 3.9.14
PHP 8.0.23
PHP Errors:

[06-Oct-2022 12:12:35 Etc/UTC] PHP Fatal error:  Uncaught TypeError: Cannot access offset of type string on string in /usr/local/etc/inc/xmlrpc/hass.inc(12) : eval()'d code:8
Stack trace:
#0 /usr/local/etc/inc/xmlrpc/hass.inc(12): eval()
#1 /usr/local/opnsense/contrib/IXR/IXR_Library.php(446): exec_php_xmlrpc('\nini_set('displ...')
#2 /usr/local/opnsense/contrib/IXR/IXR_Library.php(384): IXR_Server->call('opnsense.exec_p...', '\nini_set('displ...')
#3 /usr/local/opnsense/contrib/IXR/IXR_Library.php(357): IXR_Server->serve('__construct(Array)
#5 /usr/local/www/xmlrpc.php(104): XMLRPCServer->start()
#6 {main}
  thrown in /usr/local/etc/inc/xmlrpc/hass.inc(12) : eval()'d code on line 8
[06-Oct-2022 12:12:41 Etc/UTC] PHP Fatal error:  Uncaught TypeError: Cannot access offset of type string on string in /usr/local/etc/inc/xmlrpc/hass.inc(12) : eval()'d code:8
Stack trace:
#0 /usr/local/etc/inc/xmlrpc/hass.inc(12): eval()
#1 /usr/local/opnsense/contrib/IXR/IXR_Library.php(446): exec_php_xmlrpc('\nini_set('displ...')
#2 /usr/local/opnsense/contrib/IXR/IXR_Library.php(384): IXR_Server->call('opnsense.exec_p...', '\nini_set('displ...')
#3 /usr/local/opnsense/contrib/IXR/IXR_Library.php(357): IXR_Server->serve('__construct(Array)
#5 /usr/local/www/xmlrpc.php(104): XMLRPCServer->start()
#6 {main}
  thrown in /usr/local/etc/inc/xmlrpc/hass.inc(12) : eval()'d code on line 8

I have looked through the current open/close issues and could not find anything that matched my issue?

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 35 (7 by maintainers)

Most upvoted comments

Yes, working great now!

Today I even updated OPNsense via the HA GUI 😃

I removed the IP a day ago, and didn’t notice the problem on the integration. Today I noticed and remembered this conversation with Thomas and that he said he solved it by “cleaning” OPNsense config, etc.

So I remembered deleting the VIP, readded it and the integration immediately recovered. So I double-checked by removing the VIP again, and as soon as I did, integration failed again. Readded and it’s working fine since then.

So I’m 100% sure the two things are related.

Ok I’ll see if I can reproduce the issue. You just added the vip and then when you removed it the error showed up?

Travis, the problem is still there. I just removed the IP Alias and the integration failed with error. Readded the IP Alias and everything’s ok. Latest OPNsense and component versions.