function openzwave_update() { if (!file_exists(dirname(__FILE__) . '/../data')) { mkdir(dirname(__FILE__) . '/../data'); if (file_exists('/opt/python-openzwave/xml_backups')) { shell_exec('cp -R /opt/python-openzwave/xml_backups ' . dirname(__FILE__) . '/../data'); shell_exec('cp -R /opt/python-openzwave/zwcfg_*.xml ' . dirname(__FILE__) . '/../data'); shell_exec('rm -rf /opt/python-openzwave/xml_backups'); shell_exec('rm -rf /opt/python-openzwave/zwcfg_*.xml'); } } $cron = cron::byClassAndFunction('openzwave', 'pull'); if (is_object($cron)) { $cron->remove(); } if (count(eqLogic::byType('zwave')) > 0) { log::add('openzwave', 'error', 'Attention vous etes sur la nouvelle version d\'openzwave, des actions de votre part sont necessaire merci d\'aller voir https://jeedom.fr/blog/?p=1576'); } openzwave::syncconfOpenzwave(); }
public static function cronDaily() { if (config::byKey('jeeNetwork::mode') == 'master') { foreach (self::listServerZwave() as $serverID => $server) { try { $results = self::callOpenzwave('/ZWaveAPI/Run/network.RefreshAllBatteryLevel()', $serverID); foreach ($results as $node_id => $value) { $batteryStatusDate = date('Y-m-d H:i:s'); $eqLogic = self::getEqLogicByLogicalIdAndServerId($node_id, $serverID); if (is_object($eqLogic) && $eqLogic->getConfiguration('noBatterieCheck', 0) != 1) { if ($value['updateTime'] !== null) { $batteryStatusDate = date('Y-m-d H:i:s', $value['updateTime']); } if (is_file(dirname(__FILE__) . '/../config/devices/' . $eqLogic->getConfFilePath())) { $content = file_get_contents(dirname(__FILE__) . '/../config/devices/' . $eqLogic->getConfFilePath()); if (is_json($content)) { $device = json_decode($content, true); if (is_array($device) && isset($device['battery_type'])) { $eqLogic->setConfiguration('battery_type', $device['battery_type']); } } } $eqLogic->batteryStatus($value['value'], $batteryStatusDate); } } } catch (Exception $e) { } } if (config::byKey('auto_health', 'openzwave') == 1 && (date('w') == 1 || date('w') == 4)) { sleep(3600); try { self::callOpenzwave('/ZWaveAPI/Run/controller.HealNetwork()', $serverID); } catch (Exception $e) { } } try { openzwave::syncconfOpenzwave(); } catch (Exception $e) { } } }
* Jeedom is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Jeedom. If not, see <http://www.gnu.org/licenses/>. */ try { require_once dirname(__FILE__) . '/../../../../core/php/core.inc.php'; include_file('core', 'authentification', 'php'); if (!isConnect('admin')) { throw new Exception('401 Unauthorized'); } if (init('action') == 'syncconfOpenzwave') { openzwave::syncconfOpenzwave(); ajax::success(); } if (init('action') == 'syncEqLogicWithOpenZwave') { foreach (openzwave::listServerZwave() as $serverID => $server) { if (isset($server['name'])) { openzwave::syncEqLogicWithOpenZwave($serverID); } } ajax::success(); } if (init('action') == 'sendNoOperation') { $eqLogic = openzwave::byId(init('id')); if (!is_object($eqLogic)) { throw new Exception(__('Zwave eqLogic non trouvé : ', __FILE__) . init('id')); }
* it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Jeedom is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Jeedom. If not, see <http://www.gnu.org/licenses/>. */ require_once dirname(__FILE__) . '/../../../../core/php/core.inc.php'; global $jsonrpc; if (!is_object($jsonrpc)) { throw new Exception(__('JSONRPC object not defined', __FILE__), -32699); } $params = $jsonrpc->getParams(); if ($jsonrpc->getMethod() == 'deamonRunning') { $jsonrpc->makeSuccess(openzwave::deamonRunning()); } if ($jsonrpc->getMethod() == 'getVersion') { $jsonrpc->makeSuccess(openzwave::getVersion($params['module'])); } if ($jsonrpc->getMethod() == 'compilationOk') { $jsonrpc->makeSuccess(openzwave::compilationOk()); } if ($jsonrpc->getMethod() == 'syncconfOpenzwave') { $jsonrpc->makeSuccess(openzwave::syncconfOpenzwave()); } throw new Exception(__('Aucune methode correspondante pour le plugin openzwave : ' . $jsonrpc->getMethod(), __FILE__));