-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
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
Add support for Tikteck Bluetooth bulbs #4843
Conversation
@mjg59, thanks for your PR! By analyzing the history of the files in this pull request, we identified @balloob, @fabaff and @robbiet480 to be potential reviewers. |
self._bulb = tikteck.tikteck(self._address, "Smart Light", | ||
self._password) | ||
self._bulb.connect() | ||
except Exception as e: |
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.
lint is unhappy with this, but I'm not sure what the best thing to do here is. The protocol code will raise a BTException, and handling that would mean pulling in the underlying Bluetooth implementation which really ought to be abstracted (I've already changed implementation in this code). The alternative would be to push the retry code down to the protocol implementation? In this case I'm upstream so can do that, but there may be other Bluetooth backed devices that don't handle reconnect.
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.
You are correct that we don't want to get caught dealing with the implementation details of the lib. The cleanest approach would be to have the lib wrap the exception with it's own error type.
self._bulb = tikteck.tikteck(self._address, "Smart Light", | ||
self._password) | ||
self._bulb.connect() | ||
except Exception as e: |
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.
You are correct that we don't want to get caught dealing with the implementation details of the lib. The cleanest approach would be to have the lib wrap the exception with it's own error type.
self._state = False | ||
self.set_state(0, 0, 0, 0) | ||
|
||
def update(self): |
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.
If there is no update method, you can remove it. It will default to be a no-op. In that case you also should also:
- Add property
should_poll
that returnsFalse
- Add property
assumed_state
that returnsTrue
- Add
self.schedule_update_ha_state()
at the end ofturn_on
andturn_off
self.is_valid = True | ||
self._bulb = tikteck.tikteck(self._address, "Smart Light", | ||
self._password) | ||
if self._bulb.connect() == False: |
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.
comparison to False should be 'if cond is False:' or 'if not cond:'
https://home-assistant.io/components/light.tikteck/ | ||
""" | ||
import logging | ||
import time |
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.
'time' imported but unused
853a89a
to
c584f56
Compare
Adds support for the Tikteck RGBW BLE bulbs. These don't provide "true" RGBW support - at a certain point in RGB space, the white LEDs turn on. Each bulb has a specific key that needs to be extracted from the Android app.
Awesome! 🐬 |
Description:
Add support for Tikteck Smart Bluetooth Bulbs. These are RGBW bulbs available for $9.99 from the manufacturer, communicating over BTLE. Each bulb needs a key which can be extracted from the Android app.
Pull request in home-assistant.github.io with documentation (if applicable): home-assistant/home-assistant.io#1716
Example entry for
configuration.yaml
(if applicable):Checklist:
If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
tox
run successfully. Your PR cannot be merged unless tests passREQUIREMENTS
variable (example).requirements_all.txt
by runningscript/gen_requirements_all.py
..coveragerc
.If the code does not interact with devices:
tox
run successfully. Your PR cannot be merged unless tests pass