Hallo,
nachdem ich vor einer Weile auf OH2 gewechselt bin, funktioniert meine Abwesenheitsschaltung leider nicht mehr. Im OH1 ging das prima:
Im meiner MariaDB landen die ITEMS auch sehr schön (siehe Anhang). Die Fehlermeldung im Log:
Hat jemand eine Idee? Ich betreibe das übrigens auf einem macOS Sierra. Herzlichen Dank.
Bildschirmfoto 2017-06-22 um 18.22.09.jpgBildschirmfoto 2017-06-22 um 18.21.57.jpg
nachdem ich vor einer Weile auf OH2 gewechselt bin, funktioniert meine Abwesenheitsschaltung leider nicht mehr. Im OH1 ging das prima:
Code:
rule "Update light states during absence" when Time cron "0 * 6-23 * * ?" then if (Presence.state==OFF && Ereignis.state==OFF) { { Lights?.members.forEach(lampe | if (lampe.state != lampe.historicState(now.minusDays(Absent_offset).plusSeconds(2)).state) lampe.postUpdate(lampe.historicState(now.minusDays(Absent_offset).plusSeconds(2)).state) ) } if (Presence.state==OFF && Ereignis.state==ON) { Lights?.members.forEach(lampe| if (lampe.state==OFF) { if (Math::random < 0.1) lampe.sendCommand(ON) } else { if (Math::random < 0.05) lampe.sendCommand(OFF) } ) } end
Code:
import org.openhab.core.library.items.* import org.openhab.core.library.types.* import org.openhab.core.persistence.* import org.openhab.model.script.actions.* import org.eclipse.xtext.xbase.lib.* import java.text.SimpleDateFormat import java.util.ArrayList import java.util.Date import java.util.HashMap import java.util.LinkedHashMap import java.util.Map import java.util.concurrent.locks.* import org.java.math.* import org.joda.time.* var int Absent_offset = 1 var int Ereignisdauer var java.util.Map E_initial var Timer timer_e = null // Systeminitialisierung beim Start von openHAB rule "Initialize item Presence at startup" when System started then Alarm?.members.forEach(alarm|alarm.postUpdate(CLOSED)) Alarm?.members.forEach(tamper|tamper.postUpdate(CLOSED)) Alarm?.members.forEach(heat|heat.postUpdate(CLOSED)) postUpdate(Klingel, CLOSED) postUpdate(Ereignis, OFF) executeCommandLine("/Applications/OH2/systemstart.sh") logInfo("Info", "System gestartet") end rule "Presence_On" when Item Presence received command ON then executeCommandLine("/Applications/OH2/anwesenheit.sh") logInfo("Info", "Jemand Zuhause") if (timer_e != null) { timer_e.cancel timer_e = null postUpdate(Ereignis, OFF) } end rule "Presence_Off" when Item Presence received command OFF then executeCommandLine("/Applications/OH2/abwesenheit.sh") logInfo("Info", "Niemand Zuhause") end
Code:
2017-06-22 16:51:00.086 [ERROR] [org.knowm.yank.Yank ] - Error in SQL query!!! java.sql.SQLException: Error preparing query: Table 'OH2.Item0021' doesn't exist Query: SELECT time, value FROM Item0021 WHERE TIME<'2017-06-21 16:51:02' ORDER BY time DESC LIMIT 0,1 Parameters: [] at org.apache.commons.dbutils.AbstractQueryRunner.rethrow(AbstractQueryRunner.java:392)
Hat jemand eine Idee? Ich betreibe das übrigens auf einem macOS Sierra. Herzlichen Dank.
Bildschirmfoto 2017-06-22 um 18.22.09.jpgBildschirmfoto 2017-06-22 um 18.21.57.jpg
Kommentar