Fix niko_home_control integration#23093
Conversation
5b14f05 to
36165aa
Compare
|
Can I get some assistance in getting the build green :-) Also, just want to make sure, the package I depend on has it's own dependencies, should these be listed in the manifests? |
36165aa to
3d4fc29
Compare
Codecov Report
@@ Coverage Diff @@
## dev #23093 +/- ##
==========================================
+ Coverage 93.95% 93.97% +0.01%
==========================================
Files 452 450 -2
Lines 36788 36878 +90
==========================================
+ Hits 34566 34656 +90
Misses 2222 2222
Continue to review full report at Codecov.
|
01887cc to
71e450e
Compare
|
You don't need specific other upstream lib, unless they are not pip-installed along with |
2573332 to
a5891d5
Compare
This comment has been minimized.
This comment has been minimized.
a5891d5 to
f3e6973
Compare
f3e6973 to
e751cc6
Compare
|
@awarecan I still have an issue where when I turn on a light, it takes a while for the state to be updated to the correct value. Should I be setting the state in the It looks kind of weird if you want to turn something on and off again you have to click it multiple times before it turns off. |
e751cc6 to
ef2c223
Compare
|
You can set state in turn_on/off method, if you enabled |
ef2c223 to
1e26e54
Compare
1e26e54 to
d8e294c
Compare
|
@awarecan Any way I can force a fetch after a state has changed in HA, I tried the |
|
|
b487ea6 to
8cfeb29
Compare
|
I'll focus on refactoring the underlying logic to provide a way to listen to the controller events on a later time. I first want my lights to turn on again. :-) |
302e30c to
2c29b75
Compare
Codecov Report
@@ Coverage Diff @@
## dev #23093 +/- ##
=========================================
- Coverage 94.15% 93.96% -0.2%
=========================================
Files 452 452
Lines 36809 36788 -21
=========================================
- Hits 34658 34567 -91
- Misses 2151 2221 +70
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## dev #23093 +/- ##
=========================================
- Coverage 94.15% 93.96% -0.2%
=========================================
Files 452 452
Lines 36809 36788 -21
=========================================
- Hits 34658 34567 -91
- Misses 2151 2221 +70
Continue to review full report at Codecov.
|
Update base library and only pull for state once.
2c29b75 to
d0821e3
Compare
|
@awarecan Anything else I should do before it can be merged? |
MartinHjelmare
left a comment
There was a problem hiding this comment.
Please open a new PR where we can address the comments.
|
|
||
| PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ | ||
| vol.Required(CONF_HOST): cv.string, | ||
| vol.Optional(CONF_SCAN_INTERVAL, default=SCAN_INTERVAL): cv.time_period, |
There was a problem hiding this comment.
This is already part of the base platform schema.
| self._state = None | ||
| self._state = light.is_on | ||
| self._brightness = None | ||
| _LOGGER.debug("Init new light: %s", light.name) |
There was a problem hiding this comment.
We try to avoid side effects in init method. Move the logging out of init.
| return self._unique_id | ||
|
|
||
| @property | ||
| def device_info(self): |
There was a problem hiding this comment.
device_info property is only read if the platform is loaded via config entry.
https://developers.home-assistant.io/docs/en/device_registry_index.html#defining-devices
| return self._state | ||
|
|
||
| def turn_on(self, **kwargs): | ||
| async def async_turn_on(self, **kwargs): |
There was a problem hiding this comment.
Why change to async api? The device library doesn't support asyncio.
|
|
||
| def get_state(self, aid): | ||
| """Find and filter state based on action id.""" | ||
| return next(filter(lambda a: a['id'] == aid, self.data))['value1'] != 0 |
There was a problem hiding this comment.
Don't use filter + lambda. Use a generator expression.
|
@MartinHjelmare I fixed your feedback in #23176 together with upgrading the library version to make sure it installs it's dependencies. |
Breaking Change:
No breaking changes
Description:
Update base library and only pull for state once.
Related issue: fixes #20005 and #19283
Pull request in home-assistant.io with documentation (if applicable): home-assistant/home-assistant.io#<home-assistant.io PR number goes here>
Checklist:
tox. Your PR cannot be merged unless tests passIf user exposed functionality or configuration variables are added/changed:
Documentation added/updated in home-assistant.ioIf the code communicates with devices, web services, or third-party tools:
requirementsin the manifest (example).requirements_all.txtby runningscript/gen_requirements_all.py.New files were added to.coveragerc.If the code does not interact with devices:
Tests have been added to verify that the new code works.