# Glühbirne/Steckdose zum Blinken bringen

**URL:** <https://community.gladysassistant.com/t/faire-clignoter-une-ampoule-prise/8435>\
**Category:** Demandes livrées\
**Created:** [30. Oktober 2023 um 21:49 UTC](https://community.gladysassistant.com/t/faire-clignoter-une-ampoule-prise/8435 "2023-10-30T21:49:47Z")\
**Posts on this page:** 13\
**Page:** 2

<div class="post-metadata">

**Author:** ![cicoub13](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/cicoub13/32/4482_2.png) [@cicoub13](https://community.gladysassistant.com/u/cicoub13)\
**Post date:** [15. Februar 2024 um 13:30 UTC](https://community.gladysassistant.com/t/faire-clignoter-une-ampoule-prise/8435/21 "2024-02-15T13:30:27Z")

</div>

In der Zwischenzeit ist ein neues Bild 🐋 verfügbar `cicoub13/gladys:blinking-lights`. Was behoben wurde, ist die Tatsache, dass die Aktion blockierend ist.

Zum Beispiel, wenn Sie eine Aktion «&nbsp;Nachricht senden&nbsp;» hinzufügen, wird dies erst erfolgen, nachdem das Licht aufgehört hat zu blinken.

---

<div class="post-metadata">

**Author:** ![pierre-gilles](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/pierre-gilles/32/5886_2.png) [@pierre-gilles](https://community.gladysassistant.com/u/pierre-gilles)\
**Post date:** [15. Februar 2024 um 13:53 UTC](https://community.gladysassistant.com/t/faire-clignoter-une-ampoule-prise/8435/22 "2024-02-15T13:53:10Z")

</div>

> [@cicoub13](#):
>
> Aber bei den Tests möchte ich keine Zeitkonzepte verwalten und mein Promise sofort auflösen. Ich verwende also `proxyquire`, um die Methode durch ein einfaches `fake`-Promise zu ersetzen.

2 Möglichkeiten, das zu lösen 🙂

Zuerst, wenn du die Zeit in den Tests beeinflussen kannst!

[https://sinonjs.org/releases/latest/fake-timers/](https://sinonjs.org/releases/latest/fake-timers/)

Ansonsten kannst du in deinen Tests viel kleinere Zeiten verwenden, damit es schneller durchläuft.

---

<div class="post-metadata">

**Author:** ![cicoub13](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/cicoub13/32/4482_2.png) [@cicoub13](https://community.gladysassistant.com/u/cicoub13)\
**Post date:** [15. Februar 2024 um 13:57 UTC](https://community.gladysassistant.com/t/faire-clignoter-une-ampoule-prise/8435/23 "2024-02-15T13:57:10Z")

</div>

Ich war auf die Option Fake-Uhr (die mir einfacher erscheint) gegangen, aber es hat nicht funktioniert. Ich werde es nochmal versuchen, danke.

---

<div class="post-metadata">

**Author:** ![cce66](https://gladys-assistant-community.b-cdn.net/letter_avatar_proxy/v4/letter/c/8797f3/32.png) [@cce66](https://community.gladysassistant.com/u/cce66)\
**Post date:** [15. Februar 2024 um 15:51 UTC](https://community.gladysassistant.com/t/faire-clignoter-une-ampoule-prise/8435/24 "2024-02-15T15:51:48Z")

</div>

hallo @cicoub13

Nur zwei kleine Anmerkung:  
Warum multiplizierst du deine Konstante blinking\_time nicht direkt bei ihrer Deklaration, um die Berechnung in der Schleife zu vermeiden?  
const blinkingTime = action.blinking\_time \* 1000 ;  
Ich habe immer doppelte Variablennamen verwendet (ii statt i) — das ist später leichter nachzuverfolgen!

Ansonsten bin ich in dieser Sprache nicht gut genug bewandert! 🥴

---

<div class="post-metadata">

**Author:** ![Terdious](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/terdious/32/6316_2.png) [@Terdious](https://community.gladysassistant.com/u/Terdious)\
**Post date:** [15. Februar 2024 um 17:35 UTC](https://community.gladysassistant.com/t/faire-clignoter-une-ampoule-prise/8435/25 "2024-02-15T17:35:46Z")

</div>

Hallo @cicoub,

Ich weiß nicht, ob dir das weiterhilft und ob der Fall zutrifft:  
[server/test/services/netatmo/lib/netatmo.pollRefreshingValues.test.js](https://github.com/GladysAssistant/Gladys/blob/master/server/test/services/netatmo/lib/netatmo.pollRefreshingValues.test.js)

… ich hoffe …

Ich habe mich damit herumgeschlagen, es zum Laufen zu bringen. Aber mit einer Mischung aus Copilot / ChatGPT / Stackoverflow hat es mit dieser Kombination funktioniert (insbesondere der erste Test)

Du wirst diesen Teil im zweiten Test bemerken:

```auto
    clock.tick(120 * 1000);
    clock.restore();
    // eslint-disable-next-line no-promise-executor-return
    await new Promise((resolve) => setTimeout(resolve, 50));

```

Um 120 Sekunden zu überspringen, dann den clock zu stoppen und das Versprechen zu erfüllen. Es hat nicht funktioniert ohne das clock.restore(), weil es zu einem Konflikt in der Zeiterfassung kommt (soweit ich das verstanden habe… ^^)

---

<div class="post-metadata">

**Author:** ![cicoub13](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/cicoub13/32/4482_2.png) [@cicoub13](https://community.gladysassistant.com/u/cicoub13)\
**Post date:** [16. Februar 2024 um 14:55 UTC](https://community.gladysassistant.com/t/faire-clignoter-une-ampoule-prise/8435/26 "2024-02-16T14:55:34Z")

</div>

> [@cce66](#):
>
> Warum multiplizierst du deine Konstante blinking\_time nicht direkt bei ihrer Deklaration, um die Berechnung in der Schleife zu vermeiden

Das ist korrigiert, danke

---

<div class="post-metadata">

**Author:** ![cicoub13](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/cicoub13/32/4482_2.png) [@cicoub13](https://community.gladysassistant.com/u/cicoub13)\
**Post date:** [16. Februar 2024 um 15:02 UTC](https://community.gladysassistant.com/t/faire-clignoter-une-ampoule-prise/8435/27 "2024-02-16T15:02:01Z")

</div>

Das funktioniert mit den Fake-Timern von SinonJS. Ich musste auf Version **8.1.1** aktualisieren (zuvor **7.2.4** ), um `clock.tickAsync()` nutzen zu können.

Übrigens, sie sind bereits bei Version 17 😓

Danke @Terdious und @pierre-gilles, das war nicht einfach, diese Tests mit Zeitkonzepten 😅

Ich sage dir Bescheid, wenn alles fertig ist

---

<div class="post-metadata">

**Author:** ![cicoub13](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/cicoub13/32/4482_2.png) [@cicoub13](https://community.gladysassistant.com/u/cicoub13)\
**Post date:** [16. Februar 2024 um 17:57 UTC](https://community.gladysassistant.com/t/faire-clignoter-une-ampoule-prise/8435/28 "2024-02-16T17:57:09Z")

</div>

PR bereit (funktional, Entwicklung, Tests) 🎉

> <https://github.com/GladysAssistant/Gladys/pull/2007>
>
> \### Pull Request check-list
> 
> To ensure your Pull Request can be accepted as fa…st as possible, make sure to review and check all of these items:
> 
> \- \[x\] If your changes affects code, did your write the tests?
> \- \[x\] Are tests passing? (\`npm test\` on both front/server)
> \- \[x\] Is the linter passing? (\`npm run eslint\` on both front/server)
> \- \[x\] Did you run prettier? (\`npm run prettier\` on both front/server)
> \- \[x\] If you are adding a new features/services, did you run integration comparator? (\`npm run compare-translations\` on front)
> \- \[x\] Did you test this pull request in real life? With real devices? If this development is a big feature or a new service, we recommend that you provide a Docker image to the community (\[french forum\](https://community.gladysassistant.com/)/\[english forum\](https://en-community.gladysassistant.com/)) for testing before merging.
> 
> NOTE: these things are not required to open a PR and can be done afterwards / while the PR is open.
> 
> \### Description of change
> 
> Please provide a description of the change here. It's always best with screenshots, so don't hesitate to add some!

---

<div class="post-metadata">

**Author:** ![pierre-gilles](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/pierre-gilles/32/5886_2.png) [@pierre-gilles](https://community.gladysassistant.com/u/pierre-gilles)\
**Post date:** [26. Februar 2024 um 08:18 UTC](https://community.gladysassistant.com/t/faire-clignoter-une-ampoule-prise/8435/29 "2024-02-26T08:18:30Z")

</div>

Danke für die PR @cicoub13 🙂

Ich habe einen kleinen Bug beim Testen in der Praxis gefunden:

> <https://github.com/GladysAssistant/Gladys/pull/2007#pullrequestreview-1900184985>
>
> \### Pull Request check-list
> 
> To ensure your Pull Request can be accepted as fa…st as possible, make sure to review and check all of these items:
> 
> \- \[x\] If your changes affects code, did your write the tests?
> \- \[x\] Are tests passing? (\`npm test\` on both front/server)
> \- \[x\] Is the linter passing? (\`npm run eslint\` on both front/server)
> \- \[x\] Did you run prettier? (\`npm run prettier\` on both front/server)
> \- \[x\] If you are adding a new features/services, did you run integration comparator? (\`npm run compare-translations\` on front)
> \- \[x\] Did you test this pull request in real life? With real devices? If this development is a big feature or a new service, we recommend that you provide a Docker image to the community (\[french forum\](https://community.gladysassistant.com/)/\[english forum\](https://en-community.gladysassistant.com/)) for testing before merging.
> 
> NOTE: these things are not required to open a PR and can be done afterwards / while the PR is open.
> 
> \### Description of change
> 
> Please provide a description of the change here. It's always best with screenshots, so don't hesitate to add some!

Aber nichts Schlimmes, ansonsten funktioniert das Verhalten gut!

---

<div class="post-metadata">

**Author:** ![cicoub13](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/cicoub13/32/4482_2.png) [@cicoub13](https://community.gladysassistant.com/u/cicoub13)\
**Post date:** [26. Februar 2024 um 16:54 UTC](https://community.gladysassistant.com/t/faire-clignoter-une-ampoule-prise/8435/30 "2024-02-26T16:54:18Z")

</div>

Das ist korrigiert

---

<div class="post-metadata">

**Author:** ![pierre-gilles](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/pierre-gilles/32/5886_2.png) [@pierre-gilles](https://community.gladysassistant.com/u/pierre-gilles)\
**Post date:** [1. März 2024 um 08:46 UTC](https://community.gladysassistant.com/t/faire-clignoter-une-ampoule-prise/8435/31 "2024-03-01T08:46:21Z")

</div>

Danke für das Fix @cicoub13! Für mich ist es okay, es ist in master gemerged und wird in der nächsten Version von Gladys enthalten sein 🙂

---

<div class="post-metadata">

**Author:** ![pierre-gilles](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/pierre-gilles/32/5886_2.png) [@pierre-gilles](https://community.gladysassistant.com/u/pierre-gilles)\
**Post date:** [4. März 2024 um 09:20 UTC](https://community.gladysassistant.com/t/faire-clignoter-une-ampoule-prise/8435/32 "2024-03-04T09:20:35Z")

</div>

Diese Funktion ist in Gladys Assistant 4.38 verfügbar 🙂

Ich schließe dieses Thema, um die Stimmen freizugeben. Zögern Sie nicht, bei Problemen/Feedback andere Themen zu erstellen 🙂

> [@Gladys Assistant 4.38: Netatmo Wetterstation + Z-Wave Sensoren + Glühbirne blinken lassen](https://community.gladysassistant.com/t/gladys-assistant-4-38-station-meteo-netatmo-capteurs-z-wave-clignoter-ampoule/8751):
>
> Salut à tous ! C’est lundi, et c’est l’heure d’une nouvelle version pour Gladys partying_face Au programme aujourd’hui: Station météo Netatmo Encore @Terdious qui frappe fort avec la gestion de nouveaux appareils Netatmo fire Quelques captures des nouveaux appareils gérés : Pour en savoir plus : [Connecter ses thermostats Netatmo à sa maison connectée | Gladys Assistant](https://gladysassistant.com/fr/docs/integrations/netatmo/) Z-WaveJS - Nouveaux capteurs @Sescandell a ajouté la possibilité d…

Vielen Dank an @cicoub13 für die Entwicklung 🙏

---

<div class="post-metadata">

**Author:** ![pierre-gilles](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/pierre-gilles/32/5886_2.png) [@pierre-gilles](https://community.gladysassistant.com/u/pierre-gilles)\
**Post date:** [4. März 2024 um 09:20 UTC](https://community.gladysassistant.com/t/faire-clignoter-une-ampoule-prise/8435/33 "2024-03-04T09:20:37Z")

</div>



[Vorherige Seite](https://community.gladysassistant.com/t/faire-clignoter-une-ampoule-prise/8435.md?page=1)
