FHEM Forum

FHEM => Codeschnipsel => Thema gestartet von: Loredo am 16 April 2014, 20:24:28

Titel: HUE Farbtemperatur automatisch dem Tag anpassen
Beitrag von: Loredo am 16 April 2014, 20:24:28

Ich habe 2 kleine Notifies, die dafür sorgen, dass die Farbtemperatur meiner Hue Bulbs immer entsprechend des Tagesverlaufs angepasst werden.
Vielleicht findet es ja noch jemand nützlich.



# correct HUE color temperature according to twilight in case I change to colormode "ct"
#
define n_HUE_ct.cm notify HUE_HUEDevice.*:colormode:.*ct {
  my $light=ReadingsVal("Twilight","light",0);
  if ($light == 6 ) {fhem "set $NAME:FILTER=pct!=0 color 6500"}
  elsif ($light < 6 && $light > 0 ) {fhem "set $NAME:FILTER=pct!=0 color 3400"}
  elsif ($light == 0 ) {fhem "set $NAME:FILTER=pct!=0 color 2300"}
}
attr n_HUE_ct.cm room System

# correct HUE color temperature according to twilight in case Twilight light value changes
#
define n_HUE_ct notify Twilight:light.*(0|1|5|6) {
   my $color;
   if ($EVTPART1 == 6){$color = 6500}
   elsif ($EVTPART1 < 6 && $EVTPART1 > 0){$color = 3400}
   else {$color = 2300}

   my @devices=devspec2array("TYPE=HUEDevice");

   foreach(@devices) {
      if ( ReadingsVal($_,"pct",0) > 0 ) {
         fhem "set $_:FILTER=colormode=ct ct $color : transitiontime 3000";
      }
   }
}
attr n_HUE_ct room System
Titel: Antw:HUE Farbtemperatur automatisch dem Tag anpassen
Beitrag von: Loredo am 08 März 2015, 14:52:17
nochmal etwas verschlankt
Titel: Antw:HUE Farbtemperatur automatisch dem Tag anpassen
Beitrag von: m.zielinski am 11 März 2022, 17:27:20
Ich nutze schon eine weile deine notifys. Mir fehlt da noch, dass beim einschalten einer
Lampe die colortemp pasend zur Uhrzeit eingestellt wird und nicht auf den wert des letzten Abend...