Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to add integreation. Unexpected error #73

Open
Curo18 opened this issue Nov 16, 2023 · 6 comments
Open

Unable to add integreation. Unexpected error #73

Curo18 opened this issue Nov 16, 2023 · 6 comments

Comments

@Curo18
Copy link

Curo18 commented Nov 16, 2023

Hi,
I have installed HA v.2023.11.2 using docker compose. When I try to add Vimar integration I got:

image

and looking at the log file I got:
...
2023-11-16 09:54:48.965 INFO (MainThread) [custom_components.vimar.vimarlink.vimarlink] Vimar link initialized
2023-11-16 09:54:55.231 ERROR (SyncWorker_7) [custom_components.vimar.vimarlink.vimarlink] HTTP timeout occurred

Could it be related to docker installation? This is my compose.yml

version: '3'

services:
homeassistant:
container_name: homeassistant
image: "ghcr.io/home-assistant/home-assistant:stable"
volumes:
- "/home/HomeAssistant:/config"
- "/etc/localtime:/etc/localtime:ro"
restart: unless-stopped
privileged: true
network_mode: host

Thanks for your great job!

@h4de5
Copy link
Owner

h4de5 commented Nov 16, 2023

if you access the ip and the port in the browser directly, does it work? and does it still work after you try to add it to home-assistant?

@Curo18
Copy link
Author

Curo18 commented Nov 16, 2023

I did some troubleshooting and these are the outcomes:

  1. Reset the Vimar Web Server (unplugged and plugged again from power source)

  2. I can reach the Vimar Web Server from the browser

  3. Run the example.py and I got the following:
    image

  4. I cannot reach anymore the Vimar Web Server from the browser. I have to reset it again.

I have quite a large number of devices so most likely is the same issue reported before #62

@h4de5
Copy link
Owner

h4de5 commented Nov 16, 2023

i thought so as well. there is a MAX_ROWS_PER_REQUEST in vimarlink.py which is currently set to 300.
I you can try to lower this. but if I remember correctly it was not about the number, but due to the complexity of the query that the crashed occured.
still you could try it

@Curo18
Copy link
Author

Curo18 commented Nov 17, 2023

I tried to lower MAX_ROWS_PER_REQUEST but I got the same result.
If is not viable to reduce the complexity of the queries, another possible solution could be to export the sql database from the VIMAR WEB SERVER and run the query on it to populate the VimarProject class. Then, the rest of the code to handle the devices should work. The only drawback is that you have to export the sql lite database every time you change something on the Vimar project.

Anyway, thanks for your time!!!

@h4de5
Copy link
Owner

h4de5 commented Nov 18, 2023

i am afraid the query will need to run regulary (like every HA restart) to initialize current on/off states.

you could try this: there is a get_room_id function which currently does not have a limit. in your log you should see how many rooms it can find. then add a limit to that query (LIMIT 0, 30) and try to do only half of your rooms to see if that would work.

@Curo18
Copy link
Author

Curo18 commented Nov 18, 2023

I followed your suggestion and set MAX_ROWS_PER_REQUEST = 5. Same result.
In case you want to investigate I have added some extra log data like the name of the function called and the query used by _generate_device_list function. I have attached the log file.
example.log

These are the messages showed on the console:

Config ready
Link ready
Project ready
Logged in
Traceback (most recent call last):
File "/home/HomeAssistant/custom_components/vimar/example/example.py", line 201, in
main()
File "/home/HomeAssistant/custom_components/vimar/example/example.py", line 137, in main
vimarproject.update()
File "/home/HomeAssistant/custom_components/vimar/example/vimarlink.py", line 821, in update
self._link.get_paged_results(self._link.get_room_devices, self._devices)
File "/home/HomeAssistant/custom_components/vimar/example/vimarlink.py", line 429, in get_paged_results
objectlist, state_count = method(objectlist, start, limit)
TypeError: cannot unpack non-iterable NoneType object

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants