JohNan/homeassistant-wellbeing

BR: Wrong fan speed for A7

Closed this issue · 8 comments

The A7 has the fan speed configurable between 1-5, 1 being 20% and 5 being 100%.

At the moment "fan speed 5" shows up as "fan speed 60%".

Thank you! I didn't know that since the A9 has 1-9. I'll make it detect the A7 and change the interval accordingly. I'll let you know in this issue when it has been pushed. It will probably take a few days.

I've just tried 0.0.4 and it's better, but not 100% correct :-)

image

As can be seen in the picture it shows 50% when it's on speed:2, when it should be 40% (2 out of 5 => 40%).

I assume it includes "0" (from speed_list) in the speed step calculation (100% / count(speed_list) = 16.66%) which makes it b0rk, as 0 is off and speed step should therefore be 20% as can be shown below.

speed	%
0	0%
1	20%
2	40%
3	60%
4	80%
5	100%

Also, I guess supported_features should be 5 instead of 9? Perhaps use speed_step calculation from "supported_features: 5" (100/5 => 20% as speed step) instead of speed_list?

I haven't looked deeper in the code, so take my guesses and assumptions lightly :)

Thanks again for the work you do with this integration! Let me know if you need any more information from me, happy to help out.

Thank you. Yes, I had a hard time getting it to work properly for me too, since as you pointed out 0% is off. I'll give it another round.

If you have time and knowledge you are welcome to try fix it and make a PR 🙂

It didn't work out for the A9 unfortunately.

homeassistant.components.websocket_api.http.connection
Source: util/percentage.py:21
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 20:04:51 (3 occurrences)
Last logged: 20:04:58

[140319028322800] The item "1.2000000000000002"" is not in "[1, 2, 3, 4, 5, 6, 7, 8, 9]"

[140319028322800] The item "3.4000000000000004"" is not in "[1, 2, 3, 4, 5, 6, 7, 8, 9]"

[140319028322800] The item "2.3"" is not in "[1, 2, 3, 4, 5, 6, 7, 8, 9]"


  File "/config/custom_components/wellbeing/fan.py", line 80, in percentage
    return ordered_list_item_to_percentage(self.speed_list, speed)
  File "/usr/src/homeassistant/homeassistant/util/percentage.py", line 21, in ordered_list_item_to_percentage
    raise ValueError(f'The item "{item}"" is not in "{ordered_list}"')
ValueError: The item "1.2000000000000002"" is not in "[1, 2, 3, 4, 5, 6, 7, 8, 9]"

@rasssta what values are you getting?

@rasssta More specifically in the code at the place where it crashes for me. I need to test with values for both appliances.

Not sure what you mean, also not sure how your items could be like that.

speed_list contains 1,2,3,4,5 as shown above, which is what's in use on line 80.

Not sure what happened with the integration and why I got that error. It works now. It must have been some weird value cached or something.