FHEM Forum

FHEM - Anwendungen => Heizungssteuerung/Raumklima => Thema gestartet von: robertPI am 08 Februar 2018, 12:00:56

Titel: Wochenprofile und Betriebsmodus für HM Thermostate über Kalender auswählen
Beitrag von: robertPI am 08 Februar 2018, 12:00:56
Hallo zusammen,

momentan ist dieser Eintrag eher eine Sammlung zur Unterstützung meiner Frage https://forum.fhem.de/index.php/topic,84010.0.html (https://forum.fhem.de/index.php/topic,84010.0.html) ich kann ihn gerne auf Wunsch mit Erläuterungen für andere als Vorlage ausbauen.

DOIF di_heating
defmod di_heating DOIF ([d_season] eq "Sommer") \
(set structureHeizung [FILTER=desired-temp!=off] controlManu off)\
\
DOELSEIF ([d_season] eq "Winter" and [d_home_mode] eq "Daheim") \
(attr ku.hz.01_Clima tempListTmpl ku.hz.01_Clima_Daheim)\
(set hm tempListG restore)\
(set structureHeizung [FILTER=model=HM-TC-IT-WM-W-EU] regSet weekPrgSel prog2)\
(set structureHeizung [FILTER=controlMode!=auto] controlMode auto)\
(save config)\
\
DOELSEIF ([d_season] eq "Winter" and [d_home_mode] eq "Verreist")\
(deleteattr ku.hz.01_Clima tempListTmpl)\
(set hm tempListG restore)\
(set structureHeizung [FILTER=model=HM-TC-IT-WM-W-EU] regSet weekPrgSel prog1)\
(set structureHeizung controlManu 17)\
(save config)\
\
DOELSEIF ([d_season] eq "Winter" and [d_home_mode] eq "Automatik")\
(deleteattr ku.hz.01_Clima tempListTmpl)\
(set hm tempListG restore)\
(set structureHeizung [FILTER=model=HM-TC-IT-WM-W-EU] regSet weekPrgSel prog1)\
(set structureHeizung [FILTER=controlMode!=auto] controlMode auto)\
(save config)
attr di_heating room System


Structure structureHeizung
defmod structureHeizung structure Heizung sz.tc.01_Climate wz.tc.01_Climate bz.tc.01_Climate ku.hz.01_Clima
attr structureHeizung room System


99_myUtil.pm
sub
Kalenderstart ($)
{
my ($Ereignis) = @_;
my @Ereignisarray = split(/.*:\s/,$Ereignis);
my $Ereignisteil1 = $Ereignisarray[1];
my @uids = split(/;/,$Ereignisteil1);
foreach my $uid (@uids) {
my $Kalendertext = fhem("get MyCalendar_fhem summary uid=$uid 1");
if ($Kalendertext =~ /Daheim/) {
fhem("set d_home_mode Daheim");
}
elsif ($Kalendertext =~ /Verreist/) {
fhem("set d_home_mode Verreist");
}
elsif ($Kalendertext =~ /Party/) {
fhem("set d_home_mode Party");
}
}
}
sub Kalenderende ($) {
my ($Ereignis) = @_;
my @Ereignisarray = split(/.*:\s/,$Ereignis);
my $Ereignisteil1 = $Ereignisarray[1];
my @uids = split(/;/,$Ereignisteil1);
foreach my $uid (@uids) {
my $Kalendertext = fhem("get MyCalendar_fhem summary uid=$uid 1");
if ($Kalendertext =~ /Daheim/) {
fhem("set d_home_mode Automatik");
}
elsif ($Kalendertext =~ /Verreist/) {
fhem("set d_home_mode Automatik");
}
elsif ($Kalendertext =~ /Party/) {
fhem("set d_home_mode Automatik");
}
}
}


notify n_MyCalendar_fhem_start
defmod n_MyCalendar_fhem_start notify MyCalendar_fhem:start:.*googlecom.* {Kalenderstart("$EVENT")}
attr n_MyCalendar_fhem_start room System


notify n_MyCalendar_fhem_end
defmod n_MyCalendar_fhem_end notify MyCalendar_fhem:end:.*googlecom.* {Kalenderende("$EVENT")}
attr n_MyCalendar_fhem_end room System


