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

Atomberg Gorilla Fan - Not able to set max speed #1971

Closed
aravindjaimon opened this issue Jun 3, 2024 · 4 comments · Fixed by #1988
Closed

Atomberg Gorilla Fan - Not able to set max speed #1971

aravindjaimon opened this issue Jun 3, 2024 · 4 comments · Fixed by #1988

Comments

@aravindjaimon
Copy link
Contributor

This form is for reporting bugs. If you have encountered a bug, you should
generally have some log messages or device diagnostics to show something is
going wrong. If your problem is more of a question or a request for help,
then Discussions is
probably a more suitable venue.

Describe the bug
Fan is successfully added, but the speed is having 3 range, Low, Medium and High with values 1,2 and 3 respectively. My fan supports 5 speed levels by default and with boost it goest to 6th speed. When looking at the percentage calculation its getting devided by 33% since the speed level is divisible by 5 it should be by 20%

To Reproduce
Steps to reproduce the behavior including the device the issue was observed with:
Load Gorilla Fan from Atomberg to the device, try changing speed using controls

Expected behavior
A clear and concise description of what you expected to happen.
User should be able to control the fan speed with its full potential.

Additional context
Add any other context about the problem here.

If the bug involves a device, then please include device diagnostics from
Settings / Devices & Services / Tuya Local (your device) / "1 device"

Please check if there are messages from Tuya Local in the Assistant log (Settings / System / Logs), and include those too.

If applicable, add screenshots to help explain your problem.

--- Logging error ---
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/logging/handlers.py", line 1497, in emit
    self.enqueue(self.prepare(record))
                 ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/logging/handlers.py", line 1479, in prepare
    msg = self.format(record)
          ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/logging/__init__.py", line 999, in format
    return fmt.format(record)
           ^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/logging/__init__.py", line 703, in format
    record.message = record.getMessage()
                     ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/logging/__init__.py", line 392, in getMessage
    msg = msg % self.args
          ~~~~^~~~~~~~~~~
TypeError: not all arguments converted during string formatting
Call stack:
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/usr/src/homeassistant/homeassistant/__main__.py", line 220, in <module>
    sys.exit(main())
  File "/usr/src/homeassistant/homeassistant/__main__.py", line 208, in main
    exit_code = runner.run(runtime_conf)
  File "/usr/src/homeassistant/homeassistant/runner.py", line 190, in run
    return loop.run_until_complete(setup_and_run_hass(runtime_config))
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 672, in run_until_complete
    self.run_forever()
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 639, in run_forever
    self._run_once()
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1988, in _run_once
    handle._run()
  File "/usr/local/lib/python3.12/asyncio/events.py", line 88, in _run
    self._context.run(self._callback, *self._args)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1001, in _async_write_ha_state_from_call_soon_threadsafe
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1132, in _async_write_ha_state
    state, attr, capabilities, shadowed_attr = self.__async_calculate_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1069, in __async_calculate_state
    if state_attributes := self.state_attributes:
  File "/usr/src/homeassistant/homeassistant/components/fan/__init__.py", line 421, in state_attributes
    data[ATTR_PERCENTAGE_STEP] = self.percentage_step
  File "/config/custom_components/tuya_local/fan.py", line 128, in percentage_step
    _LOGGER.debug("Getting percentage step",self)
  File "/usr/local/lib/python3.12/logging/__init__.py", line 1527, in debug
    self._log(DEBUG, msg, args, **kwargs)
  File "/usr/local/lib/python3.12/logging/__init__.py", line 1684, in _log
    self.handle(record)
  File "/usr/local/lib/python3.12/logging/__init__.py", line 1700, in handle
    self.callHandlers(record)
  File "/usr/local/lib/python3.12/logging/__init__.py", line 1762, in callHandlers
    hdlr.handle(record)
  File "/usr/src/homeassistant/homeassistant/util/logging.py", line 44, in handle
    self.emit(record)
Message: 'Getting percentage step'
Arguments: (<entity fan.fan=on>,)
2024-06-03 13:25:47.475 DEBUG (MainThread) [custom_components.tuya_local.device] Fan received {"3": 1, "full_poll": false}
2024-06-03 13:25:47.475 DEBUG (MainThread) [custom_components.tuya_local.fan] Current speed percentage: 33
2024-06-03 13:25:47.478 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] No mapping for dpid 3 (speed), unable to determine valid values
2024-06-03 13:25:47.478 DEBUG (MainThread) [custom_components.tuya_local.fan] Speed percentage step: 33.333333333333336
2024-06-03 13:25:48.946 DEBUG (MainThread) [custom_components.tuya_local.device] Fan received {"102": 50, "full_poll": fal

Diagnostics Dumb
Home

100% speed set from local tuya, Which is speed 3 for fan
Screenshot 2024-06-03 at 1 22 46 PM

When fan set to max speed manually using remote.
Screenshot 2024-06-03 at 1 22 41 PM

@aravindjaimon aravindjaimon added the bug Something isn't working label Jun 3, 2024
@make-all make-all removed the bug Something isn't working label Jun 3, 2024
@make-all
Copy link
Owner

make-all commented Jun 3, 2024

This isn't on the supported devices list, and the stack trace from the log does not match the unmodified code. So it isn't clear what can be done here.

@make-all make-all closed this as not planned Won't fix, can't repro, duplicate, stale Jun 3, 2024
@aravindjaimon
Copy link
Contributor Author

Hi @make-all, Thanks for the docs and your pointer to #22, It helped be to create the config for my fan. Following is the same.

name: Gorilla Fan V2
primary_entity:
  entity: fan
  dps:
    - id: 1
      type: boolean
      name: switch
    - id: 2
      type: string
      name: mode
      mapping:
        - dps_value: normal
          value: normal
        - dps_value: boost
          value: boost
    - id: 3
      type: integer
      name: speed
      range:
        min: 1
        max: 5

secondary_entities:
  - entity: light
    name: Night Light
    dps:
      - id: 15
        type: boolean
        name: switch
  - entity: switch
    name: Boost
    dps:
      - id: 115
        type: boolean
        name: switch
  - entity: switch
    name: Sleep
    dps:
      - id: 113
        type: boolean
        name: switch
  - entity: number
    name: Timer
    translation_key: timer
    category: config
    dps:
      - id: 102
        type: integer
        name: value
        unit: min
        range:
          min: 0
          max: 360

However need to do some improvements, In the timer how to make it options the options are 1 hour, 2 hours, 3 hours and 6 hours with values 60, 120, 180 and 360 respectively.

Also is it possible to make the fan speed to be in 5 steps instead of percentage?

Do you suggest any further improvements?

Following is how it looks on my screen, for the above configuration
Screenshot 2024-06-03 at 6 16 11 PM
Screenshot 2024-06-03 at 6 16 03 PM

@make-all make-all added new device Unsupported device config provided Config included by reporter labels Jun 3, 2024
@make-all make-all reopened this Jun 3, 2024
@aravindjaimon
Copy link
Contributor Author

@make-all Ill create the PR, if you can point me to my doubts above.

Thanks!!

@aravindjaimon
Copy link
Contributor Author

@make-all Thank you for maintaining this repository! I have submitted a pull request (#1988) that adds support for this fan. Please let me know if you have any feedback or if there's anything else I can do to help get it merged.

@make-all make-all added unreleased Will be in next release and removed config provided Config included by reporter new device Unsupported device unreleased Will be in next release labels Jul 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants