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

Home assistant connector #2874

Merged
merged 48 commits into from
Feb 26, 2024
Merged

Home assistant connector #2874

merged 48 commits into from
Feb 26, 2024

Conversation

mikhail5555
Copy link
Contributor

@mikhail5555 mikhail5555 commented Jan 11, 2024

Feature showcase video (high quality)
2024-01-13_13-38-58 (1)

ListView:
image

Edit Screen:
image

If you want me to remove the ci optimizations from this PR. Please let me know

--- Ignore this configuration for connectors.md
image
image
image

@mikhail5555 mikhail5555 marked this pull request as ready for review January 12, 2024 22:43
@vabene1111
Copy link
Collaborator

Thank you, as discuessed on discord I will review as soon as possible but it might take some time since this is a rather large change.

Just from looking at the images: You included homassistant in the UI, do you think that makes sense if the connectors should be usable for all kinds of integrations? Is it maybe preferable to name everything independently of the service.

@mikhail5555
Copy link
Contributor Author

mikhail5555 commented Jan 14, 2024

EDIT: OUTDATED

Based on your feedback i made a page where you can manage all integrations:
image

to keep "type safety" of each of the configs, the config classes are still created by themselves, but you can see the 'ExampleConfig' model which makes it trivial to add new integrations (aka just copy/paste whereever its used, and you are done)

@vabene1111 vabene1111 mentioned this pull request Jan 19, 2024
Copy link
Collaborator

@vabene1111 vabene1111 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok so finally had the time to review this. Overall I think everything looks good, I just added a few minor comments here and there.

One big thing for me though is that I do not understand the connector_manager.py (or generally the whole stack of how the signal is processed) ways of working very well or at least that whole async queue thing is something I have not used before. Do you think you could add, maybe directly in the file, a few lines of comments of how this thing works and how the queue is supposed to work (signal will trigger items to be added to the queue, the queue will run them in parallel or after another?!).
Maybe also a few links to the django docs if applicable or whatever you think might make it easier for me in 3 years to understand whats wrong when something breaks 😂

.github/workflows/ci.yml Outdated Show resolved Hide resolved
.gitignore Outdated Show resolved Hide resolved
cookbook/connectors/homeassistant.py Show resolved Hide resolved
cookbook/migrations/0209_connectorconfig.py Outdated Show resolved Hide resolved
cookbook/signals.py Outdated Show resolved Hide resolved
cookbook/views/api.py Outdated Show resolved Hide resolved
cookbook/views/new.py Outdated Show resolved Hide resolved
recipes/settings.py Outdated Show resolved Hide resolved
@mikhail5555
Copy link
Contributor Author

I added a decently extensive explanation at the top of the ConnectorManager on howit works and how it kinda works. If its still unclear I can hop into a voice call and walk you through if you want a quick explanation.

…umentation how to disable it. Add extra documentation
@mikhail5555
Copy link
Contributor Author

The multiprocessing was changed to threading because it was giving some un-explained child processes that pytest couldnt kill.

@vabene1111
Copy link
Collaborator

ok so final review is trough, I am happy with the state. Two final things

  1. please rebase the PR so I can merge it
  2. add the new environment variables to the environment docs

after that I will get it merged for the next release

…ctor

# Conflicts:
#	cookbook/views/api.py
#	recipes/settings.py
@vabene1111 vabene1111 merged commit c15bd66 into TandoorRecipes:develop Feb 26, 2024
2 of 3 checks passed
@pippo73
Copy link
Contributor

pippo73 commented Sep 13, 2024

Hello @vabene1111 , I've discovered this great feature, but it seems not working with my systems. :-(
Where should I have to open the issue? here or on HA. How can I test where is the problem? Could you help me ... anyone else is welcome too :-)

@mikhail5555
Copy link
Contributor Author

Hello @vabene1111 , I've discovered this great feature, but it seems not working with my systems. :-( Where should I have to open the issue? here or on HA. How can I test where is the problem? Could you help me ... anyone else is welcome too :-)

There was some issue being tracked in #3213, if you can follow those steps and create an issue with as much info/logs as possible

@mikhail5555
Copy link
Contributor Author

mikhail5555 commented Sep 17, 2024

There seems indeed to be some bug currently that this feature ONLY works with DEBUG=1 (I didnt have the DEBUG variable specified, so i assumed it fell back to false (0), but in fact the default value is true (1)).

@vabene1111
Copy link
Collaborator

haha I had some of those as well in the past, one pretty recently but I do not remember exactly what caused it. There are indeed a few functions in django that behave differently when running DEBUG=1 and also when testing with the dev server. I see you already got it sorted out, very nice!

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

Successfully merging this pull request may close these issues.

3 participants