-
-
Notifications
You must be signed in to change notification settings - Fork 32k
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
Initial hlk-sw16 relay switch support #17855
Conversation
Hi @jameshilliard, It seems you haven't yet signed a CLA. Please do so here. Once you do that we will be able to review and accept this pull request. Thanks! |
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.
Some files could not be reviewed due to errors:
Traceback (most recent call last):
Traceback (most recent call last): File "/home/linters/.local/bin/flake8", line 7, in from flake8.main.cli import main ModuleNotFoundError: No module named 'flake8'
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.
Some files could not be reviewed due to errors:
Traceback (most recent call last):
Traceback (most recent call last): File "/home/linters/.local/bin/flake8", line 7, in from flake8.main.cli import main ModuleNotFoundError: No module named 'flake8'
a08ccda
to
e733a3c
Compare
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.
Some files could not be reviewed due to errors:
Traceback (most recent call last):
Traceback (most recent call last): File "/home/linters/.local/bin/flake8", line 7, in from flake8.main.cli import main ModuleNotFoundError: No module named 'flake8'
e733a3c
to
8554aaa
Compare
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.
Some files could not be reviewed due to errors:
Traceback (most recent call last):
Traceback (most recent call last): File "/home/linters/.local/bin/flake8", line 7, in from flake8.main.cli import main ModuleNotFoundError: No module named 'flake8'
8554aaa
to
fa7246b
Compare
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.
Some files could not be reviewed due to errors:
Traceback (most recent call last):
Traceback (most recent call last): File "/home/linters/.local/bin/flake8", line 7, in from flake8.main.cli import main ModuleNotFoundError: No module named 'flake8'
fa7246b
to
f2ffd56
Compare
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.
Some files could not be reviewed due to errors:
Traceback (most recent call last):
Traceback (most recent call last): File "/home/linters/.local/bin/flake8", line 7, in from flake8.main.cli import main ModuleNotFoundError: No module named 'flake8'
f2ffd56
to
dfb2391
Compare
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.
Some files could not be reviewed due to errors:
Traceback (most recent call last):
Traceback (most recent call last): File "/home/linters/.local/bin/flake8", line 7, in from flake8.main.cli import main ModuleNotFoundError: No module named 'flake8'
dfb2391
to
f2c1185
Compare
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.
Some files could not be reviewed due to errors:
Traceback (most recent call last):
Traceback (most recent call last): File "/home/linters/.local/bin/flake8", line 7, in from flake8.main.cli import main ModuleNotFoundError: No module named 'flake8'
f2c1185
to
2930b55
Compare
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.
Some files could not be reviewed due to errors:
Traceback (most recent call last):
Traceback (most recent call last): File "/home/linters/.local/bin/flake8", line 7, in from flake8.main.cli import main ModuleNotFoundError: No module named 'flake8'
2930b55
to
0e047f9
Compare
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.
Some files could not be reviewed due to errors:
Traceback (most recent call last):
Traceback (most recent call last): File "/home/linters/.local/bin/flake8", line 7, in from flake8.main.cli import main ModuleNotFoundError: No module named 'flake8'
0e047f9
to
afd48f7
Compare
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.
Some files could not be reviewed due to errors:
Traceback (most recent call last):
Traceback (most recent call last): File "/home/linters/.local/bin/flake8", line 7, in from flake8.main.cli import main ModuleNotFoundError: No module named 'flake8'
afd48f7
to
d20069b
Compare
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.
Some files could not be reviewed due to errors:
Traceback (most recent call last):
Traceback (most recent call last): File "/home/linters/.local/bin/flake8", line 7, in from flake8.main.cli import main ModuleNotFoundError: No module named 'flake8'
036661f
to
9c7e1c0
Compare
I've refactored the client library here. |
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 client approach is a lot better. 👍
Current connection resumption behavior is now for the client to process the queue from where it last left off from so that commands executed while offline are not missed. |
Consider limiting processing of queue to last state. Stale state changes that are applied later might be bad, eg if state is flipped back and forth multiple times. |
That would be tricky I think with how I designed the protocol implementation. The calls themselves eg
Well the device itself shouldn't really have trouble handling that, it processes the commands and returns responses quite quickly. |
I've added timeouts here which should result in the device getting marked as unavailable within 10 seconds of connection loss. Hopefully that should prevent home-assistant from trying to queue too many state changes. |
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.
Just two clean ups needed. Otherwise looks good!
removed those now |
Great! Can be merged when build passes. |
Description:
This PR adds initial support for controlling the HLK-SW16. I plan to use this for controlling a multi-zone hot water heating system in addition to possible other low voltage devices such as sprinklers.
The MCU reference code for the device is available here. The device does have an internal timer feature as well but I'm not sure if there's a reason to add support for that in home-assistant.
Currently I have implemented/tested toggling all 16 relays individually in addition to reading their current state on startup, I'm looking to see if my general approach looks correct and how I might best expose the individual switch controls and how I would best configure this for controlling hot water zone valves. I'm still working on cleaning things up.
Documentation PR: home-assistant/home-assistant.io#7250
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: