Re: Fehler in Rule
Verfasst: 21. Mär 2020 11:11
ja genau richtig
Code: Alles auswählen
rule "Sascha Homeoffice"
when
Item all_sascha_homeoffice received command or
Item all_sascha_homeoffice_prion_schalter received command
then
if (receivedCommand==ON) {
pc_arbeitszimmer_sascha.sendCommand(ON)
og_arbeitszimmersascha_rol.sendCommand(0)
og_arbeitszimmersascha_schreibtisch(ON)
if (now.getHourOfDay() <= 19 && now.getHourOfDay() >= 8) {
Thread::sleep(2500)
echo_dot_arbeitszimmer_sascha_TTS_Volume.sendCommand(60)
echo_dot_arbeitszimmer_sascha_TTS.sendCommand('Ich wünsche dir einen angenehmen Homeoffice Tag')
Thread::sleep(2500)
echo_dot_arbeitszimmer_sascha_TTS_Volume.sendCommand(30)
}
}
else {
pc_arbeitszimmer_sascha.sendCommand(OFF)
og_arbeitszimmersascha_schreibtisch(OFF)
if (now.getHourOfDay() <= 19 && now.getHourOfDay() >= 8) {
Thread::sleep(2500)
echo_dot_arbeitszimmer_sascha_TTS_Volume.sendCommand(60)
echo_dot_arbeitszimmer_sascha_TTS.sendCommand('Ich wünsche dir einen schönen Feierabend')
Thread::sleep(2500)
echo_dot_arbeitszimmer_sascha_TTS_Volume.sendCommand(30)
}
}
end
Code: Alles auswählen
og_arbeitszimmersascha_schreibtisch(ON)
Code: Alles auswählen
og_arbeitszimmersascha_schreibtisch(OFF)
Code: Alles auswählen
og_arbeitszimmersascha_schreibtisch.sendCommand(ON)
Code: Alles auswählen
og_arbeitszimmersascha_schreibtisch.sendCommand(OFF)
Code: Alles auswählen
rule "Sascha Homeoffice"
when
Item all_sascha_homeoffice received command or
Item all_sascha_homeoffice_prion_schalter received command
then
pc_arbeitszimmer_sascha.sendCommand(receivedCommand)
og_arbeitszimmersascha_schreibtisch(receivedCommand)
if (receivedCommand==ON) {
og_arbeitszimmersascha_rol.sendCommand(0)
}
if (now.getHourOfDay() <= 19 && now.getHourOfDay() >= 8) {
Thread::sleep(2500)
echo_dot_arbeitszimmer_sascha_TTS_Volume.sendCommand(60)
echo_dot_arbeitszimmer_sascha_TTS.sendCommand(if (receivedCommand==ON) 'Ich wünsche dir einen angenehmen Homeoffice Tag' else 'Ich wünsche dir einen schönen Feierabend')
Thread::sleep(2500)
echo_dot_arbeitszimmer_sascha_TTS_Volume.sendCommand(30)
}
end
Code: Alles auswählen
// globale Variablen zu Beginn der Datei definieren!
var Timer tEcho = null
var Boolean bEcho = false
rule "Sascha Homeoffice"
when
Item all_sascha_homeoffice received command or
Item all_sascha_homeoffice_prion_schalter received command
then
pc_arbeitszimmer_sascha.sendCommand(receivedCommand)
og_arbeitszimmersascha_schreibtisch.sendCommand(receivedCommand)
if(receivedCommand==ON) {
bEcho = true
og_arbeitszimmersascha_rol.sendCommand(0)
} else {
bEcho = false
}
if (now.getHourOfDay < 20 && now.getHourOfDay > 7 && tEcho === null) // .getHourOfDay ist vom Typ Integer
tEcho = createTimer(now.plusMillis(2500), [ | // statt Thread::sleep()
if((echo_dot_arbeitszimmer_sascha_TTS_Volume.state as Number) != 60) {
echo_dot_arbeitszimmer_sascha_TTS_Volume.sendCommand(60)
echo_dot_arbeitszimmer_sascha_TTS.sendCommand(
if(bEcho) // receivedCommand war ON
'Ich wünsche dir einen angenehmen Homeoffice Tag'
else
'Ich wünsche dir einen schönen Feierabend'
)
tEcho.reschedule(now.plusMillis(2500))
} else {
echo_dot_arbeitszimmer_sascha_TTS_Volume.sendCommand(30)
tEcho = null
}
])
end
Code: Alles auswählen
rule "Weihnachtsbeleuchtung Anfang November bis Mitte Januar"
when
Item ws_daemmerung changed
then
if((now.getDayOfYear > now.withDate(now.year,11,26).getDayOfYear || now.getDayOfYear < 16)) {
if(ws_daemmerung.state == OPEN) {
au_terrasse_st.sendCommand(ON)
au_eingang_st.sendCommand(ON)
au_garten_brightness.sendCommand(70)
au_vorgarten_brightness.sendCommand(70)
} else {
au_eingang_st.sendCommand(OFF)
au_terrasse_st.sendCommand(OFF)
}
}
end