tempList.cfg

entities:bz.hz.01_Clima
R_0_tempListSat>06:00 17.0 09:00 21.0 24:00 17.0
R_1_tempListSun>06:00 17.0 11:00 21.0 24:00 17.0
R_2_tempListMon>05:30 17.0 08:00 21.0 24:00 17.0
R_3_tempListTue>05:30 17.0 08:00 21.0 24:00 17.0
R_4_tempListWed>05:30 17.0 08:00 21.0 24:00 17.0
R_5_tempListThu>05:30 17.0 08:00 21.0 24:00 17.0
R_6_tempListFri>05:30 17.0 08:00 21.0 24:00 17.0
entities:bz.tc.01_Climate
R_P1_0_tempListSat>06:00 17.0 09:00 21.0 24:00 17.0
R_P1_1_tempListSun>06:00 17.0 11:00 21.0 24:00 17.0
R_P1_2_tempListMon>05:30 17.0 08:00 21.0 24:00 17.0
R_P1_3_tempListTue>05:30 17.0 08:00 21.0 24:00 17.0
R_P1_4_tempListWed>05:30 17.0 08:00 21.0 24:00 17.0
R_P1_5_tempListThu>05:30 17.0 08:00 21.0 24:00 17.0
R_P1_6_tempListFri>05:30 17.0 08:00 21.0 24:00 17.0
R_P2_0_tempListSat>06:00 17.0 09:00 21.0 24:00 17.0
R_P2_1_tempListSun>06:00 17.0 11:00 21.0 24:00 17.0
R_P2_2_tempListMon>06:00 17.0 09:00 21.0 24:00 17.0
R_P2_3_tempListTue>06:00 17.0 09:00 21.0 24:00 17.0
R_P2_4_tempListWed>06:00 17.0 09:00 21.0 24:00 17.0
R_P2_5_tempListThu>06:00 17.0 09:00 21.0 24:00 17.0
R_P2_6_tempListFri>06:00 17.0 09:00 21.0 24:00 17.0
R_P3_0_tempListSat>24:00 17.0
R_P3_1_tempListSun>24:00 17.0
R_P3_2_tempListMon>24:00 17.0
R_P3_3_tempListTue>24:00 17.0
R_P3_4_tempListWed>24:00 17.0
R_P3_5_tempListThu>24:00 17.0
R_P3_6_tempListFri>24:00 17.0
entities:ku.hz.01_Clima
R_0_tempListSat>06:30 16.0 21:00 18.0 24:00 16.0
R_1_tempListSun>06:00 16.0 21:00 18.0 24:00 16.0
R_2_tempListMon>05:30 16.0 08:00 18.0 16:30 16.0 21:00 18.0 24:00 16.0
R_3_tempListTue>05:30 16.0 08:00 18.0 16:30 16.0 21:00 18.0 24:00 16.0
R_4_tempListWed>05:30 16.0 08:00 18.0 16:30 16.0 21:00 18.0 24:00 16.0
R_5_tempListThu>05:30 16.0 08:00 18.0 16:30 16.0 21:00 18.0 24:00 16.0
R_6_tempListFri>05:30 16.0 08:00 18.0 16:30 16.0 21:00 18.0 24:00 16.0
entities:ku.hz.01_Clima_Daheim
R_0_tempListSat>06:30 16.0 21:00 18.0 24:00 16.0
R_1_tempListSun>06:30 16.0 21:00 18.0 24:00 16.0
R_2_tempListMon>06:30 16.0 21:00 18.0 24:00 16.0
R_3_tempListTue>06:30 16.0 21:00 18.0 24:00 16.0
R_4_tempListWed>06:30 16.0 21:00 18.0 24:00 16.0
R_5_tempListThu>06:30 16.0 21:00 18.0 24:00 16.0
R_6_tempListFri>06:30 16.0 21:00 18.0 24:00 16.0
entities:sz.hz.01_Clima
R_0_tempListSat>24:00 17.0
R_1_tempListSun>24:00 17.0
R_2_tempListMon>24:00 17.0
R_3_tempListTue>24:00 17.0
R_4_tempListWed>24:00 17.0
R_5_tempListThu>24:00 17.0
R_6_tempListFri>24:00 17.0
entities:sz.tc.01_Climate
R_P1_0_tempListSat>07:00 18.0 22:00 19.5 24:00 18.0
R_P1_1_tempListSun>07:00 18.0 22:00 19.5 24:00 18.0
R_P1_2_tempListMon>06:30 18.0 07:00 19.5 17:00 17.0 22:00 19.5 24:00 18.0
R_P1_3_tempListTue>06:30 18.0 07:00 19.5 17:00 17.0 22:00 19.5 24:00 18.0
R_P1_4_tempListWed>06:30 18.0 07:00 19.5 17:00 17.0 22:00 19.5 24:00 18.0
R_P1_5_tempListThu>06:30 18.0 07:00 19.5 17:00 17.0 22:00 19.5 24:00 18.0
R_P1_6_tempListFri>06:30 18.0 07:00 19.5 16:00 17.0 22:00 19.5 24:00 18.0
R_P2_0_tempListSat>08:00 18.0 22:00 19.5 24:00 18.0
R_P2_1_tempListSun>08:00 18.0 22:00 19.5 24:00 18.0
R_P2_2_tempListMon>08:00 18.0 22:00 19.5 24:00 18.0
R_P2_3_tempListTue>08:00 18.0 22:00 19.5 24:00 18.0
R_P2_4_tempListWed>08:00 18.0 22:00 19.5 24:00 18.0
R_P2_5_tempListThu>08:00 18.0 22:00 19.5 24:00 18.0
R_P2_6_tempListFri>08:00 18.0 22:00 19.5 24:00 18.0
R_P3_0_tempListSat>24:00 17.0
R_P3_1_tempListSun>24:00 17.0
R_P3_2_tempListMon>24:00 17.0
R_P3_3_tempListTue>24:00 17.0
R_P3_4_tempListWed>24:00 17.0
R_P3_5_tempListThu>24:00 17.0
R_P3_6_tempListFri>24:00 17.0
entities:wz.hz.01_Clima
R_0_tempListSat>24:00 17.0
R_1_tempListSun>24:00 17.0
R_2_tempListMon>24:00 17.0
R_3_tempListTue>24:00 17.0
R_4_tempListWed>24:00 17.0
R_5_tempListThu>24:00 17.0
R_6_tempListFri>24:00 17.0
entities:wz.tc.01_Climate
R_P1_0_tempListSat>06:00 17.0 24:00 19.5
R_P1_1_tempListSun>07:00 17.0 22:00 19.5 24:00 17.0
R_P1_2_tempListMon>05:30 17.0 07:00 19.5 17:00 17.0 22:00 19.5 24:00 17.0
R_P1_3_tempListTue>05:30 17.0 07:00 19.5 17:00 17.0 22:00 19.5 24:00 17.0
R_P1_4_tempListWed>05:30 17.0 07:00 19.5 17:00 17.0 22:00 19.5 24:00 17.0
R_P1_5_tempListThu>05:30 17.0 07:00 19.5 17:00 17.0 22:00 19.5 24:00 17.0
R_P1_6_tempListFri>05:30 17.0 07:00 19.5 16:00 17.0 24:00 19.5
R_P2_0_tempListSat>06:00 17.0 24:00 19.5
R_P2_1_tempListSun>06:00 17.0 22:00 19.5 24:00 17.0
R_P2_2_tempListMon>06:00 17.0 22:00 19.5 24:00 17.0
R_P2_3_tempListTue>06:00 17.0 22:00 19.5 24:00 17.0
R_P2_4_tempListWed>06:00 17.0 22:00 19.5 24:00 17.0
R_P2_5_tempListThu>06:00 17.0 22:00 19.5 24:00 17.0
R_P2_6_tempListFri>06:00 17.0 24:00 19.5
R_P3_0_tempListSat>24:00 17.0
R_P3_1_tempListSun>24:00 17.0
R_P3_2_tempListMon>24:00 17.0
R_P3_3_tempListTue>24:00 17.0
R_P3_4_tempListWed>24:00 17.0
R_P3_5_tempListThu>24:00 17.0
R_P3_6_tempListFri>24:00 17.0


