Ejemplo n.º 1
0
 require_once dirname(__FILE__) . '/../../../../core/php/core.inc.php';
 include_file('core', 'authentification', 'php');
 if (!isConnect('admin')) {
     throw new Exception(__('401 - Accès non autorisé', __FILE__));
 }
 if (init('action') == 'syncEqLogicWithTeslaSite') {
     tesla::syncEqLogicWithTeslaSite();
     ajax::success();
 }
 if (init('action') == 'createToken') {
     $result = tesla::createToken(init('email'), init('password'));
     //config::save('token',$result,'tesla');
     ajax::success($result);
 }
 if (init('action') == 'checkAPI') {
     ajax::success(tesla::checkAPI());
 }
 // action qui permet d'obtenir l'ensemble des eqLogic
 if (init('action') == 'getAll') {
     $eqLogics = eqLogic::byType('tesla');
     // ne pas oublier de modifier pour le nom de votre plugin
     // la liste des équipements
     foreach ($eqLogics as $eqLogic) {
         $data['id'] = $eqLogic->getId();
         $data['humanSidebar'] = $eqLogic->getHumanName(true, false);
         $data['humanContainer'] = $eqLogic->getHumanName(true, true);
         $return[] = $data;
     }
     ajax::success($return);
 }
 throw new Exception(__('Aucune methode correspondante à : ', __FILE__) . init('action'));
Ejemplo n.º 2
0
 * 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';
include_file('core', 'authentification', 'php');
if (!isConnect()) {
    include_file('desktop', '404', 'php');
    die;
}
$apiAccessOK = false;
try {
    // Test access API
    $apiAccessOK = tesla::checkAPI();
} catch (Exception $e) {
}
?>
<form class="form-horizontal">
    <fieldset>
    	<legend><i class="fa fa-list-alt"></i> {{Etat}}</legend>
<?php 
echo '<div class="form-group">';
echo '<label class="col-sm-6 control-label">{{API Tesla}}</label>';
if (!$apiAccessOK) {
    echo '<div class="col-sm-1"><span class="label label-danger tooltips" style="font-size : 1em;" title="{{Verifiez vos information d\'identification Tesla & generez un token}}">NOK</span></div>';
} else {
    echo '<div class="col-sm-1"><span class="label label-success" style="font-size : 1em;" title="{{' . $apiAccessOK . ' voiture' . ($apiAccessOK == 1 ? '' : 's') . '}}">OK</span></div>';
}
echo '</div>';