Skip to content

Commit 38ece7c

Browse files
committed
fix(sec-touch): correctly set unknown state for 255 speed
1 parent 410d173 commit 38ece7c

File tree

3 files changed

+119
-4
lines changed

3 files changed

+119
-4
lines changed

components/sec_touch/fan/sec_touch_fan.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@ bool SecTouchFan::assign_new_speed_if_needed(int real_speed_from_device) {
7474
}
7575

7676
if (real_speed_from_device == 255) {
77-
if (this->state != 0 || this->speed != 0) {
77+
if (this->state != 0 || this->speed != 255) {
7878
this->state = 0;
79-
this->speed = 0;
79+
this->speed = 255;
8080
return true;
8181
}
8282
return false;
29.3 KB
Loading

components/sec_touch/readme.md

Lines changed: 117 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ This is a component that allows you to control your SEC-TOUCH ventilation contro
33

44
<div class="text-center">
55
<img src="images/sec-touch-panel.webp" alt="SEC-TOUCH Panel" />
6-
<div>
6+
</div>
77

88
(For now) It is limited to change the level of the fan pairs, or put them into their special modes (automatic, time, etc). There is no way to change the timing intervals for now. You need to make that in the SEC-TOUCH device itself.
99

@@ -232,10 +232,125 @@ Please check the [Special Fan level Values](#fan-pair-level-special-values) sect
232232
# Home Assistant
233233
Home assistant has the problem that all fans show their speed as percentage. But we do not have percentage values, we have levels from `0` to `11`. From which some of those values are special ones.
234234

235-
For now we have to "live with" that, selecting presets will carry the fan speed/percent to their corresponding level, but going into `NORMAL` mode will put the speed to 1. I would recommend to use a button card with all the states instead of the fan one until this can be fixed.
235+
For now we have to "live with" that, selecting presets will carry the fan speed/percent to their corresponding level, but going into `NORMAL` mode will put the speed to 1.
236+
237+
My recommendation is to use your own custom card to control the de fans.
238+
239+
## Custom HA Cards Example
240+
241+
Here I am using [lovelace-mushroom](https://github.com/piitaya/lovelace-mushroom), [lovelace-card-mod](https://github.com/thomasloven/lovelace-card-mod) and [service-call-tile-feature](https://github.com/Nerwyn/service-call-tile-feature). On a Sections board.
242+
243+
If you are using the configuration written above, you just need to search and replace `fan_1` with the corresponding fan number to get more cards
244+
![Home Assistant Dashboard](images/ha-dashboard.webp)
236245

237246
```yaml
247+
type: grid
248+
cards:
249+
- type: heading
250+
heading_style: title
251+
heading: Heading
252+
card_mod:
253+
style: |
254+
.container .title {
255+
color: transparent !important;
256+
}
257+
258+
.container .title:after {
259+
content: "{{ states('sensor.esp_ventilation_controller_label_fan_1') }}";
260+
position: absolute;
261+
left: 0px;
262+
color: var(--primary-text-color);
263+
}
264+
- type: custom:mushroom-fan-card
265+
entity: fan.esp_ventilation_controller_fan_1
266+
show_percentage_control: false
267+
fill_container: false
268+
icon_animation: true
269+
collapsible_controls: false
270+
secondary_info: last-updated
271+
primary_info: state
272+
grid_options:
273+
columns: 3
274+
rows: 2
275+
layout: vertical
276+
hold_action:
277+
action: more-info
278+
card_mod:
279+
style:
280+
mushroom-state-info$: |
281+
.primary {
282+
color: transparent !important;
283+
position: relative;
284+
}
285+
.primary:after {
286+
content: "{{ 'Unknown' if state_attr('fan.esp_ventilation_controller_fan_1', 'percentage') | int(0) == 255 else 'Off' if states('fan.esp_ventilation_controller_fan_1') == 'off' else 'On' }}";
287+
position: absolute;
288+
left: 0px;
289+
color: var(--primary-text-color);
290+
width:100%
291+
}
292+
- features:
293+
- style: dropdown
294+
type: fan-preset-modes
295+
- type: custom:service-call
296+
entries:
297+
- type: slider
298+
entity_id: fan.esp_ventilation_controller_fan_1
299+
range:
300+
- 9.09
301+
- 54.55
302+
tap_action:
303+
action: perform-action
304+
target:
305+
entity_id:
306+
- fan.esp_ventilation_controller_fan_1
307+
confirmation: false
308+
perform_action: fan.set_percentage
309+
data:
310+
percentage: |
311+
{{ value | int }}
312+
step: 9.090909090909092
313+
unit_of_measurement: U
314+
label: >-
315+
{% set percentage =
316+
state_attr('fan.esp_ventilation_controller_fan_1', 'percentage') |
317+
float(0) %}
318+
319+
{% if percentage == 0 %}
320+
Off
321+
{% elif percentage <= (6 / 11 * 100) %}
322+
Speed {{ ((percentage / 100) * 10) | round(0, 'floor') + 1 }}
323+
{% else %}
324+
Special Mode
325+
{% endif %}
326+
value_attribute: percentage
327+
autofill_entity_id: true
328+
thumb: flat
329+
type: tile
330+
entity: fan.esp_ventilation_controller_fan_1
331+
grid_options:
332+
columns: 9
333+
rows: 3
334+
icon_tap_action:
335+
action: none
336+
tap_action:
337+
action: none
338+
hold_action:
339+
action: none
340+
card_mod:
341+
style: |
342+
ha-card {
343+
height: auto !important;
344+
}
345+
.container .content {
346+
padding-bottom: 4px;
347+
}
348+
.container .content > *{
349+
display:none;
350+
}
351+
column_span: 1
238352

353+
```
239354
# Development
240355
241356
# Known Ids

0 commit comments

Comments
 (0)