tempListDaheim.cfg

entities:ku.hz.01_Clima
R_0_tempListSat>06:30 16.0 21:00 18.0 24:00 16.0
R_1_tempListSun>06:30 16.0 21:00 18.0 24:00 16.0
R_2_tempListMon>06:30 16.0 21:00 18.0 24:00 16.0
R_3_tempListTue>06:30 16.0 21:00 18.0 24:00 16.0
R_4_tempListWed>06:30 16.0 21:00 18.0 24:00 16.0
R_5_tempListThu>06:30 16.0 21:00 18.0 24:00 16.0
R_6_tempListFri>06:30 16.0 21:00 18.0 24:00 16.0

Titel: Antw:Wochenprofile und Betriebsmodus für HM Thermostate über Kalender auswählen
Beitrag von: Beta-User am 08 Februar 2018, 12:31:34
Vorab: besser als die Kopien der DEF's sind lists der Devices.

Die structure hat keinen <struct_type>, das dürfte also so nicht funktionieren. Ob du die überhaupt brauchst, ist was anderes, das ginge evtl. auch mit einer sinnvollen Regex.

Ich mache das ähnlich mit einem notify, wobei der dummy BW_Ferientag nur bei change Events generiert:
define Heizung_Ferienmodus notify BW_Ferientag IF ([BW_Ferientag]) (
  set Thermostat_Wohnzimmer_.*_Clima tempListTmpl restore FHEM/9999_tempList_edit.cfg:Wohnzimmer_Ferien,
  set Thermostat_Esszimmer_.*_Clima tempListTmpl restore FHEM/9999_tempList_edit.cfg:Esszimmer_Ferien,
  set Thermostat_Buero_Clima tempListTmpl restore FHEM/9999_tempList_edit.cfg:Buero_Ferien,
  set Thermostat_EssZi_Climate regSet weekPrgSel prog2
)
ELSE (
  set Thermostat_Wohnzimmer_.*_Clima tempListTmpl restore FHEM/9999_tempList_edit.cfg:Wohnzimmer,
  set Thermostat_Esszimmer_.*_Clima tempListTmpl restore FHEM/9999_tempList_edit.cfg:Esszimmer,
  set Thermostat_Buero_Clima tempListTmpl restore FHEM/9999_tempList_edit.cfg:Buero,
  set Thermostat_EssZi_Climate regSet weekPrgSel prog1
)

