esphome / issues

Issue Tracker for ESPHome
https://esphome.io/
290 stars 34 forks source link

Speed Fan Component Oscillation Control #5437

Closed madchuska closed 3 months ago

madchuska commented 8 months ago

The problem

When switching the fan off oscillation stays on.

I'd expect it to behave similarly to a pedestal fan with mechanical oscillation and turn off when the fan turns off. I cant see a use case where a fan should continue to oscillate once it's turned off.

I have tried to use fan.turn_off, oscillate: false as a workaround but got this error - [oscillating] is an invalid option for [fan.turn_off]

I did also try to turn off the output directly which works but this stops the state from updating in the frontend.

Which version of ESPHome has the issue?

2023.12.9

What type of installation are you using?

Home Assistant Add-on

Which version of Home Assistant has the issue?

2023.12.1

What platform are you using?

BK72XX

Board

generic-bk7231t-qfn32-tuya

Component causing the issue

Speed Fan

Example YAML snippet

substitutions:
  device_name: "workshop-fan"
  name: "Workshop Fan"

esphome:
  name: ${device_name}
  comment: ${name}

bk72xx:
  board: generic-bk7231t-qfn32-tuya

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  ap:

  # Optional manual IP
  manual_ip:
   static_ip: 192.168.1.73
   gateway: 192.168.1.1
   subnet: 255.255.255.0

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: !secret api_encryption_key
ota:
  password: "631ef57258314c7a68aec23d7b1bcb38"

web_server:

captive_portal:

mdns:

text_sensor:
  - platform: libretiny
    version:
      name: LibreTiny Version

binary_sensor:
  - platform: gpio
    id: binary_switch_1
    pin:
      number: P9
      inverted: true
      mode: INPUT_PULLUP
    on_press:
      then:
        - switch.toggle: switch_1
  - platform: gpio
    id: binary_switch_2
    pin:
      number: P10
      inverted: true
      mode: INPUT_PULLUP
    on_press:
      then:
        - switch.toggle: switch_2
  - platform: gpio
    id: binary_switch_3
    pin:
      number: P14
      inverted: true
      mode: INPUT_PULLUP
    on_press:
      then:
        - switch.toggle: switch_3

switch:
  - platform: gpio
    id: switch_1
    name: Relay 1
    pin: P26
    interlock: [switch_2, switch_3]
    internal: true
  - platform: gpio
    id: switch_2
    name: Relay 2
    pin: P24
    interlock: [switch_1, switch_3]
    internal: true
  - platform: gpio
    id: switch_3
    name: Relay 3
    pin: P8
    interlock: [switch_1, switch_2]
    internal: true

status_led:
  pin:
    number: P1
    inverted: false

output:
  - platform: template
    type: float
    id: fan_decode
    write_action:
      - lambda: |-
          if (state < 0.25) {
            id(switch_1).turn_off();
            id(switch_2).turn_off();
            id(switch_3).turn_off();
            id(osc).turn_off();
          }
          else if (state < 0.5) {
            id(switch_1).turn_on();
            id(switch_2).turn_off();
            id(switch_3).turn_off();
            id(osc).turn_on();
          }
          else if (state < 0.75) {
            id(switch_1).turn_on();
            id(switch_2).turn_on();
            id(switch_3).turn_off();
            id(osc).turn_on();
          }
          else {
            id(switch_1).turn_on();
            id(switch_2).turn_off();
            id(switch_3).turn_on();
            id(osc).turn_on();
          }

  - platform: gpio
    pin: P7
    id: osc

fan:
  - platform: speed
    output: fan_decode
    name: ${name}
    icon: mdi:fan
    restore_mode: RESTORE_DEFAULT_OFF
    speed_count: 3
    id: workshopfan
    oscillation_output: osc
    on_turn_on:
        - fan.turn_on:
            id: workshopfan
            oscillating: true
    on_turn_off:
        - fan.turn_off:
            id: workshopfan
          #  oscillating: false

Anything in the logs that might be useful for us?

No

Additional information

No response

github-actions[bot] commented 4 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.