Eph ember support operation modes#15820
Conversation
|
@frenck Docs updated on PR home-assistant/home-assistant.io#5967 |
| @property | ||
| def operation_list(self): | ||
| """Return the supported operations.""" | ||
| return [STATE_AUTO, STATE_ALL_DAY, STATE_HEAT, STATE_OFF] |
There was a problem hiding this comment.
Move this to a module level constant and return that here.
There was a problem hiding this comment.
No operation modes that are not defined in the climate base component are allowed. Please remove STATE_ALL_DAY. New modes must be proposed and accepted via an issue in our architecture repo.
We're currently reviewing the climate component in our architecture repo.
| def map_mode_hass_eph(operation_mode): | ||
| """Map from home assistant mode to eph mode.""" | ||
| from pyephember.pyephember import ZoneMode | ||
| if operation_mode == STATE_AUTO: |
There was a problem hiding this comment.
You can instead make a dictionary that holds the map, put at the module level, and use getattr on ZoneModehere to get the correct attribute.
| def map_mode_eph_hass(operation_mode): | ||
| """Map from eph mode to home assistant mode.""" | ||
| from pyephember.pyephember import ZoneMode | ||
| if operation_mode == ZoneMode.AUTO: |
| def map_mode_hass_eph(operation_mode): | ||
| """Map from home assistant mode to eph mode.""" | ||
| from pyephember.pyephember import ZoneMode | ||
| return getattr(ZoneMode, HA_STATE_TO_EPH.get(operation_mode)) |
There was a problem hiding this comment.
Add a safe default.
return getattr(ZoneMode, HA_STATE_TO_EPH.get(operation_mode), None)|
I'm not sure why the latest CI building is failing on pylint. I'm not getting any errors locally (using py3.6) and can't see any reference to errors in my module. |
MartinHjelmare
left a comment
There was a problem hiding this comment.
Looks good! Can be merged when build passes.
|
I've restarted that build job. Let's see what happens. |
Description:
Adds support for operation modes in the EphEmber climate device
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:
REQUIREMENTSvariable ([example][ex-requir]).requirements_all.txtby runningscript/gen_requirements_all.py..coveragerc.If the code does not interact with devices: