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

dmaker.fan.p33 can only be set to 25, 50, 75 and 100% #276

Open
broekhuijsen opened this issue Aug 30, 2024 · 21 comments
Open

dmaker.fan.p33 can only be set to 25, 50, 75 and 100% #276

broekhuijsen opened this issue Aug 30, 2024 · 21 comments

Comments

@broekhuijsen
Copy link

I have both a dmaker.fan.p33 and a dmaker.fan.p18.

The dmaker.fan.p18 I can set from 1 to 100 %

The dmaker.fan.p33 can only be set to 25, 50, 75 and 100%

I have used the model: dmaker.fan.p18 option in the configuration to force it to think it is a dmaker.fan.p18 (the only difference should be the battery). But that does not seem to work either.

@syssi
Copy link
Owner

syssi commented Aug 31, 2024

It looks like the implementation of the dmaker.fan.p33 is incomplete here:

    """
    TODO:
    - fan.turn_on works, but doesn't go to the declared percentage. This is
      not an issue when using set_percentage()
    - setting child lock works, but HA always reads the value as null
    """

https://github.com/syssi/xiaomi_fan/blob/develop/custom_components/xiaomi_miio_fan/fan.py#L1877-L1882

You could use the set_percentage service as workaround but I guess you want to control the fan using the UI (lovelace) and the control element of the fan speed doesn't work?

@broekhuijsen
Copy link
Author

Hi there, thanks for your response. Yes that is exactly the case. I want to use the slider in love lace. I don't know if it would be possible to create a number input and link that to a script that uses the set_percentage() to mimic this behaviour. But if the implementation is going to be finished in the near future I might as well just have some patience :D
It is good to know that at least the problem as already known :D

@syssi
Copy link
Owner

syssi commented Aug 31, 2024

Do you know how to put a custom_component into the custom_components folder to poke around a bit? :-)

@broekhuijsen
Copy link
Author

broekhuijsen commented Aug 31, 2024

Barely. I mean I can create a folder and copy files to that folder. But I have little knowledge about how to change code. If, it is usually google - copy - paste, rinse and repeat until I either accidentally do it correct (10%) or give up and feel frustrated (90%) :D

@syssi
Copy link
Owner

syssi commented Aug 31, 2024

Do you use HACS to install custom components? I'm looking for a simple solution to provide a test version of this integration which fixes the issue.

@broekhuijsen
Copy link
Author

I do use HACS yes. You want me to test anything? I have installed custom components before.

@syssi
Copy link
Owner

syssi commented Aug 31, 2024

Yes. I've an idea what's going on here and will provide a fixed version later the day for testing.

@broekhuijsen
Copy link
Author

broekhuijsen commented Aug 31, 2024 via email

@syssi
Copy link
Owner

syssi commented Aug 31, 2024

I've pushed a feature branch containing some fixes. Please use HACS to install the version of the feature branch:

p33-update

  1. Go to http:///developer-tools/action
  2. Select "Chosse entity" and select the "Xiaomi Mi Smart Pedestal Fan Integration update" entity
  3. Tick the version checkbox and set fix-p33-speed
  4. Perform action
  5. Restart Home Assistant

@broekhuijsen
Copy link
Author

broekhuijsen commented Aug 31, 2024

Ok, I followed your instructions but I get an error Failed to perform the action fan/set_percentage. 'speed

After that I deinstalled everything through HACS, reinstalled it, followed your instructions again, but still the same error.

I don't know if the log is of any use.

(I removed the log because it was showing a lot, but nothing more about the fan than what I posted below)

@broekhuijsen
Copy link
Author

