<component name="ChangeListManager">
<list default="true" id="352ce63a-b52a-41a2-979b-becda7920939" name="Default" comment=".">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
- <change beforePath="$PROJECT_DIR$/config/coffee.php" beforeDir="false" afterPath="$PROJECT_DIR$/config/coffee.php" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/scripts/homeconnect.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/homeconnect.php" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/scripts/lib/homeconnect.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/homeconnect.php" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/scripts/lib/remoteinfos.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/remoteinfos.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/scripts/lib/scenes.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/scenes.php" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/servers/domoticz.php" beforeDir="false" afterPath="$PROJECT_DIR$/servers/domoticz.php" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="Make" enabled="true" />
</method>
</configuration>
- <configuration default="true" type="ArquillianJUnit" factoryName="" nameIsGenerated="true">
- <option name="arquillianRunConfiguration">
- <value>
- <option name="containerStateName" value="" />
- </value>
- </option>
- <option name="TEST_OBJECT" value="class" />
- <method v="2">
- <option name="Make" enabled="true" />
- </method>
- </configuration>
<configuration default="true" type="ArquillianTestNG" factoryName="">
<option name="arquillianRunConfiguration">
<value>
<workItem from="1618426400216" duration="1138000" />
<workItem from="1618656192286" duration="2313000" />
<workItem from="1618682288258" duration="2117000" />
- <workItem from="1618740509693" duration="12495000" />
- </task>
- <task id="LOCAL-00421" summary=".">
- <created>1607933724635</created>
- <option name="number" value="00421" />
- <option name="presentableId" value="LOCAL-00421" />
- <option name="project" value="LOCAL" />
- <updated>1607933724636</updated>
+ <workItem from="1618740509693" duration="14198000" />
+ <workItem from="1618947923152" duration="1999000" />
</task>
<task id="LOCAL-00422" summary=".">
<created>1607938357925</created>
<option name="project" value="LOCAL" />
<updated>1618861174900</updated>
</task>
- <option name="localTasksCounter" value="470" />
+ <task id="LOCAL-00470" summary=".">
+ <created>1618909856303</created>
+ <option name="number" value="00470" />
+ <option name="presentableId" value="LOCAL-00470" />
+ <option name="project" value="LOCAL" />
+ <updated>1618909856304</updated>
+ </task>
+ <option name="localTasksCounter" value="471" />
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
<?php
require_once "import.php";
echo '<pre>';
-hc_setpower_state('Machine à café',false);
\ No newline at end of file
+hc_setpower_state('Machine à café',true);
\ No newline at end of file
$headers['Authorization'] = 'Bearer ' . getState('hc_access_token');
$headers['Accept'] = 'application/vnd.bsh.sdk.v1+json';
}
- $res = httpRequest($uri, $method, $data, null, 10, true, $headers);
+ try {
+ $res = httpRequest($uri, $method, $data, null, 10, true, $headers);
+ } catch (Exception $e) {
+ if (stristr($e->getMessage(), 'The access token expired')) {
+ hc_connect(true);
+ return _hc_cmd($cmd, $data, $method, $auth);
+ }
+ }
$c = $res->getBody()->getContents();
if ($decoded = json_decode($c)) {
'type' => 'BSH.Common.EnumType.PowerState',
'contraints' => ['allowedvalues' => ['BSH.Common.EnumType.Powerstate.' . $states[0], 'BSH.Common.EnumType.Powerstate.' . $states[1]]]];
- return _hc_cmd("api/homeappliances/" . hc_haid($appliance) . "/settings/BSH.Common.Setting.PowerState", ['data'=>$data], 'put');
+ return _hc_cmd("api/homeappliances/" . hc_haid($appliance) . "/settings/BSH.Common.Setting.PowerState", ['data' => $data], 'put');
}
-function coffee_on(){
- hc_setpower_state('Machine à café',true);
+function coffee_on()
+{
+ hc_setpower_state('Machine à café', true);
}
-function coffee_off(){
- hc_setpower_state('Machine à café',false);
+function coffee_off()
+{
+ hc_setpower_state('Machine à café', false);
}
-function hc_connect()
+function hc_connect($refresh = false)
{
$scope = 'IdentifyAppliance Monitor Settings';
$appName = 'Tortuga';
$locale = 'fr';
- if (null === getStateIfMoreRecent('hc_access_token', null, time() - 86400)) {
+ if ($refresh || null === getStateIfMoreRecent('hc_access_token', null, time() - 86400)) {
// Init connection
$connect = _hc_cmd('security/oauth/device_authorization', [
'client_id' => HOMECONNECT_CLIENT_ID,
if (config('TVPLAYER') === 'shield') {
if (shieldGetCurrentApp() === 'kodi') {
$res = ['type' => 'shieldmedia', 'can_seek' => true];
- $p = json_decode(httpRequest('http://' . getDevice()['shield'] . ':8754/jsonrpc?Base=1', 'post', '[{"jsonrpc":"2.0","method":"Player.GetProperties","params":[1,["playlistid","speed","position","totaltime","time","percentage","shuffled","repeat","canrepeat","canshuffle","canseek","partymode"]],"id":1},{"jsonrpc":"2.0","method":"Player.GetItem","params":[1,["title","thumbnail","file","artist","genre","year","rating","album","track","duration","playcount","dateadded","episode","artistid","albumid","tvshowid","fanart"]],"id":2}]', ['kodi', 'atacama'], 10, true, ['X-Requested-With' => 'XMLHttpRequest', 'Content-type' => 'application/json'])->getBody(), true);
+ while (true) {
+ try {
+ $req = httpRequest('http://' . getDevice()['shield'] . ':8754/jsonrpc?Base=1', 'post', '[{"jsonrpc":"2.0","method":"Player.GetProperties","params":[1,["playlistid","speed","position","totaltime","time","percentage","shuffled","repeat","canrepeat","canshuffle","canseek","partymode"]],"id":1},{"jsonrpc":"2.0","method":"Player.GetItem","params":[1,["title","thumbnail","file","artist","genre","year","rating","album","track","duration","playcount","dateadded","episode","artistid","albumid","tvshowid","fanart"]],"id":2}]', ['kodi', 'atacama'], 10, true, ['X-Requested-With' => 'XMLHttpRequest', 'Content-type' => 'application/json']);
+ break;
+ } catch (Exception $e) {
+
+ }
+ sleep(2);
+ }
+ $p = json_decode($req->getBody(), true);
$res['duration'] = '';
$res['time'] = '';
$res['title'] = '';
['type' => 'domoticz', 'scene' => 43, 'command' => true, 'priority' => true],
],
'chambre/cheminee/smallfire' => [
- ['type' => 'domoticz', 'scene' => 43, 'command' => true, 'priority' => true],
+ ['type' => 'domoticz', 'scene' => 44, 'command' => true, 'priority' => true],
],
'chambre/cheminee/cold' => [
['type' => 'domoticz', 'scene' => 43, 'command' => true, 'priority' => true],
$redis->igbset($q, $queue);
echo 'Run command ' . json_encode($command) . "\n";
runDomoticzCommand($command);
- usleep(1000000 * 0.5);
+ usleep(1000000 * 0.25);
}
}
\ No newline at end of file