Closed bitcrumb closed 1 year ago
Have you tried restarting home assistant?
After rebooting this error still remains:
Logger: homeassistant.config_entries
Source: custom_components/loxone/api.py:1022
Integration: PyLoxone ([documentation](https://github.com/JoDehli/PyLoxone), [issues](https://github.com/JoDehli/PyLoxone/issues))
First occurred: 21:33:00 (2 occurrences)
Last logged: 21:34:23
Error setting up entry PyLoxone for loxone
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 382, in async_setup
result = await component.async_setup_entry(hass, self)
File "/config/custom_components/loxone/__init__.py", line 361, in async_setup_entry
res = await miniserver.start_ws()
File "/config/custom_components/loxone/miniserver.py", line 126, in start_ws
res = await self.api.async_init()
File "/config/custom_components/loxone/api.py", line 452, in async_init
res = await self.acquire_token()
File "/config/custom_components/loxone/api.py", line 708, in acquire_token
key_and_salt.read_user_salt_responce(message)
File "/config/custom_components/loxone/api.py", line 1022, in read_user_salt_responce
self.key = value["key"]
TypeError: string indices must be integers
Also note that certainly not all devices are reported by the integration (even though I mentioned that devices & entities are being imported). A lot of switches are missing for instance.
Have you tried to remove the pyloxone and install and setup again?
Yes, multiple times. The error keeps returning. Which seems logical, since it is an error while parsing the API response. And I set it up using the same config each time.
As I said:
I see that somebody else reported the same error in the past, but its unclear to me from the discussion if there was a solution?
Strange I use the same code on my miniserver.
Can you try to delete the toke file in the main config folder. It is the folder where your configuration yaml is normally. I do not exactly know how it is called it something with token in the naming.
It this does not work you can try (if you familiar with git) you can download the new branch I have created a view weeks ago and override the sources it the pyloxone install folder. Do you know what I mean?
This is the newest implementation which is completely different in the way how it is communicating with the Miniserver
I can not remember. Sorry. What port do you use. Please use not 80.
I can not remember. Sorry. What port do you use. Please use not 80.
I see... I did indeed configure with port 80.
This has to be the port of the web interface right or is this some other port?
Strange I use the same code on my miniserver.
Can you try to delete the toke file in the main config folder. It is the folder where your configuration yaml is normally. I do not exactly know how it is called it something with token in the naming.
It this does not work you can try (if you familiar with git) you can download the new branch I have created a view weeks ago and override the sources it the pyloxone install folder. Do you know what I mean?
This is the newest implementation which is completely different in the way how it is communicating with the Miniserver
I'll see what I can do, it's actually not my own setup, but the one from my brother. So I don't have unlimited access.
What I can also do: run my local Home Assistant development setup (I'm working on an integration myself) & debug from there by copying the custom_components/loxone
folder over. This way I might even be able to provide you with example API response.
I'll keep you posted.
Of course this would be great. It is always very difficult to help if I do not have access to the system.
The port is used also from the app. The integration uses the same API which the app uses. And by default it is 80. The actual integration was written for my system years ago and has some major limitations which I want to eliminate with the newest implementation. But is is not ready to release by now. So I would try the new branch when you debug it.
Thanks for the info, I'll see what I can do. I might find some time this evening.
Appreciate you replying this fast 🙏🏻
Had a quick look at what API call is executed. And it seems fairly simple?
The URL requested is: http://xxx/jdev/cfg/apiKey
with xxx being the hostname/ip.
Tried this out in my brower & this was the response:
{
"LL": {
"control": "dev/cfg/apiKey",
"value": "{'snr': 'XX:XX:XX:XX:XX:XX', 'version':'8.3.3.21', 'key':'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'}",
"Code": "200"
}
}
Seems to me that the issue here is that value
doesn't contain a proper JSON object, but rather a string containing JSON? So you could make this fail-safe by parsing it first if you detect that value
is a string?
Ot is this something that already happens? Didn't look through the code yet (or the new version of this integration), but wanted to let you know already :)
Strange I use the same code on my miniserver.
Can you try to delete the toke file in the main config folder. It is the folder where your configuration yaml is normally. I do not exactly know how it is called it something with token in the naming.
It this does not work you can try (if you familiar with git) you can download the new branch I have created a view weeks ago and override the sources it the pyloxone install folder. Do you know what I mean?
This is the newest implementation which is completely different in the way how it is communicating with the Miniserver
Hi there!
this is the brother -_-
Didn't find the token file you were talking about. Tried deleting and installing again, same problem. Only 7 devices and 7 entities...
@jevanhove you can try the new beta release. You can install it from HACS.
I close the issue and if you still have a problem you can reopen it.
Which Model do you use from loxone? Miniserver? Gen1 or Gen2?
Miniserver Gen1
Which software version does your loxone use?
How did you install HomeAssistant? Over Hassio oder manual install?
HassOS
Which Version do you use of HomeAssistant?
2023.1.4
Describe the bug
Errors happen after setting up the integration. Credentials are correct. Tried with local IP & duckdns.org as hostname.
Second error log seems to indicate that the API returns a string, where the code assumes an object (e.g. value['key']).
Not sure why "Config entry has already been setup" appears, since this error is shown after setting up the integration for the first time (and consecutive edits of the config as well).
❗️Note that the integration does seem to create devices & entities. But they are not functional.
Error log 1:
Error log2: