Tengo un problema con el dispositivo “Modo” de calefacción.
Cuando lo pongo en el panel de control y quiero cambiar el modo de calefacción, empieza a parpadear, como en el vídeo. Esto hace que se bloquee la interfaz de Gladys. Tengo que cerrarla y volverla a abrir.
No sé si es un problema del dispositivo o de mis escenas que utilizan este módulo z-wave.
¿Alguien tiene el mismo problema?
Hola @gaetanb76 ,
¡Gracias por el feedback y por el video, ¡es de gran ayuda!
Según lo que he visto, el problema no viene ni de tu módulo Z-Wave ni de tus escenas, sino de la interfaz de Gladys. Cada vez que un dispositivo envía un estado, el widget se vuelve a mostrar, y en Android esto hace que el menú de selección del modo se cierre y se vuelva a abrir, de ahí el parpadeo. Tus escenas y tu módulo solo hacen que estas actualizaciones sean más frecuentes, lo que hace que el error sea más visible.
He abierto una issue en GitHub para seguirlo:
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).
También he movido tu tema a la categoría correcta para que no se pierda