resoai / TileBoard

A simple yet highly configurable Dashboard for HomeAssistant
MIT License
1.63k stars 278 forks source link

fan.set_speed is deprecated #669

Open joeyjojo747 opened 3 years ago

joeyjojo747 commented 3 years ago

Trying to use for a fan error log: fan.set_speed is deprecated, use fan.set_percentage or fan.set_preset_mode instead.

rchl commented 3 years ago

How does HA handle those? Does it show a list of percentages to choose from or provides +/- to increase by a certain amount?

Also, can you post the dump of the fan entity so that we can see its attributes?

joeyjojo747 commented 3 years ago

It is presented as a slider for percentages.

Dump from fan template Also My template below

from homeassistant.components.fan import (
    ATTR_DIRECTION,
    ATTR_OSCILLATING,
    ATTR_PERCENTAGE,
    ATTR_PRESET_MODE,
    ATTR_SPEED,
    DIRECTION_FORWARD,
    DIRECTION_REVERSE,
    ENTITY_ID_FORMAT,
    SPEED_HIGH,
    SPEED_LOW,
    SPEED_MEDIUM,
    SPEED_OFF,
    SUPPORT_DIRECTION,
    SUPPORT_OSCILLATE,
    SUPPORT_SET_SPEED,
    FanEntity,
    preset_modes_from_speed_list,
)
from homeassistant.const import (
    CONF_ENTITY_ID,
    CONF_FRIENDLY_NAME,
    CONF_UNIQUE_ID,
    CONF_VALUE_TEMPLATE,
    STATE_OFF,
    STATE_ON,
    STATE_UNAVAILABLE,
    STATE_UNKNOWN,
)
fan:
  - platform: template
    fans:
      deck_fan:
        unique_id: deck_fan
        friendly_name: "Deck fan"
        value_template: "{{ states('input_boolean.deck_fan_state') }}"
        percentage_template: "{{ states('input_number.deck_fan_percentage') }}"
        preset_mode_template: "{{ states('input_select.deck_fan_preset_mode') }}"
        direction_template: "{{ 'forward' if is_state('input_boolean.deck_fan_direction', 'on') else 'reverse' }}"
        turn_on:
          service: script.deck_fan_on
        turn_off:
          service: script.deck_fan_off
        set_percentage:
          service: script.deck_fan_set_speed
          data:
            percentage: "{{ percentage }}"
        set_preset_mode:
          service: script.deck_fan_set_preset_mode
          data:
            preset_mode: "{{ preset_mode }}"
        set_direction:
          service: script.fan_direction
          data:
            direction: "{{ direction }}"
        speed_count: 6
        preset_modes:
          - '1 hour'
          - '2 hours'
          - '4 hours'
          - '8 hours'