Skip to content
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

Fix Netatmo preset service call #25358

Merged
merged 1 commit into from Jul 21, 2019
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

@@ -27,14 +27,15 @@

PRESET_FROST_GUARD = 'Frost Guard'
PRESET_SCHEDULE = 'Schedule'
PRESET_MANUAL = 'Manual'

SUPPORT_FLAGS = (SUPPORT_TARGET_TEMPERATURE | SUPPORT_PRESET_MODE)
SUPPORT_HVAC = [HVAC_MODE_HEAT, HVAC_MODE_AUTO, HVAC_MODE_OFF]
SUPPORT_PRESET = [
PRESET_AWAY, PRESET_BOOST, PRESET_FROST_GUARD, PRESET_SCHEDULE,
]

STATE_NETATMO_SCHEDULE = PRESET_SCHEDULE
STATE_NETATMO_SCHEDULE = 'schedule'
STATE_NETATMO_HG = 'hg'
STATE_NETATMO_MAX = 'max'
STATE_NETATMO_AWAY = PRESET_AWAY
@@ -44,7 +45,6 @@
PRESET_MAP_NETATMO = {
PRESET_FROST_GUARD: STATE_NETATMO_HG,
PRESET_BOOST: STATE_NETATMO_MAX,
STATE_NETATMO_MAX: STATE_NETATMO_MAX,
PRESET_SCHEDULE: STATE_NETATMO_SCHEDULE,
PRESET_AWAY: STATE_NETATMO_AWAY,
STATE_NETATMO_OFF: STATE_NETATMO_OFF
@@ -56,16 +56,17 @@
STATE_NETATMO_SCHEDULE: PRESET_SCHEDULE,
STATE_NETATMO_AWAY: PRESET_AWAY,
STATE_NETATMO_OFF: STATE_NETATMO_OFF,
STATE_NETATMO_MANUAL: 'Manual',
STATE_NETATMO_MANUAL: STATE_NETATMO_MANUAL,
}

HVAC_MAP_NETATMO = {
STATE_NETATMO_SCHEDULE: HVAC_MODE_AUTO,
PRESET_SCHEDULE: HVAC_MODE_AUTO,
STATE_NETATMO_HG: HVAC_MODE_AUTO,
PRESET_FROST_GUARD: HVAC_MODE_AUTO,
STATE_NETATMO_MAX: HVAC_MODE_HEAT,
PRESET_BOOST: HVAC_MODE_HEAT,
STATE_NETATMO_OFF: HVAC_MODE_OFF,
STATE_NETATMO_MANUAL: HVAC_MODE_AUTO,
PRESET_MANUAL: HVAC_MODE_AUTO,
STATE_NETATMO_AWAY: HVAC_MODE_AUTO
}

@@ -221,9 +222,9 @@ def set_hvac_mode(self, hvac_mode: str) -> None:
if hvac_mode == HVAC_MODE_OFF:
mode = STATE_NETATMO_OFF
elif hvac_mode == HVAC_MODE_AUTO:
mode = STATE_NETATMO_SCHEDULE
mode = PRESET_SCHEDULE
elif hvac_mode == HVAC_MODE_HEAT:
mode = STATE_NETATMO_MAX
mode = PRESET_BOOST

self.set_preset_mode(mode)

@@ -262,6 +263,8 @@ def set_preset_mode(self, preset_mode: str) -> None:
self._data.homestatus.setThermmode(
self._data.home_id, PRESET_MAP_NETATMO[preset_mode]
)
else:
_LOGGER.error("Preset mode '%s' not available", preset_mode)
self.update_without_throttle = True
self.schedule_update_ha_state()

@@ -323,10 +326,10 @@ def update(self):
self._hvac_mode = HVAC_MAP_NETATMO[self._preset]
self._battery_level = \
self._data.room_status[self._room_id].get('battery_level')
except KeyError:
except KeyError as err:
_LOGGER.error(
"The thermostat in room %s seems to be out of reach.",
self._room_id
"The thermostat in room %s seems to be out of reach. (%s)",
self._room_id, err
)
self._away = self._hvac_mode == HVAC_MAP_NETATMO[STATE_NETATMO_AWAY]

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.