-
Notifications
You must be signed in to change notification settings - Fork 0
Initial version of client #1
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
base: main
Are you sure you want to change the base?
Conversation
htd/__init__.py
Outdated
| _ip_address: str = None | ||
| _port: int = None | ||
| _command_delay_sec: float = None | ||
| _retry_attempts: int = None | ||
| _socket_timeout_sec: float = None |
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.
nitpick: I don't think you need this as they're all defined in your constructor.
htd/__init__.py
Outdated
| self._ip_address = ip_address | ||
| self._port = port | ||
| self._retry_attempts = retry_attempts | ||
| self._command_delay_sec = command_delay / ONE_SECOND | ||
| self._socket_timeout_sec = socket_timeout / ONE_SECOND |
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.
nitpick(cont.): and you can still type them here
| self._ip_address = ip_address | |
| self._port = port | |
| self._retry_attempts = retry_attempts | |
| self._command_delay_sec = command_delay / ONE_SECOND | |
| self._socket_timeout_sec = socket_timeout / ONE_SECOND | |
| self._ip_address: str = ip_address | |
| self._port: int = port | |
| self._retry_attempts: int = retry_attempts | |
| self._command_delay_sec: float = command_delay / ONE_SECOND | |
| self._socket_timeout_sec: float = socket_timeout / ONE_SECOND |
htd/utils.py
Outdated
| # convert the volume into a usable value. the device will transmit a number | ||
| # between 196 - 255. if it's at max volume, the raw volume will come as 0. | ||
| # this is probably because the gateway only transmits 8 bits per byte. | ||
| # 255 is 0b11111111. since there's no volume = 0 (use mute I guess), if the | ||
| # volume hits 0, it's because it's at max volume, so we make it 256. | ||
| # credit for this goes to lounsbrough | ||
| def convert_volume(raw_volume: int) -> (int, int): |
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.
nitpick: imo, in-line comments are better with this simple formatting. I would use doc strings for functions so that you can parse the info if you ever care to.
| # convert the volume into a usable value. the device will transmit a number | |
| # between 196 - 255. if it's at max volume, the raw volume will come as 0. | |
| # this is probably because the gateway only transmits 8 bits per byte. | |
| # 255 is 0b11111111. since there's no volume = 0 (use mute I guess), if the | |
| # volume hits 0, it's because it's at max volume, so we make it 256. | |
| # credit for this goes to lounsbrough | |
| def convert_volume(raw_volume: int) -> (int, int): | |
| def convert_volume(raw_volume: int) -> (int, int): | |
| """ | |
| convert the volume into a usable value. the device will transmit a number | |
| between 196 - 255. if it's at max volume, the raw volume will come as 0. | |
| this is probably because the gateway only transmits 8 bits per byte. | |
| 255 is 0b11111111. since there's no volume = 0 (use mute I guess), if the | |
| volume hits 0, it's because it's at max volume, so we make it 256. | |
| credit for this goes to lounsbrough | |
| """ |
…ible in the message and return the zone we want, parse_single_zone
No description provided.