Da wäre dann halt das IF noch zu erweitern um die Abfrage für d_season, oder das notify würde deaktiviert durch ein anderes notify, wenn es die "falsche" Saison ist.

Für suboptimal halte ich das automatische save!

Gruß, Beta-User
Titel: Antw:Wochenprofile und Betriebsmodus für HM Thermostate über Kalender auswählen
Beitrag von: Beta-User am 08 Februar 2018, 14:11:55
Noch was: Dieses Board ist nur für funktionierende Code-Schnipsel gedacht.

Da du aber in dem anderen Thread schreibst, dass das Gesamtkonstrukt Probleme verursacht, solltest Du das (ggf. nach Heizung...) verschieben. Insgesamt war das m.E. unglücklich, das auf zwei Threads aufzuteilen.
Titel: Antw:Wochenprofile und Betriebsmodus für HM Thermostate über Kalender auswählen
Beitrag von: robertPI am 08 Februar 2018, 19:22:18
Hallo und vielen Dank für die Rückmeldungen!

Die Idee ist von Beta-User richtig beschrieben: die Thermostate sollen möglichst autark ihre Arbeit tun, und die einzelnen "Modi" sind für ein wenig aufregendes Leben (zumindest was die Zeiten angeht) auf wenige Szenarien begrenzt.
Verschoben habe ich den Thread schon, die Code Schnipsel werde ich durch die raw definitions ersetzen.
Laufen tut das ganze. Bis auf das Problem mit overload, da habe ich dank Beta-User aber schon eine gute Idee wie ich weiter mache.