2024-08-31 15:04:07.844 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration xiaomi_miio_fan which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
File "/config/custom_components/xiaomi_miio_fan/fan.py", line 1034, in async_set_percentage
File "/config/custom_components/xiaomi_miio_fan/fan.py", line 619, in _try_command
File "/config/custom_components/xiaomi_miio_fan/fan.py", line 2090, in set_speed
File "/config/custom_components/xiaomi_miio_fan/fan.py", line 1034, in async_set_percentage
File "/config/custom_components/xiaomi_miio_fan/fan.py", line 619, in _try_command
File "/config/custom_components/xiaomi_miio_fan/fan.py", line 2090, in set_speed
File "/config/custom_components/xiaomi_miio_fan/fan.py", line 1034, in async_set_percentage
File "/config/custom_components/xiaomi_miio_fan/fan.py", line 619, in _try_command
File "/config/custom_components/xiaomi_miio_fan/fan.py", line 2090, in set_speed
File "/config/custom_components/xiaomi_miio_fan/fan.py", line 1034, in async_set_percentage
File "/config/custom_components/xiaomi_miio_fan/fan.py", line 619, in _try_command
File "/config/custom_components/xiaomi_miio_fan/fan.py", line 2090, in set_speed
File "/config/custom_components/xiaomi_miio_fan/fan.py", line 1034, in async_set_percentage
File "/config/custom_components/xiaomi_miio_fan/fan.py", line 619, in _try_command
File "/config/custom_components/xiaomi_miio_fan/fan.py", line 2090, in set_speed
File "/config/custom_components/xiaomi_miio_fan/fan.py", line 1034, in async_set_percentage
File "/config/custom_components/xiaomi_miio_fan/fan.py", line 619, in _try_command
File "/config/custom_components/xiaomi_miio_fan/fan.py", line 2090, in set_speed
File "/config/custom_components/xiaomi_miio_fan/fan.py", line 1034, in async_set_percentage
File "/config/custom_components/xiaomi_miio_fan/fan.py", line 619, in _try_command
File "/config/custom_components/xiaomi_miio_fan/fan.py", line 2090, in set_speed
File "/config/custom_components/xiaomi_miio_fan/fan.py", line 1034, in async_set_percentage
File "/config/custom_components/xiaomi_miio_fan/fan.py", line 619, in _try_command
File "/config/custom_components/xiaomi_miio_fan/fan.py", line 2090, in set_speed
File "/config/custom_components/xiaomi_miio_fan/fan.py", line 1034, in async_set_percentage
File "/config/custom_components/xiaomi_miio_fan/fan.py", line 619, in _try_command
File "/config/custom_components/xiaomi_miio_fan/fan.py", line 2090, in set_speed
File "/config/custom_components/xiaomi_miio_fan/fan.py", line 1034, in async_set_percentage
File "/config/custom_components/xiaomi_miio_fan/fan.py", line 619, in _try_command
File "/config/custom_components/xiaomi_miio_fan/fan.py", line 2090, in set_speed
File "/config/custom_components/xiaomi_miio_fan/fan.py", line 1034, in async_set_percentage
File "/config/custom_components/xiaomi_miio_fan/fan.py", line 619, in _try_command
File "/config/custom_components/xiaomi_miio_fan/fan.py", line 2090, in set_speed
File "/config/custom_components/xiaomi_miio_fan/fan.py", line 1034, in async_set_percentage
File "/config/custom_components/xiaomi_miio_fan/fan.py", line 619, in _try_command
File "/config/custom_components/xiaomi_miio_fan/fan.py", line 2090, in set_speed
File "/config/custom_components/xiaomi_miio_fan/fan.py", line 1034, in async_set_percentage
File "/config/custom_components/xiaomi_miio_fan/fan.py", line 619, in _try_command
File "/config/custom_components/xiaomi_miio_fan/fan.py", line 2090, in set_speed
File "/config/custom_components/xiaomi_miio_fan/fan.py", line 1034, in async_set_percentage
File "/config/custom_components/xiaomi_miio_fan/fan.py", line 619, in _try_command
File "/config/custom_components/xiaomi_miio_fan/fan.py", line 2090, in set_speed
File "/config/custom_components/xiaomi_miio_fan/fan.py", line 1034, in async_set_percentage
File "/config/custom_components/xiaomi_miio_fan/fan.py", line 619, in _try_command
File "/config/custom_components/xiaomi_miio_fan/fan.py", line 2090, in set_speed
File "/config/custom_components/xiaomi_miio_fan/fan.py", line 1034, in async_set_percentage
File "/config/custom_components/xiaomi_miio_fan/fan.py", line 619, in _try_command
File "/config/custom_components/xiaomi_miio_fan/fan.py", line 2090, in set_speed
File "/config/custom_components/xiaomi_miio_fan/fan.py", line 1034, in async_set_percentage
File "/config/custom_components/xiaomi_miio_fan/fan.py", line 619, in _try_command
File "/config/custom_components/xiaomi_miio_fan/fan.py", line 2090, in set_speed
File "/config/custom_components/xiaomi_miio_fan/fan.py", line 1034, in async_set_percentage
File "/config/custom_components/xiaomi_miio_fan/fan.py", line 619, in _try_command
File "/config/custom_components/xiaomi_miio_fan/fan.py", line 2090, in set_speed

