-
-
Notifications
You must be signed in to change notification settings - Fork 29.9k
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
Daikin Climate - Better integration with Climate base component #16913
Merged
Merged
Changes from 6 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
c97dae4
Daikin Climate - Better integration with Climate base component
MatteGary 922af63
Build bug fixing
MatteGary fe5bb82
Bug fixing in Set Operation_Mode functionality
MatteGary 4864833
Fix useless code
MatteGary e4f537c
Fix hound bug
MatteGary 5ed1eb1
Bug fixing
MatteGary 8fb9925
Trailing white space fix
MatteGary 5d92aea
Compile fixing
MatteGary 6a192ba
Whitespace fix
MatteGary File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,6 +40,15 @@ | |
STATE_OFF: 'off', | ||
} | ||
|
||
DAIKIN_TO_HA_STATE = { | ||
'fan': STATE_FAN_ONLY, | ||
'dry': STATE_DRY, | ||
'cool': STATE_COOL, | ||
'hot': STATE_HEAT, | ||
'auto': STATE_AUTO, | ||
'off': STATE_OFF, | ||
} | ||
|
||
HA_ATTR_TO_DAIKIN = { | ||
ATTR_OPERATION_MODE: 'mode', | ||
ATTR_FAN_MODE: 'f_rate', | ||
|
@@ -75,9 +84,7 @@ def __init__(self, api): | |
self._api = api | ||
self._force_refresh = False | ||
self._list = { | ||
ATTR_OPERATION_MODE: list( | ||
map(str.title, set(HA_STATE_TO_DAIKIN.values())) | ||
), | ||
ATTR_OPERATION_MODE: list(HA_STATE_TO_DAIKIN), | ||
ATTR_FAN_MODE: list( | ||
map( | ||
str.title, | ||
|
@@ -136,11 +143,10 @@ def get(self, key): | |
elif key == ATTR_OPERATION_MODE: | ||
# Daikin can return also internal states auto-1 or auto-7 | ||
# and we need to translate them as AUTO | ||
value = re.sub( | ||
'[^a-z]', | ||
'', | ||
self._api.device.represent(daikin_attr)[1] | ||
).title() | ||
daikin_mode = re.sub('[^a-z]', '', self._api.device.represent(daikin_attr)[1]) | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. blank line contains whitespace |
||
ha_mode = DAIKIN_TO_HA_STATE.get(daikin_mode) | ||
value = ha_mode | ||
|
||
if value is None: | ||
_LOGGER.error("Invalid value requested for key %s", key) | ||
|
@@ -167,8 +173,8 @@ def set(self, settings): | |
|
||
daikin_attr = HA_ATTR_TO_DAIKIN.get(attr) | ||
if daikin_attr is not None: | ||
if value.title() in self._list[attr]: | ||
values[daikin_attr] = value.lower() | ||
if value in self._list[attr]: | ||
MartinHjelmare marked this conversation as resolved.
Show resolved
Hide resolved
|
||
values[daikin_attr] = HA_STATE_TO_DAIKIN[value] | ||
else: | ||
_LOGGER.error("Invalid value %s for %s", attr, value) | ||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
line too long (90 > 79 characters)