fustom / ariston-remotethermo-home-assistant-v3

Ariston NET remotethermo integration for Home Assistant based on API
MIT License
157 stars 37 forks source link

Error set preset_mode to Off #104

Closed sergeybelozorov closed 1 year ago

sergeybelozorov commented 1 year ago

Hi!

I have Ariston HS X 24 FF with WiFi module. In HA it set like GALEVO

When I try set mode to OFF I get Error:

2023-03-08 10:30:15.325 DEBUG (MainThread) [ariston.ariston_api] Request method POST, path: https://www.ariston-net.remotethermo.com/api/v2/remote/dataItems/E868E70A6630/set?umsys=si, params: None 2023-03-08 10:30:16.060 DEBUG (MainThread) [ariston.ariston_api] Request method POST, path: https://www.ariston-net.remotethermo.com/api/v2/remote/dataItems/E868E70A6630/get?umsys=si, params: None 2023-03-08 10:30:16.590 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [547387462976] <PlantMode.HEATING_ONLY: 2> is not in list Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 198, in handle_call_service await hass.services.async_call( File "/usr/src/homeassistant/homeassistant/core.py", line 1808, in async_call task.result() File "/usr/src/homeassistant/homeassistant/core.py", line 1845, in _execute_service await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)( File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 213, in handle_service await service.entity_service_call( File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 686, in entity_service_call future.result() # pop exception if have File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 961, in async_request_call await coro File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 726, in _handle_entity_call await result File "/config/custom_components/ariston/climate.py", line 247, in async_set_preset_mode self.async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 559, in async_write_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 602, in _async_write_ha_state attr.update(self.state_attributes or {}) File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 338, in state_attributes data[ATTR_PRESET_MODE] = self.preset_mode File "/config/custom_components/ariston/climate.py", line 175, in preset_mode return self.device.get_plant_mode_text() File "/usr/local/lib/python3.10/site-packages/ariston/galevo_device.py", line 333, in get_plant_mode_text index = self.get_plant_mode_options().index(self.get_plant_mode()) ValueError: <PlantMode.HEATING_ONLY: 2> is not in list 2023-03-08 10:30:23.351 ERROR (MainThread) [aiohttp_sse_client.client] fetch https://api.home-connect.com/api/homeappliances/events failed: 409 2023-03-08 10:30:28.320 DEBUG (MainThread) [ariston.ariston_api] Response {'features': {'zones': [{'num': 1, 'name': '', 'roomSens': False, 'geofenceDeroga': False, 'virtInfo': {'heatReqMode': 0, 'thermoregModeHeat': 1, 'thermoregModeCool': 0, 'undef': False}, 'isHidden': False}, {'num': 2, 'name': '', 'roomSens': False, 'geofenceDeroga': False, 'virtInfo': {'heatReqMode': 0, 'thermoregModeHeat': 1, 'thermoregModeCool': 0, 'undef': False}, 'isHidden': True}, {'num': 3, 'name': '', 'roomSens': False, 'geofenceDeroga': False, 'virtInfo': {'heatReqMode': 0, 'thermoregModeHeat': 1, 'thermoregModeCool': 0, 'undef': False}, 'isHidden': True}], 'solar': False, 'convBoiler': True, 'commBoiler': False, 'hpSys': False, 'hybridSys': False, 'cascadeSys': False, 'dhwProgSupported': False, 'virtualZones': True, 'hasVmc': False, 'extendedTimeProg': False, 'hasBoiler': True, 'pilotSupported': False, 'isVmcR2': False, 'isEvo2': False, 'dhwHidden': False, 'dhwBoilerPresent': False, 'dhwModeChangeable': True, 'hvInputOff': False, 'autoThermoReg': True, 'hasMetering': False, 'weatherProvider': 0, 'hasFireplace': False, 'hasSlp': False, 'hasEm20': False, 'hasTwoCoolingTemp': False, 'bmsActive': False, 'hpCascadeSys': False, 'hpCascadeConfig': -1, 'bufferTimeProgAvailable': False, 'distinctHeatCoolSetpoints': False, 'hasZoneNames': False, 'hydraulicScheme': -1, 'preHeatingSupported': False, 'hasGahp': False, 'hasDhwTimeProgTemperatures': 2, 'zigbeeActive': False}, 'items': [{'id': 'AutomaticThermoregulation', 'zone': 0, 'kind': 3, 'min': 0.0, 'max': 0.0, 'step': 0.0, 'value': 0.0, 'decimals': 0, 'options': [0, 1], 'readOnly': False, 'error': False, 'invalid': False}, {'id': 'ChFlowSetpointTemp', 'zone': 0, 'kind': 1, 'min': -3277.0, 'max': 3276.0, 'step': 1.0, 'value': 41.0, 'decimals': 0, 'readOnly': True, 'error': False, 'invalid': False, 'unit': '°C'}, {'id': 'ChFlowTemp', 'zone': 0, 'kind': 1, 'min': -3277.0, 'max': 3276.0, 'step': 1.0, 'value': 36.0, 'decimals': 0, 'readOnly': True, 'error': False, 'invalid': False, 'unit': '°C'}, {'id': 'DhwMode', 'zone': 0, 'kind': 2, 'min': 0.0, 'max': 0.0, 'step': 0.0, 'value': 0.0, 'decimals': 0, 'options': [0, 1, 2], 'optTexts': ['Disabled', 'Time Based', 'Always active'], 'readOnly': False, 'error': False, 'invalid': False}, {'id': 'DhwTemp', 'zone': 0, 'kind': 1, 'min': 36.0, 'max': 60.0, 'step': 1.0, 'value': 50.0, 'decimals': 0, 'readOnly': False, 'error': False, 'invalid': False, 'unit': '°C'}, {'id': 'DhwTimeProgComfortTemp', 'zone': 0, 'kind': 1, 'min': 36.0, 'max': 60.0, 'step': 1.0, 'value': 50.0, 'decimals': 0, 'readOnly': False, 'error': False, 'invalid': False, 'unit': '°C'}, {'id': 'DhwTimeProgEconomyTemp', 'zone': 0, 'kind': 1, 'min': 10.0, 'max': 50.0, 'step': 1.0, 'value': 10.0, 'decimals': 0, 'readOnly': False, 'error': False, 'invalid': False, 'unit': '°C'}, {'id': 'IsFlameOn', 'zone': 0, 'kind': 3, 'min': 0.0, 'max': 0.0, 'step': 0.0, 'value': 0.0, 'decimals': 0, 'options': [0, 1], 'readOnly': False, 'error': False, 'invalid': False}, {'id': 'OutsideTemp', 'zone': 0, 'kind': 1, 'min': -3277.0, 'max': 3276.0, 'step': 1.0, 'value': 3276.0, 'decimals': 0, 'readOnly': True, 'error': False, 'invalid': False, 'unit': '°C'}, {'id': 'PlantMode', 'zone': 0, 'kind': 2, 'min': 0.0, 'max': 0.0, 'step': 0.0, 'value': 2.0, 'decimals': 0, 'options': [0, 1, 5], 'optTexts': ['Summer', 'Winter', 'OFF'], 'readOnly': False, 'error': False, 'invalid': False}, {'id': 'Weather', 'zone': 0, 'kind': 1, 'min': 0.0, 'max': 255.0, 'step': 1.0, 'value': 9.0, 'decimals': 0, 'readOnly': True, 'error': False, 'invalid': False, 'unit': ''}, {'id': 'HeatingFlowOffset', 'zone': 1, 'kind': 1, 'min': -14.0, 'max': 14.0, 'step': 1.0, 'value': 0.0, 'decimals': 0, 'readOnly': False, 'error': False, 'invalid': False, 'unit': ''}, {'id': 'HeatingFlowOffset', 'zone': 2, 'kind': 1, 'min': -14.0, 'max': 14.0, 'step': 1.0, 'value': 0.0, 'decimals': 0, 'readOnly': False, 'error': False, 'invalid': False, 'unit': ''}, {'id': 'HeatingFlowOffset', 'zone': 3, 'kind': 1, 'min': -14.0, 'max': 14.0, 'step': 1.0, 'value': 0.0, 'decimals': 0, 'readOnly': False, 'error': False, 'invalid': False, 'unit': ''}, {'id': 'HeatingFlowTemp', 'zone': 1, 'kind': 1, 'min': 35.0, 'max': 82.0, 'step': 1.0, 'value': 41.0, 'decimals': 0, 'readOnly': False, 'error': False, 'invalid': False, 'unit': '°C'}, {'id': 'HeatingFlowTemp', 'zone': 2, 'kind': 1, 'min': 35.0, 'max': 82.0, 'step': 1.0, 'value': 35.0, 'decimals': 0, 'readOnly': False, 'error': False, 'invalid': False, 'unit': '°C'}, {'id': 'HeatingFlowTemp', 'zone': 3, 'kind': 1, 'min': 35.0, 'max': 82.0, 'step': 1.0, 'value': 35.0, 'decimals': 0, 'readOnly': False, 'error': False, 'invalid': False, 'unit': '°C'}, {'id': 'ZoneComfortTemp', 'zone': 1, 'kind': 1, 'min': 10.0, 'max': 30.0, 'step': 0.5, 'value': 20.0, 'decimals': 1, 'readOnly': False, 'error': False, 'invalid': False, 'unit': '°C'}, {'id': 'ZoneComfortTemp', 'zone': 2, 'kind': 1, 'min': 10.0, 'max': 30.0, 'step': 0.5, 'value': 19.0, 'decimals': 1, 'readOnly': False, 'error': False, 'invalid': False, 'unit': '°C'}, {'id': 'ZoneComfortTemp', 'zone': 3, 'kind': 1, 'min': 10.0, 'max': 30.0, 'step': 0.5, 'value': 19.0, 'decimals': 1, 'readOnly': False, 'error': False, 'invalid': False, 'unit': '°C'}, {'id': 'ZoneDesiredTemp', 'zone': 1, 'kind': 1, 'min': -3276.8, 'max': 3276.7, 'step': 0.5, 'value': 20.0, 'decimals': 1, 'readOnly': True, 'error': False, 'invalid': False, 'unit': '°C'}, {'id': 'ZoneDesiredTemp', 'zone': 2, 'kind': 1, 'min': -3276.8, 'max': 3276.7, 'step': 0.5, 'value': 19.0, 'decimals': 1, 'readOnly': True, 'error': False, 'invalid': False, 'unit': '°C'}, {'id': 'ZoneDesiredTemp', 'zone': 3, 'kind': 1, 'min': -3276.8, 'max': 3276.7, 'step': 0.5, 'value': 19.0, 'decimals': 1, 'readOnly': True, 'error': False, 'invalid': False, 'unit': '°C'}, {'id': 'ZoneEconomyTemp', 'zone': 1, 'kind': 1, 'min': 10.0, 'max': 30.0, 'step': 0.5, 'value': 16.0, 'decimals': 1, 'readOnly': False, 'error': False, 'invalid': False, 'unit': '°C'}, {'id': 'ZoneEconomyTemp', 'zone': 2, 'kind': 1, 'min': 10.0, 'max': 30.0, 'step': 0.5, 'value': 16.0, 'decimals': 1, 'readOnly': False, 'error': False, 'invalid': False, 'unit': '°C'}, {'id': 'ZoneEconomyTemp', 'zone': 3, 'kind': 1, 'min': 10.0, 'max': 30.0, 'step': 0.5, 'value': 16.0, 'decimals': 1, 'readOnly': False, 'error': False, 'invalid': False, 'unit': '°C'}, {'id': 'ZoneHeatRequest', 'zone': 1, 'kind': 2, 'min': 0.0, 'max': 0.0, 'step': 0.0, 'value': 1.0, 'decimals': 0, 'options': [0, 1], 'optTexts': ['OFF', 'ON'], 'readOnly': True, 'error': False, 'invalid': False}, {'id': 'ZoneHeatRequest', 'zone': 2, 'kind': 2, 'min': 0.0, 'max': 0.0, 'step': 0.0, 'value': 0.0, 'decimals': 0, 'options': [0, 1], 'optTexts': ['OFF', 'ON'], 'readOnly': True, 'error': False, 'invalid': False}, {'id': 'ZoneHeatRequest', 'zone': 3, 'kind': 2, 'min': 0.0, 'max': 0.0, 'step': 0.0, 'value': 0.0, 'decimals': 0, 'options': [0, 1], 'optTexts': ['OFF', 'ON'], 'readOnly': True, 'error': False, 'invalid': False}, {'id': 'IsZonePilotOn', 'zone': 1, 'kind': 3, 'min': 0.0, 'max': 0.0, 'step': 0.0, 'value': 0.0, 'decimals': 0, 'options': [0, 1], 'readOnly': False, 'error': False, 'invalid': False}, {'id': 'IsZonePilotOn', 'zone': 2, 'kind': 3, 'min': 0.0, 'max': 0.0, 'step': 0.0, 'value': 0.0, 'decimals': 0, 'options': [0, 1], 'readOnly': False, 'error': False, 'invalid': False}, {'id': 'IsZonePilotOn', 'zone': 3, 'kind': 3, 'min': 0.0, 'max': 0.0, 'step': 0.0, 'value': 0.0, 'decimals': 0, 'options': [0, 1], 'readOnly': False, 'error': False, 'invalid': False}, {'id': 'ZoneMeasuredTemp', 'zone': 1, 'kind': 1, 'min': -3276.8, 'max': 3276.7, 'step': 0.5, 'value': 0.0, 'decimals': 1, 'readOnly': True, 'error': False, 'invalid': False, 'unit': '°C'}, {'id': 'ZoneMeasuredTemp', 'zone': 2, 'kind': 1, 'min': -3276.8, 'max': 3276.7, 'step': 0.5, 'value': 0.0, 'decimals': 1, 'readOnly': True, 'error': False, 'invalid': False, 'unit': '°C'}, {'id': 'ZoneMeasuredTemp', 'zone': 3, 'kind': 1, 'min': -3276.8, 'max': 3276.7, 'step': 0.5, 'value': 0.0, 'decimals': 1, 'readOnly': True, 'error': False, 'invalid': False, 'unit': '°C'}, {'id': 'ZoneMode', 'zone': 1, 'kind': 2, 'min': 0.0, 'max': 0.0, 'step': 0.0, 'value': 3.0, 'decimals': 0, 'options': [2, 3], 'optTexts': ['Manual', 'Time program'], 'readOnly': False, 'error': False, 'invalid': False}, {'id': 'ZoneMode', 'zone': 2, 'kind': 2, 'min': 0.0, 'max': 0.0, 'step': 0.0, 'value': 3.0, 'decimals': 0, 'options': [2, 3], 'optTexts': ['Manual', 'Time program'], 'readOnly': False, 'error': False, 'invalid': False}, {'id': 'ZoneMode', 'zone': 3, 'kind': 2, 'min': 0.0, 'max': 0.0, 'step': 0.0, 'value': 3.0, 'decimals': 0, 'options': [2, 3], 'optTexts': ['Manual', 'Time program'], 'readOnly': False, 'error': False, 'invalid': False}, {'id': 'VirtTempOffsetHeat', 'zone': 1, 'kind': 1, 'min': -14.0, 'max': 14.0, 'step': 1.0, 'value': 0.0, 'decimals': 0, 'readOnly': False, 'error': False, 'invalid': False, 'unit': ''}, {'id': 'VirtTempOffsetHeat', 'zone': 2, 'kind': 1, 'min': -14.0, 'max': 14.0, 'step': 1.0, 'value': 0.0, 'decimals': 0, 'readOnly': False, 'error': False, 'invalid': False, 'unit': ''}, {'id': 'VirtTempOffsetHeat', 'zone': 3, 'kind': 1, 'min': -14.0, 'max': 14.0, 'step': 1.0, 'value': 0.0, 'decimals': 0, 'readOnly': False, 'error': False, 'invalid': False, 'unit': ''}, {'id': 'Holiday', 'zone': 0, 'kind': 3, 'min': 0.0, 'max': 0.0, 'step': 0.0, 'value': 0.0, 'decimals': 0, 'options': [0, 1], 'readOnly': False, 'error': False, 'invalid': False}, {'id': 'ZoneDeroga', 'zone': 1, 'kind': 1, 'min': 10.0, 'max': 30.0, 'step': 0.5, 'value': 0.0, 'decimals': 1, 'readOnly': False, 'error': False, 'invalid': False}, {'id': 'ZoneDeroga', 'zone': 2, 'kind': 1, 'min': 10.0, 'max': 30.0, 'step': 0.5, 'value': 0.0, 'decimals': 1, 'readOnly': False, 'error': False, 'invalid': False}, {'id': 'ZoneDeroga', 'zone': 3, 'kind': 1, 'min': 10.0, 'max': 30.0, 'step': 0.5, 'value': 0.0, 'decimals': 1, 'readOnly': False, 'error': False, 'invalid': False}]} 2023-03-08 10:30:28.328 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 182, in _handle_refresh_interval await self._async_refresh(log_failures=True, scheduled=True) File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 330, in _async_refresh self.async_update_listeners() File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 135, in async_update_listeners update_callback() File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 390, in _handle_coordinator_update self.async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 559, in async_write_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 602, in _async_write_ha_state attr.update(self.state_attributes or {}) File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 338, in state_attributes data[ATTR_PRESET_MODE] = self.preset_mode File "/config/custom_components/ariston/climate.py", line 175, in preset_mode return self.device.get_plant_mode_text() File "/usr/local/lib/python3.10/site-packages/ariston/galevo_device.py", line 333, in get_plant_mode_text index = self.get_plant_mode_options().index(self.get_plant_mode()) ValueError: <PlantMode.HEATING_ONLY: 2> is not in list

If I set mode Off via mobile app Ariston, I doesn't get an error

This is state of device from HA:

hvac_modes:
  - heat
  - auto
min_temp: 10
max_temp: 30
target_temp_step: 0.5
preset_modes:
  - Summer
  - Winter
  - 'OFF'
current_temperature: 0
temperature: 20
hvac_action: 'off'
preset_mode: 'OFF'
heat_request: 0
economy_temp: 16
zone_number: '1'
icon: mdi:radiator-off
friendly_name: HS X 24 FF
supported_features: 17
fustom commented 1 year ago

Hi @sergeybelozorov

This is an interesting issue. The following log line shows the possible PlantMode is in the [0, 1, 5] list but the current value is 2 (which is not in the possible list).

{'id': 'PlantMode', 'zone': 0, 'kind': 2, 'min': 0.0, 'max': 0.0, 'step': 0.0, 'value': 2.0, 'decimals': 0, 'options': [0, 1, 5], 'optTexts': ['Summer', 'Winter', 'OFF'], 'readOnly': False, 'error': False, 'invalid': False}

This is an cloud API issue. I will fix my code to be more permissive.