@syssi
Copy link
Owner

syssi commented Aug 31, 2024

Could you enable the debug logging and provide another log capture?

Settings -> Devices & services -> Xiaomi Miio -> Enable debug logging (last item of the left tile)

@syssi
Copy link
Owner

syssi commented Aug 31, 2024

I've pushed another fix. Please call the install update service another time, restart HA and give it another try.

@broekhuijsen
Copy link
Author

Ok the log before the update

home-assistant_xiaomi_miio_fan_2024-08-31T14-29-15.682Z.log

The log after the update

home-assistant_xiaomi_miio_fan_2024-08-31T14-35-00.013Z.log

Unfortunately now it is back to the old behaviour of 25, 50, 75 and 100%

@syssi
Copy link
Owner

syssi commented Aug 31, 2024

Interesting. I have to think about it. :-)

@broekhuijsen
Copy link
Author

broekhuijsen commented Aug 31, 2024 via email

@syssi
Copy link
Owner

syssi commented Aug 31, 2024

It's confusing the p18 behaves different to the p33. Could you provide another debug log of the p18? Could you provide some screenshots too? Which lovelace card do you use exactly?

@broekhuijsen
Copy link
Author

broekhuijsen commented Aug 31, 2024

Here is the log for the P18

home-assistant_xiaomi_miio_fan_2024-08-31T15-04-03.817Z.log

I would expect the P33 and P18 to be equal, because the only difference seemed to be the battery. But apparently they are different.

2024-08-31 16_04_26-Settings – Home Assistant

For the testing I am not using any card. I just click on the entity in the integration and use the slider that pops up.

The living room fan is the P33

@broekhuijsen
Copy link
Author

The strange thing is, all the other features are working fine, like setting the angle, the timer etc etc.

@broekhuijsen
Copy link
Author

image
What is strange, is that the mode shows up as Normal with a Capital N for the P33, but a small N for the P18

