public function setTimer($id, $action, $type, $stunden, $minuten, $deviceName) { if ($action == "setBPSValue") { $action = $_SESSION["BPS"]->getProperty("mFhemTimer", "FhemValue"); } switch ($type) { case "D": $F = new Fhem($id); $F->loadMe(); $S = new FhemServer($F->getA()->FhemServerID); $S->loadMe(); break; case "P": $ac = new anyC(); $ac->setCollectionOf("FhemPreset"); $ac->addJoinV3("FhemServer", "FhemPresetServerID", "=", "FhemServerID"); $ac->addAssocV3("FhemPresetID", "=", $id); $ac->setLimitV3("1"); $S = $ac->getNextEntry(); $action = "on"; break; } try { $T = new Telnet($S->getA()->FhemServerIP, $S->getA()->FhemServerPort); } catch (NoServerConnectionException $e) { die("error:'The connection to the server with IP-address " . $S->getA()->FhemServerIP . " could not be established!'"); } $T->fireAndForget("define a" . rand(10, 10000000) . " at " . ($stunden < 10 ? "0" : "") . "{$stunden}:" . ($minuten < 10 ? "0" : "") . "{$minuten}:00 set " . $deviceName . " {$action}"); $T->disconnect(); }
public static function DGParser($w) { $S = new FhemServer($w); $S->loadMe(); return $S->getA()->FhemServerName; }