-
Notifications
You must be signed in to change notification settings - Fork 47
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
Complemented low control #84
Complemented low control #84
Conversation
I noticed that you have an old branch with mqtt support added. Why did you not merge it? I noticed that your solution with the parameters were more flexible than mine, so I adjusted my version to look more like yours. |
I don't recall details but I think it was either that I haven't tested that enough or I wasn't sure about usefullness/user friendliness of CLI interface.
This part is the most tricky one. We have unit tests for this part of the code. I didn't know that this code is failing. Have you managed to get those failed?
I'm not sure what you mean by "48 byte encryption issue". Has somebody reported issue that I haven't noticed? |
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.
Overall I like these changes. I have commented inline for those parts that I would like to change or I wasn't sure about a reason for a change.
I would like you to leave out realtime UDP client from this pull request. I would like to see that in a separate PR, preferrably with some unit tests that cover all those versions.
xled/control.py
Outdated
if password: | ||
json_payload = { | ||
"mode": 2, | ||
"ap": {"password": password, "enc": 4} |
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.
Let's make this easier to read.
Since {"mode": 2}
is always sent that could be a default. And only if a password is set we could add second dict entry - "ap".
xled/control.py
Outdated
} | ||
if ssid and password: | ||
encpassword = xled.security.encrypt_wifi_password(password, self.hw_address) | ||
json_payload = { |
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.
Same as above - let's use default with single dict entry "mode": 1
and only if password
and ssid
are available add those.
xled/control.py
Outdated
|
||
def get_led_effects(self): | ||
""" | ||
Get the number of effects and their unique_ids |
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.
Let's use "Gets" instead of "Get" similarly to other API docstrings.
xled/control.py
Outdated
|
||
def get_led_effects_current(self): | ||
""" | ||
Get the current effect index |
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.
Let's use "Gets" instead of "Get" similarly to other API docstrings.
xled/control.py
Outdated
|
||
def delete_playlist(self): | ||
""" | ||
Clear the playlist |
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.
Let's use "Clears" instead of "Clear" similarly to other API docstrings.
xled/control.py
Outdated
@@ -74,6 +74,52 @@ def session(self): | |||
assert self._session | |||
return self._session | |||
|
|||
def check_status(self): | |||
""" | |||
Check that the device is online and responding |
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.
Let's use "Checks" instead of "Check" similarly to other API docstrings.
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.
Sorry for all the doc-string oversights. Fixed.
xled/control.py
Outdated
assert all(key in app_response.keys() for key in required_keys) | ||
return app_response | ||
|
||
def set_mqtt_config(self, br_host, br_port, client_id, user, interval): |
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 seems to be duplicated from earlier commit ee7114c .
If you refer to test_security.py, it appears to only test
I refer to issue #70 opened by someone called scrool on January 3... ;-)
That will take some delicate operation again. I'll do it but not tonight. Meanwhile, have you checked out the file test_low_control.py checked into my (soon obsolete) pull request #80? It contains test for all low level interface calls (except firmware and change network mode) including all versions of the realtime calls. You can also run
|
9138705
to
e76cddf
Compare
@scrool , I have now removed the realtime UDP protocols from this pull request, as you wished. I am standing by to add it again, together with the new unit test, once you have merged this one. And in line after that are all the other low-level unit tests. |
@Anders-Holst I have noticed that you haven't run
To not miss this next time I have updated GitHub actions to run linters for pull requests but this doesn't run against this PR because it is based on Please:
|
…seem to have changed
OK, you are right, I had missed black. Tried to rebase and apply black. I thought I had fixed it all now. (Obviously did a small mistake when committing, and git rebase seemed confused so I was not able to just "drop" my last commit.) |
From what I can tell, There is one error caught by
that's because you import directly method |
New try. Fixed the problem, passes black and flake8 here. Hope it passes on your side too. |
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.
From what I can tell, this looks like a very good change.
I have skipped those commits which didn't provide any changes and merged the rest into Thanks again! 🥳 |
This pull request contains the changes to the low-level control interface, ControlInterface, suggested in the unwieldy pull request #80 .
(I really tried to make the commit messages more specific this time. But with so many changes, some are still kind of vague.)
/ Anders