smartHomeHub / SmartIR

Integration for Home Assistant to control climate, TV and fan devices via IR/RF controllers (Broadlink, Xiaomi, MQTT, LOOKin, ESPHome)
MIT License
2.04k stars 1k forks source link

Error when setting climate.set_hvac_mode to "fan_only" or climate.set_fan_mode #305

Closed Fabenissimo closed 4 years ago

Fabenissimo commented 4 years ago

Home Assistant version 107.7 SmartIR version latest (1.7.4) SmartIR configuration

climate:
  - platform: smartir
    name: Klimaanlage Zimmer Fabian
    unique_id: aircon_room_fabian
    device_code: 9944
    controller_data: 192.168.2.53
    temperature_sensor: sensor.netatmo_dahoam_zimmer_fabian_temperature
    humidity_sensor: sensor.netatmo_dahoam_zimmer_fabian_humidity
    power_sensor: binary_sensor.socket_aircon_fabian_energy_consumption

Describe the bug When setting the fan_oly mode via the frontend or via a service call in the developer menu the following error occours (Both service calls trigger the same error in the logs):

Debug log

'fan_only'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 134, in handle_call_service
    connection.context(msg),
  File "/usr/src/homeassistant/homeassistant/core.py", line 1234, in async_call
    await asyncio.shield(self._execute_service(handler, service_call))
  File "/usr/src/homeassistant/homeassistant/core.py", line 1257, in _execute_service
    await handler.func(service_call)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 198, in handle_service
    self._platforms.values(), func, call, required_features
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 402, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 599, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 433, in _handle_entity_call
    await result
  File "/config/custom_components/smartir/climate.py", line 299, in async_set_hvac_mode
    await self.send_command()
  File "/config/custom_components/smartir/climate.py", line 331, in send_command
    command = self._commands[operation_mode][fan_mode][target_temperature]
KeyError: 'fan_only'

Additional context If you need my json file I'll happily upload it somewhere.

smartHomeHub commented 4 years ago

I'm sure that your device file has not a fan_only section

Fabenissimo commented 4 years ago

Yes, you are right. I forgot to replace it further down in the file. Thanks!