jason0x43 / hacs-hubitat

A Hubitat integration for Home Assistant
MIT License
187 stars 46 forks source link

Fan speeds not loading in 2021.7 #132

Open edalquist opened 2 years ago

edalquist commented 2 years ago

I have an Inovelli light/fan switch that uses the Hampton Bay Fan Component for the fan controller. It reports 8 specific speed values. However in Home Assistant the entity presets box only lists auto and on as preset options.

{
   "id":"42",
   "name":"Hampton Bay Fan Component",
   "label":"Office Fan",
   "type":"Hampton Bay Fan Component",
   "attributes":[
      {
         "name":"supportedFanSpeeds",
         "currentValue":null,
         "dataType":"JSON_OBJECT"
      },
      {
         "name":"level",
         "currentValue":33,
         "dataType":"NUMBER"
      },
      {
         "name":"switch",
         "currentValue":"on",
         "dataType":"ENUM",
         "values":[
            "on",
            "off"
         ]
      },
      {
         "name":"speed",
         "currentValue":"low",
         "dataType":"ENUM",
         "values":[
            "low",
            "medium-low",
            "medium",
            "medium-high",
            "high",
            "on",
            "off",
            "auto"
         ]
      }
   ],
   "capabilities":[
      "Actuator",
      "Refresh",
      "FanControl",
      {
         "attributes":[
            {
               "name":"speed",
               "dataType":null
            },
            {
               "name":"supportedFanSpeeds",
               "dataType":null
            }
         ]
      },
      "SwitchLevel",
      {
         "attributes":[
            {
               "name":"level",
               "dataType":null
            }
         ]
      },
      "Switch",
      {
         "attributes":[
            {
               "name":"switch",
               "dataType":null
            }
         ]
      }
   ],
   "commands":[
      "cycleSpeed",
      "off",
      "on",
      "refresh",
      "setLevel",
      "setSpeed"
   ]
}

Hubitat Integration v0.6.12

System Health

version core-2021.7.4
installation_type Home Assistant OS
dev false
hassio true
docker true
virtualenv false
python_version 3.9.5
os_name Linux
os_version 5.10.17-v8
arch aarch64
timezone America/Los_Angeles
Home Assistant Community Store GitHub API | ok -- | -- Github API Calls Remaining | 4955 Installed Version | 1.13.2 Stage | running Available Repositories | 848 Installed Repositories | 5
Home Assistant Cloud logged_in | true -- | -- subscription_expiration | August 14, 2021, 5:00 PM relayer_connected | true remote_enabled | false remote_connected | false alexa_enabled | false google_enabled | true can_reach_cert_server | ok can_reach_cloud_auth | ok can_reach_cloud | ok
Home Assistant Supervisor host_os | Home Assistant OS 6.1 -- | -- update_channel | stable supervisor_version | supervisor-2021.06.8 docker_version | 20.10.6 disk_total | 457.7 GB disk_used | 25.1 GB healthy | true supported | true board | rpi4-64 supervisor_api | ok version_api | ok installed_addons | Mosquitto broker (6.0.1), File editor (5.3.3), InfluxDB (4.1.1), Node-RED (9.2.1), Grafana (7.0.4), Home Assistant Google Drive Backup (0.104.3), SSH & Web Terminal (9.0.0), Tautulli (2.3.0), Log Viewer (0.11.1), Samba share (9.5.1)
Lovelace dashboards | 7 -- | -- resources | 0 views | 11 mode | storage
jason0x43 commented 2 years ago

What do you see in the dev tools in HA?

Screen Shot 2021-08-02 at 8 17 07 AM
edalquist commented 2 years ago

Thank you for the pointer on checking Dev Tools. It looks like the speeds all show up but presets seem to be the thing that propagates to the UI.

Screen Shot 2021-08-02 at 7 34 28 AM Screen Shot 2021-08-02 at 7 35 19 AM
zacs commented 2 years ago

I believe the core issue is that speed_list and speed are deprecated, and the values are supposed to be sent as percentages. So all you'll ever get any more is a slider that snaps to each of its step points.

A fan from Hubitat should never have preset modes, as far as I can tell. The only attributes populated by this component should be percentage_step and percentage. At least I think... the deprecation in HA seems to really emphasize fans that plug into the wall, and not simple ceiling fans.

The reason I'm posting here is because getting a fan exposed from Hubitat->HA->HomeKit results in having 3 switches right now: an on/off as a whole, an auto/on switch for the preset, and a slider for percentage. In case anyone else has the problem, I solved it in customize.yaml by adding this (although the speed_list is probably pointless):

fan.bedroom_fan:
  speed_list:
    - "off"
    - "low"
    - "medium"
    - "high"
  preset_modes: null
  preset_mode: null