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

[custom_components.smartir.climate] string indices must be integers, not 'str' #1139

Closed
anthonws opened this issue Sep 29, 2023 · 5 comments
Closed

Comments

@anthonws
Copy link

anthonws commented Sep 29, 2023

** Home Assistant version**
Version 2023.9.3

SmartIR version
Version 1.17.8

SmartIR configuration

  update_branch: rc

climate:
  - platform: smartir
    name: Office AC
    unique_id: office_ac
    device_code: 9999
    controller_data: remote.universal_remote_office_remote
    temperature_sensor: sensor.universal_remote_office_temperature
    humidity_sensor: sensor.universal_remote_office_humidity

  - platform: smartir
    name: Kids Bedroom AC
    unique_id: kids_ac
    device_code: 9999
    controller_data: remote.universal_remote_kids_bedroom_remote
    temperature_sensor: sensor.universal_remote_kids_bedroom_temperature
    humidity_sensor: sensor.universal_remote_kids_bedroom_humidity

  - platform: smartir
    name: Living Room AC
    unique_id: living_room_ac
    device_code: 9999
    controller_data: remote.universal_remote_living_room_remote
    temperature_sensor: sensor.awair_living_room_temp
    humidity_sensor: sensor.awair_living_room_humid

  - platform: smartir
    name: Master Bedroom AC
    unique_id: master_bedroom_ac
    device_code: 9999
    controller_data: remote.universal_remote_master_bedroom_remote
    temperature_sensor: sensor.awair_master_bedroom_temp
    humidity_sensor: sensor.awair_master_bedroom_humid

Add configuration here

Describe the bug

HA 2023.9.3. Spotted errors related to "string indices must be integers, not 'str'" when turning on the fan mode for my ACs (Midea).

Debug log


2023-09-29 12:23:44.167 DEBUG (MainThread) [custom_components.smartir.climate] loading json file /config/custom_components/smartir/codes/climate/9999.json

2023-09-29 12:23:44.168 DEBUG (MainThread) [custom_components.smartir.climate] /config/custom_components/smartir/codes/climate/9999.json file loaded

2023-09-29 12:23:44.168 DEBUG (MainThread) [custom_components.smartir.climate] SmartIRClimate init started for device Office AC supported models ['Unknown']

2023-09-29 12:23:44.172 DEBUG (MainThread) [custom_components.smartir.climate] Setting up the startir platform

2023-09-29 12:23:44.172 DEBUG (MainThread) [custom_components.smartir.climate] loading json file /config/custom_components/smartir/codes/climate/9999.json

2023-09-29 12:23:44.173 DEBUG (MainThread) [custom_components.smartir.climate] /config/custom_components/smartir/codes/climate/9999.json file loaded

2023-09-29 12:23:44.173 DEBUG (MainThread) [custom_components.smartir.climate] SmartIRClimate init started for device Kids Bedroom AC supported models ['Unknown']

2023-09-29 12:23:44.175 DEBUG (MainThread) [custom_components.smartir.climate] Setting up the startir platform

2023-09-29 12:23:44.176 DEBUG (MainThread) [custom_components.smartir.climate] loading json file /config/custom_components/smartir/codes/climate/9999.json

2023-09-29 12:23:44.176 DEBUG (MainThread) [custom_components.smartir.climate] /config/custom_components/smartir/codes/climate/9999.json file loaded

2023-09-29 12:23:44.178 DEBUG (MainThread) [custom_components.smartir.climate] SmartIRClimate init started for device Living Room AC supported models ['Unknown']

2023-09-29 12:23:44.179 DEBUG (MainThread) [custom_components.smartir.climate] async_added_to_hass <entity climate.office_ac=off> Office AC 9

2023-09-29 12:23:44.180 DEBUG (MainThread) [custom_components.smartir.climate] Setting up the startir platform

2023-09-29 12:23:44.181 DEBUG (MainThread) [custom_components.smartir.climate] loading json file /config/custom_components/smartir/codes/climate/9999.json

2023-09-29 12:23:44.181 DEBUG (MainThread) [custom_components.smartir.climate] /config/custom_components/smartir/codes/climate/9999.json file loaded

2023-09-29 12:23:44.182 DEBUG (MainThread) [custom_components.smartir.climate] SmartIRClimate init started for device Master Bedroom AC supported models ['Unknown']

2023-09-29 12:23:44.182 DEBUG (MainThread) [custom_components.smartir.climate] async_added_to_hass <entity climate.kids_bedroom_ac=off> Kids Bedroom AC 9

2023-09-29 12:23:44.185 DEBUG (MainThread) [custom_components.smartir.climate] async_added_to_hass <entity climate.living_room_ac=off> Living Room AC 9

2023-09-29 12:23:44.189 DEBUG (MainThread) [custom_components.smartir.climate] async_added_to_hass <entity climate.master_bedroom_ac=off> Master Bedroom AC 9


Add your logs here.

```2023-09-29 12:13:25.350 ERROR (MainThread) [custom_components.smartir.climate] string indices must be integers, not 'str'

Traceback (most recent call last):

  File "/config/custom_components/smartir/climate.py", line 383, in send_command

    self._commands[operation_mode][fan_mode][target_temperature])

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^

TypeError: string indices must be integers, not 'str'

2023-09-29 12:13:27.765 ERROR (MainThread) [custom_components.smartir.climate] string indices must be integers, not 'str'

Traceback (most recent call last):

  File "/config/custom_components/smartir/climate.py", line 383, in send_command

    self._commands[operation_mode][fan_mode][target_temperature])

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^

TypeError: string indices must be integers, not 'str'
@litinoveweedle
Copy link

To me it seems, that in the codes for your Midea device fan modes are missing. ;-)

@anthonws
Copy link
Author

anthonws commented Apr 1, 2024

It is indeed missing the temperature(s) for the fan profile.
I've open a discussion here (https://github.com/smartHomeHub/SmartIR/discussions/1222) but got no feedback. I've modified the code (for me only), which "fixes" this issue.
I'll close this as it is indeed not an issue.
Thanks!

@anthonws anthonws closed this as completed Apr 1, 2024
@litinoveweedle
Copy link

I am trying to solve issue with any potential missing code. I did replied to you in your original discussion. I would keep this issue open, until I can provide PR solving it. ;-)

@anthonws
Copy link
Author

anthonws commented Apr 1, 2024

Keeping this open based on your input. Thank you.

@litinoveweedle
Copy link

Hi, I merged proposed change into my litinoveweedle#2 and I will release it soon. You can test it and report back.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants