Skip to content
This repository has been archived by the owner on Nov 4, 2023. It is now read-only.

TYPES.FAN tile uses deprecated fan entity attributes #751

Open
slim0287 opened this issue Aug 10, 2021 · 4 comments
Open

TYPES.FAN tile uses deprecated fan entity attributes #751

slim0287 opened this issue Aug 10, 2021 · 4 comments

Comments

@slim0287
Copy link

The TYPES.FAN tile speed control approach in TileBoard/scripts/directives/tile.html uses the fan entity attributes speed and speed_list, both of which are deprecated and replaced with percentage, preset_mode, and preset_modes. This is documented in the Home Assistant developer docs on the fan entity: https://developers.home-assistant.io/docs/core/entity/fan/

For fans with more than three speeds, the deprecated attributes are left blank and then the TileBoard fan tile does not show any speed control. I suggest the TYPES.FAN code be updated to use the new fan entity attributes.

@rchl
Copy link
Collaborator

rchl commented Aug 10, 2021

The logic should be inspired by https://github.com/home-assistant/core/blob/dev/homeassistant/components/fan/__init__.py

This can be a bit tricky to get fully correct.

@jsbrich
Copy link

jsbrich commented May 2, 2022

This would be helpful for me as well. My Enbrighten ZWave Fan switch uses percentage, which the TYPES.FAN didn't handle. I put together a very clunky slider with min=0, max=100, and step=33, but it is not very consistent. I use the step=33 to simulate the low, med, high settings.

@sjthespian
Copy link

sjthespian commented Dec 15, 2022

I'm starting to look at TileBoard for my wall-mounted tablets, but not having fan speed control is pretty-much a non-starter since I have ceiling fans in nearly every room. @rchl have you had any more thoughts on how to set this up? I'm willing to take a dive into the code, but javascript isn't something I write all that often.

At the most basic level it looks like it's replacing this line in scripts/controllers/main.js:

      callService(item, 'fan', 'set_speed', { speed: option });

with a call to the set_percentage service. But it is going to need some logic around how those percentages get set, for example polling the percentage_step from the fan device and defining how to map speeds to percentages... That probably also implies creating fan speed up and down methods as well that would just increase the percentage by percentage_step. And then everyone (myself included) is going to want to be able to define a hash to map speed percentages to the display value.

What I find really odd in the HA implementation is that percentage_step doesn't map to reality. For example if I set my office fan on low, it shows 25% for the percentage on the device. 74% is medium, and 100% is high. That doesn't match the percentage_step value of 33.333%.

Entity State Attributes
fan.office_fanOffice Fan on preset_modes: null
percentage: 25
percentage_step: 33.333333333333336
preset_mode: null
friendly_name: Office Fan
supported_features: 1
-- -- --

@rchl
Copy link
Collaborator

rchl commented Dec 16, 2022

Sorry but I can't help much here. I don't really have time to maintain this code and even if I would, I don't have any devices to test with.

If someone provides a pull request then it would most likely be merged (though most likely without thorough review due to no devices to test with).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants