Skip to content

Commit

Permalink
Fix issue #4
Browse files Browse the repository at this point in the history
  • Loading branch information
DanoneKiD committed Jan 29, 2019
1 parent f5d862d commit 35edb03
Show file tree
Hide file tree
Showing 8 changed files with 173 additions and 237 deletions.
19 changes: 1 addition & 18 deletions core/ajax/meross.ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

/*
* This file is part of the NextDom software (https://github.com/NextDom or http://nextdom.github.io).
* Copyright (c) 2018 NextDom.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand All @@ -17,22 +16,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

/* This file is part of NextDom.
*
* NextDom is free software: you can redistribute it and/or modify
* 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.
*
* NextDom 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 NextDom. If not, see <http://www.gnu.org/licenses/>.
*/

/**
* Fichier appelé lorsque le plugin effectue une requête Ajax
*/
Expand Down Expand Up @@ -71,4 +54,4 @@
} catch (\Exception $e) {
// Affiche l'exception levé à l'utilisateur
ajax::error(displayExeption($e), $e->getCode());
}
}
247 changes: 124 additions & 123 deletions core/class/meross.class.php

Large diffs are not rendered by default.

40 changes: 12 additions & 28 deletions core/class/merossCmd.class.php
Original file line number Diff line number Diff line change
@@ -1,37 +1,21 @@
<?php

/* This file is part of Jeedom.
/*
* This file is part of the NextDom software (https://github.com/NextDom or http://nextdom.github.io).
*
* Jeedom is free software: you can redistribute it and/or modify
* This program is free software: you can redistribute it and/or modify
* 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.
* the Free Software Foundation, version 2.
*
* 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.
* This program 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/>.
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

/* This file is part of NextDom.
*
* NextDom is free software: you can redistribute it and/or modify
* 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.
*
* NextDom 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 NextDom. If not, see <http://www.gnu.org/licenses/>.
*/

require_once __DIR__ . '/../../../../core/php/core.inc.php';

class merossCmd extends cmd
Expand All @@ -45,7 +29,7 @@ public function execute($_options = array())
$password = config::byKey('merossPassword', 'meross');

// Base cmd
$command = 'sudo sh ' . __DIR__ . '/../../3rdparty/meross.sh' . ' --email ' . $email . ' --password ' . $password . ' --uuid ' . $eqLogic->getLogicalId() . ' --show ';
$command = 'sh ' . __DIR__ . '/../../3rdparty/meross.sh' . ' --email ' . $email . ' --password ' . $password . ' --uuid ' . $eqLogic->getLogicalId() . ' --show ';

// If action need to be executed
$execute = false;
Expand Down Expand Up @@ -73,10 +57,10 @@ public function execute($_options = array())
log::add('meross','debug','shell_exec: ' . $log);
$result = trim(shell_exec($command));
log::add('meross','debug','shell_exec: result: ' . $result);
$eqLogic->updateInfo($result);
meross::updateInfo($eqLogic, $result);
} else {
log::add('meross','debug','action: Action=' . $action . ' not implemented. ');
}

}
}
}
17 changes: 0 additions & 17 deletions desktop/js/meross.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/*
* This file is part of the NextDom software (https://github.com/NextDom or http://nextdom.github.io).
* Copyright (c) 2018 NextDom.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand All @@ -15,22 +14,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

/* This file is part of NextDom.
*
* NextDom is free software: you can redistribute it and/or modify
* 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.
*
* NextDom 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 NextDom. If not, see <http://www.gnu.org/licenses/>.
*/


$("#table_cmd").sortable({
axis: "y",
Expand Down
19 changes: 10 additions & 9 deletions desktop/modal/health.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
<?php
/* This file is part of Jeedom.

/*
* This file is part of the NextDom software (https://github.com/NextDom or http://nextdom.github.io).
*
* Jeedom is free software: you can redistribute it and/or modify
* This program is free software: you can redistribute it and/or modify
* 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.
* the Free Software Foundation, version 2.
*
* 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.
* This program 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/>.
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

if (!isConnect('admin')) {
Expand Down
17 changes: 0 additions & 17 deletions desktop/php/meross.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?php
/*
* This file is part of the NextDom software (https://github.com/NextDom or http://nextdom.github.io).
* Copyright (c) 2018 NextDom.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand All @@ -16,22 +15,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

/* This file is part of NextDom.
*
* NextDom is free software: you can redistribute it and/or modify
* 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.
*
* NextDom 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 NextDom. If not, see <http://www.gnu.org/licenses/>.
*/

if (!isConnect('admin')) {
throw new \Exception('{{401 - Accès non autorisé}}');
}
Expand Down
49 changes: 25 additions & 24 deletions plugin_info/configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,35 +22,36 @@
include_file('core', 'authentification', 'php');

if (!isConnect()) {
include_file('desktop', '404', 'php');
die();
include_file('desktop', '404', 'php');
die();
}

?>

<form class="form-horizontal">
<fieldset>
<div class="col-lg-4 col-lg-offset-4 col-md-6 col-md-offset-3 col-xs-12">
<div class="form-group">
<label for="merossEmail">{{Email}}</label>
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-envelope"></i></span>
<input type="email" class="configKey form-control" placeholder="{{Email de votre compte Meross}}" data-l1key="merossEmail" id="merossEmail">
<fieldset>
<div class="col-lg-4 col-lg-offset-4 col-md-6 col-md-offset-3 col-xs-12">
<div class="form-group">
<label for="merossEmail">{{Email}}</label>
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-envelope"></i></span>
<input type="email" class="configKey form-control" placeholder="{{Email de votre compte Meross}}"
data-l1key="merossEmail" id="merossEmail">
</div>
</div>
</div>
</div>
</div>

<br>

<div class="col-lg-4 col-lg-offset-4 col-md-6 col-md-offset-3 col-xs-12">
<div class="form-group">
<label for="merossPassword">{{Mot de passe}}</label>
<div class="input-group">
<span class="input-group-addon"><i class="fas fa-key"></i></span>
<input type="password" class="configKey form-control" placeholder="{{Mot de passe associé}}"data-l1key="merossPassword" id="merossPassword">
<br>

<div class="col-lg-4 col-lg-offset-4 col-md-6 col-md-offset-3 col-xs-12">
<div class="form-group">
<label for="merossPassword">{{Mot de passe}}</label>
<div class="input-group">
<span class="input-group-addon"><i class="fas fa-key"></i></span>
<input type="password" class="configKey form-control" placeholder="{{Mot de passe associé}}"
data-l1key="merossPassword" id="merossPassword">
</div>
</div>
</div>
</div>
</div>
</fieldset>
</form>

</fieldset>
</form>
2 changes: 1 addition & 1 deletion plugin_info/install.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ function Meross_remove()

/**
* Remove __pycache__ from 3rdparty folders
*
*
* @return void
*/
function cleanPyCache()
Expand Down

0 comments on commit 35edb03

Please sign in to comment.