hass-opnsense
hass-opnsense copied to clipboard
OPNsense 23.7.5 breaks addon
I have been using this addon for a while now, it is great (thanks). But today I upgraded opnsense to 23.7.5 and it no longer works. Trying to reconfigure the addon in home assistant (2023.9.3) gives me this error:
There are otherwise no errors in home assistant. I have redownloaded the addon and recreated the api keys but that does not solved the problem.
Similar error, but while configuring it for the first time, might be related: custom_components/opnsense/pyopnsense/init.py:100 Unexpected get_system_info error err=TypeError("string indices must be integers, not 'str'"), type(err)=<class 'TypeError'>
custom_components/opnsense/config_flow.py:148
Unexpected err=TypeError("string indices must be integers, not 'str'"), type(err)=<class 'TypeError'>
@leonardopc What do your logs say?
I am also experiencing this problem.
The integration still shows sensors related to the router's condition/performance, but my device trackers all show "Unavailable" and I am unable to configure more.
I have these two errors in my logs and I do not recall them being present before.
2023-10-19 09:06:00.311 ERROR (SyncWorker_19) [custom_components.opnsense] failed to retrieve arp table err=TimeoutError('The read operation timed out'), type(err)=<class 'TimeoutError'>```
I am also experiencing this problem.
The integration still shows sensors related to the router's condition/performance, but my device trackers all show "Unavailable" and I am unable to configure more.
I have these two errors in my logs and I do not recall them being present before.
2023-10-19 09:06:00.311 ERROR (SyncWorker_19) [custom_components.opnsense] failed to retrieve arp table err=TimeoutError('The read operation timed out'), type(err)=<class 'TimeoutError'>```
OK. I figured out my issue, I do not think it is the same as the previous two posters. I had deleted my DNS servers from my OPNSense configuration during a previous router troubleshooting session...forgot about it...and fixed it. This solved the problem I was experiencing with the HASS integration (as well as other issues I was seeing which led me to believe the integration was not at fault).
Same for me, but while configuring it for the first time:
Source: custom_components/opnsense/config_flow.py:148
Unexpected err=TypeError("string indices must be integers, not 'str'"), type(err)=<class 'TypeError'>
OPNsense: 23.7.8
HA: 2023.11.2
@travisghansen are there any logs we could provide, or beta versions we could test?
My logs are the same as @stmpl
12:36:22 – (ERROR) OPNsense (custom integration)
Unexpected err=TypeError("string indices must be integers, not 'str'"), type(err)=<class 'TypeError'>
12:36:22 – (ERROR) OPNsense (custom integration)
Unexpected get_system_info error err=TypeError("string indices must be integers, not 'str'"), type(err)=<class 'TypeError'>
HA: 2023.11.1 OPNsense: OPNsense 23.7.9-amd64, FreeBSD 13.2-RELEASE-p5, OpenSSL 1.1.1w
Thank you for a great plugin!
Same Error with HA
integration shows Error:
Logfile:
2024-03-06 18:20:28.995 ERROR (SyncWorker_24) [custom_components.opnsense.pyopnsense] Unexpected get_system_info error err=TypeError("string indices must be integers, not 'str'"), type(err)=<class 'TypeError'> 2024-03-06 18:20:28.997 ERROR (MainThread) [custom_components.opnsense.config_flow] Unexpected err=TypeError("string indices must be integers, not 'str'"), type(err)=<class 'TypeError'>
Any idea, how to fix this?
Thanks for the patience getting back to you. All of these are when attempting to configure the integration initially? You cannot even get it to load initially?
Come to say it works for me in 24.1.3 of OPNsense with Home Asisstant 2024.3.1
@travisghansen correct, steps to repro are:
- Add repo in HACS, install
- Click on "Add Integration" on the integrations page
- Enter host url, apio key, secret, and name.
- Observe error "Unexpected Error" and the
string indices must be integers, not 'str'"
error in the logs.
OPNSense: OPNsense 24.1.4-amd64 Home Assistant: 2024.3.1 hass-opnsense: v0.1.21
Hmm ok. That's pretty strange. The setup phase has very little interaction with the api :(
How could I help debug? Are there any other logs that would be helpful, or is there some way to increase verbose output?
Are there any logs on the opnsense side that provide some better info about what the error might be?
This error originated from a custom integration.
Logger: custom_components.opnsense.config_flow
Source: custom_components/opnsense/config_flow.py:149
integration: OPNsense (documentation, issues)
First occurred: 20:13:13 (1 occurrences)
Last logged: 20:13:13
Unexpected err=TypeError("string indices must be integers, not 'str'"), type(err)=<class 'TypeError'>
FWIW, If I try to enable the "verify ssl" flag, I get a correct error that the cert is self signed, so the connection to the server seems to be going through:
@travisghansen I did some light digging, and traced this down to the client.get_system_info
call. I can't really follow what you're doing with the pythonic php execution, but my guess is that the response at https://github.com/travisghansen/hass-opnsense/blob/main/custom_components/opnsense/pyopnsense/init.py#L268 is throwing the type error, perhaps coming from the json encode at https://github.com/travisghansen/hass-opnsense/blob/main/custom_components/opnsense/pyopnsense/init.py#L127
I can confirm that the address is getting dialed and the authentication is valid (tested via curl), so I'm guessing the object coming back from the php side of things isn't rendering into the dictionary the code expects.
Right, the question is why is that method failing? It's the most basic bits of code and should not be things that would be brittle :(
If you're comfortable doing some python dev you can clone this repo locally, setup a venv and manually use the xmlrpc client. Doing so would help us see the output better to determine what's blowing up.
Still a problem.
Latest HAOS/OPNsense, freshly generated api keys. It used to work before I updated OPNsense to ver. 24
Is there any update to this?
I just encountered the same issue after trying this plugin for the first time. I forked, added a stacktrace log, and found that there was an error being reported by my OPNSense about the os-homeassistant-maxit
install failing due to a versioning issue.
These steps fixed the issue for me:
- Update to OPNsense 24.1.8
- SSH'ed back in to OPNsense and re-ran
pkg install os-homeassistant-maxit