`type: vertical-stack
cards:

  • features:
    • type: fan-speed
      type: tile
      entity: fan.living_room_fan
      show_entity_picture: false
      vertical: false
  • type: entity
    state_color: true
    entity: fan.living_room_fan
    attribute: mode
    name: mode
    icon: ''
  • show_name: true
    show_icon: false
    type: button
    tap_action:
    action: call-service
    service: script.living_room_fan_mode_toggle
    target: {}
    show_state: false
    name: Mode Select
    icon: mdi:toggle-switch
  • type: entity
    entity: fan.living_room_fan
    attribute: angle
    name: swing range angle
    unit: º
  • type: horizontal-stack
    cards:
    • show_name: true
      show_icon: false
      type: button
      tap_action:
      action: call-service
      service: xiaomi_miio_fan.fan_set_oscillation_angle
      target: {}
      data:
      entity_id: fan.living_room_fan
      angle: 30
      name: '30'
      icon: ''
      show_state: false
    • show_name: true
      show_icon: false
      type: button
      tap_action:
      action: call-service
      service: xiaomi_miio_fan.fan_set_oscillation_angle
      target: {}
      data:
      entity_id: fan.living_room_fan
      angle: 60
      name: '60'
      icon: mdi:axis-z-rotate-clockwise
      show_state: false
    • show_name: true
      show_icon: false
      type: button
      tap_action:
      action: call-service
      service: xiaomi_miio_fan.fan_set_oscillation_angle
      target: {}
      data:
      entity_id: fan.living_room_fan
      angle: 90
      name: '90'
      icon: mdi:axis-z-rotate-clockwise
      show_state: false
    • show_name: true
      show_icon: false
      type: button
      tap_action:
      action: call-service
      service: xiaomi_miio_fan.fan_set_oscillation_angle
      target: {}
      data:
      entity_id: fan.living_room_fan
      angle: 120
      name: '120'
      icon: mdi:axis-z-rotate-clockwise
      show_state: false
    • show_name: true
      show_icon: false
      type: button
      tap_action:
      action: call-service
      service: xiaomi_miio_fan.fan_set_oscillation_angle
      target: {}
      data:
      entity_id: fan.living_room_fan
      angle: 140
      name: '140'
      icon: mdi:axis-z-rotate-clockwise
      show_state: false
  • type: entity
    name: Timer
    entity: sensor.lr_fan_timer
    icon: mdi:fan-clock
    state_color: false
  • type: horizontal-stack
    cards:
    • show_name: true
      show_icon: false
      type: button
      tap_action:
      action: call-service
      service: xiaomi_miio_fan.fan_set_delay_off
      target: {}
      data:
      delay_off_countdown: 0
      entity_id: fan.living_room_fan
      name: 'Off'
    • show_name: true
      show_icon: false
      type: button
      tap_action:
      action: call-service
      service: xiaomi_miio_fan.fan_set_delay_off
      target: {}
      data:
      entity_id: fan.living_room_fan
      delay_off_countdown: 60
      name: 1hr
    • show_name: true
      show_icon: false
      type: button
      tap_action:
      action: call-service
      service: xiaomi_miio_fan.fan_set_delay_off
      target: {}
      data:
      entity_id: fan.living_room_fan
      delay_off_countdown: 120
      name: 2hrs
  • type: horizontal-stack
    cards:
    • show_name: true
      show_icon: false
      type: button
      tap_action:
      action: call-service
      service: xiaomi_miio_fan.fan_set_delay_off
      target: {}
      data:
      entity_id: fan.living_room_fan
      delay_off_countdown: 180
      name: 3hrs
    • show_name: true
      show_icon: false
      type: button
      tap_action:
      action: call-service
      service: xiaomi_miio_fan.fan_set_delay_off
      target: {}
      data:
      entity_id: fan.living_room_fan
      delay_off_countdown: 240
      name: 4hrs
    • show_name: true
      show_icon: false
      type: button
      tap_action:
      action: call-service
      service: xiaomi_miio_fan.fan_set_delay_off
      target: {}
      data:
      entity_id: fan.living_room_fan
      delay_off_countdown: 300
      name: 5hrs
  • type: horizontal-stack
    cards:
    • show_name: true
      show_icon: false
      type: button
      tap_action:
      action: call-service
      service: xiaomi_miio_fan.fan_set_delay_off
      target: {}
      data:
      entity_id: fan.living_room_fan
      delay_off_countdown: 360
      name: 6hrs
    • show_name: true
      show_icon: false
      type: button
      tap_action:
      action: call-service
      service: xiaomi_miio_fan.fan_set_delay_off
      target: {}
      data:
      entity_id: fan.living_room_fan
      delay_off_countdown: 420
      name: 7hrs
    • show_name: true
      show_icon: false
      type: button
      tap_action:
      action: call-service
      service: xiaomi_miio_fan.fan_set_delay_off
      target: {}
      data:
      entity_id: fan.living_room_fan
      delay_off_countdown: 480
      name: 8hrs
  • type: horizontal-stack
    cards:
    • show_name: false
      show_icon: true
      type: button
      tap_action:
      action: call-service
      service: fan.set_direction
      target:
      entity_id: fan.living_room_fan
      data:
      direction: reverse
      icon: mdi:arrow-left-drop-circle
      name: Move Left
      show_state: true
    • show_name: false
      show_icon: true
      type: button
      tap_action:
      action: call-service
      service: fan.set_direction
      target:
      entity_id: fan.living_room_fan
      data:
      direction: forward
      name: Move Right
      icon: mdi:arrow-right-drop-circle
      show_state: true
      `

@syssi
Copy link
Owner

syssi commented Aug 31, 2024

Note for myself:

speed-vs-presets

Migrate away from speed parameter to percentage vs. preset_mode.

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

2 participants