Je rencontre un problème avec l’appareil “Mode” de chauffage.
Quand je le mets sur le dashboard et que je veux changer de mode de chauffage, il se mets à clignoter, comme dans la vidéo. Ça me fait planter l’interface de Gladys. Je dois la fermer et la ré-ouvrir.
Je ne sais pas si ça vient de l’appareil ou de mes scènes qui utilisent ce module z-wave.
Quelqu’un a-t-il le même problème ?
Salut @gaetanb76 ,
Merci pour le retour et pour la vidéo, ça aide beaucoup !
D’après ce que j’ai regardé, le souci ne vient ni de ton module Z-Wave ni de tes scènes, mais de l’interface de Gladys. À chaque fois qu’un appareil remonte un état, le widget se ré-affiche, et sur Android cela fait se refermer puis se rouvrir le menu de sélection du mode, d’où le clignotement. Tes scènes et ton module ne font que rendre ces mises à jour plus fréquentes, ce qui rend le bug plus visible.
J’ai ouvert une issue GitHub pour le suivre :
ouvert 08:36AM - 23 Nov 26 UTC
type:fix
Forum: https://community.gladysassistant.com/t/clignotement-selection-mode-chauf… fage-sur-android/11655
### Describe the bug
On Android, a "Devices" box showing a heater **pilot wire mode** feature (`heater` / `pilot-wire-mode`) renders a native `<select>` (Off / Frost protection / Eco / Comfort -2 °C / Comfort -1 °C / Comfort). When the user taps it, the native picker keeps closing and reopening in a loop: it flickers (the video in the forum topic shows two copies of the picker at once, one of them fading in again) and no option can be picked. The user has to close and reopen Gladys.
The user's setup: a Z-Wave pilot wire module, plus scenes that write the mode into a text feature shown in the same box ("Chauffage Cuisine Mode").
### Likely cause (from reading the code, not reproduced on a device yet)
Two things add up:
1. **`DevicesBox` re-renders on every device event, even for features it does not show.** `updateDeviceStateWebsocket` and `updateDeviceTextWebsocket` (`front/src/components/boxs/device-in-room/DevicesBox.jsx`) call `setState` with a new array (`deviceFeatures.map(...)`) for every `device.new-state` / `device.new-string-state` message, whatever the feature. With Z-Wave devices reporting often and scenes writing text states, every Devices box on the dashboard re-renders continuously.
2. **Each render writes `select.value` again.** The widget passes `value={props.deviceFeature.last_value}`, a number (`PILOT_WIRE_MODE.COMFORT === 5`), while `dom.value` is the string `"5"`. Preact compares `5 !== "5"`, sees a difference, and sets `select.value` on every render. As far as we know, Chrome on Android hides and re-shows the native picker of an open `<select>` when its value or options are updated from script. This Chromium behavior hasn't been checked on a device, but it matches the video.
The same `value={last_value}` pattern exists in:
- `PilotWireModeDeviceFeature.jsx`
- `FanModeDeviceFeature.jsx`
- `FanLabeledSelectDeviceFeature.jsx`
- `VacuumCleanerModeDeviceFeature.jsx`
- `VacuumCleanerCleanModeDeviceFeature.jsx`
(all in `front/src/components/boxs/device-in-room/device-features/`)
The scenes and the Z-Wave module are not the cause: they only make the device events more frequent, so the picker resets more often.
### To reproduce
1. On a dashboard, add a "Devices" box with a pilot wire mode feature.
2. Have other devices sending states frequently (any sensor, or a scene writing a text feature every few seconds).
3. Open the dashboard in Chrome on Android (or the PWA) and tap the mode select.
4. The picker flickers (closes and reopens) and cannot be used.
### Expected behavior
The picker stays open until the user picks an option or dismisses it, whatever device events arrive meanwhile.
### Suggested fix
- In `DevicesBox`, skip the `setState` when the event's feature is not one of the box's features. This avoids re-rendering every box on each event, which also helps performance.
- In the select-based widgets above, pass the value as a string (`value={last_value === null ? '' : String(last_value)}` or similar), so that a render that does not change the value does not touch the DOM. This also covers an event for the shown feature arriving while the picker is open.
### Gladys Assistant version
Not given in the forum report.
### Installation type
Not given in the forum report. The issue is on the client side (Android browser / PWA).
J’ai aussi déplacé ton sujet dans la bonne catégorie pour qu’il ne soit pas perdu