PHP code example of chanshige / sesame

1. Go to this page and download the library: Download chanshige/sesame library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

chanshige / sesame example snippets

injectablephp
$response = $sesame(new Action\Status($device));

$response = >>>EOF
array (size=6)
  'batteryPercentage' => int 100 // バッテリー残量
  'batteryVoltage' => float 5.8627565982405 // バッテリー電圧(V)
  'position' => int 256 // 
  'CHSesame2Status' => string 'locked' // locked | unlocked | moved
  'timestamp' => int 1703000024 // Sesameの更新時間
  'wm2State' => boolean true // wifiモジュールの状態
EOF;

injectablephp
$response = $sesame(new Action\History($device, 1, 100));
injectablephp
// 鍵をかける
$response = $sesame(new Action\Lock($device, 'chanshigeが鍵かけた'));

// 鍵をあける
$response = $sesame(new Action\UnLock($device, 'chanshigeが鍵あけた'));

// 鍵をひたすら回す
$response = $sesame(new Action\Toggle($device, 'chanshigeが操作した'));