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
Fibaro components #18487
Fibaro components #18487
Conversation
Added cover, light, sensor and switch components
Improvements based on code review
Just a note, it is probably better to create individual PRs for each of the platforms. That way smaller parts can get approved and merged faster without a single person having to read, understand and approve all of it. That said, I think you should keep this PR now as it is not huge and review has already started. |
Thanks Anders, I understand. My thining process was that it might be less work per PR for a reviewer, but overall, it'll take more effort to review it split into 4 PRs. I felt that at this total lines it might be more efficient to go in PR, knowing full well, that this might be discouraging some reviewers, but hoping to reduce the total effort needed. In the future I'll try to cut it into even smaller pieces. |
Ooops, clicked the wrong button when commenting :-( and I accidentally closed it... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks mostly good.
The thresholds in the light platform seem strange and complicate things. Is there some hardware reason that these are needed?
Hi @pbalogh77, I am using quite a lot of the Fibaro roller shutters and switches with HA, but I am still quite uneducated about HA source code. Thanks a lot for your efforts! Andre |
Hi Andre, It adds support for Fibaro Home Center hubs, so instead of connecting the Z-wave devices to your HA with a Z-wave stick, you can now use the Fibaro hub and integrate that. The reason for this is that while HA is great, Fibaro HC2 is rock solid and has some features specific to it. I also believe that HA is best at integrating hubs, e.g. not taking over the responsibility of everything, just combining functionality on a higher level. Also, this way I can have the fibaro app as a fall-back if HA stops or crashes to still get into my home :-) In this way, I think HA can be used as a alternative UI for Fibaro hub users too. Cheers, |
Fixes based on code review
Ah, understand! I am using HA without the Fibaro home center so far, and it works quite well. I will keep this in mind though. Thanks! |
Changes to light behavior based on code review
Changed how brightness is represented internally. It should have no impact on functionality.
Let's merge this (when the build passes) so the new Fibaro component is complete when it gets released. @pbalogh77 has promised in chat to add documentation soon. |
|
||
def turn_on(self, **kwargs): | ||
"""Turn the light on.""" | ||
with self._update_lock: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could block threads in the thread pool. That's not allowed. A non blocking acquire could work. What are we trying to protect?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issue I'm trying to solve is that while we're still executing the turn_on command, another thread is receiving notifications from the fibaro hub and processing them, e.g. there can be calls to the update function. Which can mess up the data a bit and cause some havoc. This is especially troubling in the case of a turned off colored light, which has to issue two consecutive rest api calls to the fibaro hub, both of them resulting one or multiple status updates from the fibaro hub. Since neither function has infinite loops and only of them has actual IO, I don't see how it could lock up a thread permanently, but I'm very open to other ideas of solving this race condition.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The race is real, I had the same issue with LIFX. I am not sure how to best solve it for a threaded platform. As is, I guess it could get ugly if the hub gets unavailable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this should become async_turn_on
and Fibaro needs to maintain an async lock. We can't solve this on the Home Assistant level as we don't know exactly how the resources need to be treated that need locking (is it per device, per hub etc).
I’ll do a judgement call and merge this so it makes the beta along with the remaining Fibaro news. I am confident that @pbalogh77 is willing to address the concern that Martin raised in a separate PR, in time for the final release. |
Good call 👍 |
I am stoked. I think that Fibaro has done a great job building a stable Z-Wave platform, with support for their hub, we will be accessible to a new group of people. |
will there be support for the thermostats in the near future? |
If you want to suggest an enhancement please open a feature request in the Feature Requests section of our community forum. Merged PRs should not be used for enhancement discussion. Thanks! |
Description:
Adds cover, light, sensor and switch support to the Fibaro component
Related issue (if applicable): fixes #
Pull request in home-assistant.io with documentation (if applicable): home-assistant/home-assistant.io#<home-assistant.io PR number goes here>
Example entry for
configuration.yaml
(if applicable):Checklist:
tox
. Your PR cannot be merged unless tests passIf user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
REQUIREMENTS
variable (example).requirements_all.txt
by runningscript/gen_requirements_all.py
..coveragerc
.If the code does not interact with devices: