-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from paxal/home
Add home automation
- Loading branch information
Showing
23 changed files
with
942 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,7 @@ | |
"api", | ||
"rest", | ||
"Freebox revolution", | ||
"Freebox delta", | ||
"download" | ||
], | ||
"require": { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
|
||
# Home | ||
|
||
**Namespace** : alphayax\freebox\api\v6\services\Home | ||
|
||
# Overview | ||
|
||
- [Tileset](__NAMESPACE__.md#Tileset) | ||
- [EndpointValues](__NAMESPACE__.md#EndpointValues) | ||
- [Nodes](__NAMESPACE__.md#Nodes) | ||
|
||
|
||
--- | ||
<a name="Tileset"></a> | ||
## Tileset | ||
|
||
**Class** : alphayax\freebox\api\v6\services\Home\Tileset | ||
|
||
### Public methods | ||
|
||
| Method | Description | | ||
|---|---| | ||
| `getTiles` | Retrieve all tiles. | | ||
| `getTile` | Get single tile. | | ||
|
||
<a name="EndpointValues"></a> | ||
## EndpointValues | ||
|
||
**Class** : alphayax\freebox\api\v6\services\Home\EndpointValues | ||
|
||
### Public methods | ||
|
||
| Method | Description | | ||
|---|---| | ||
| `getEndpointValue` | Get endpoint value. | | ||
| `setEndpointValue` | Set endpoint value. | | ||
|
||
<a name="Nodes"></a> | ||
## Nodes | ||
|
||
**Class** : alphayax\freebox\api\v6\services\Home\Nodes | ||
|
||
### Public methods | ||
|
||
| Method | Description | | ||
|---|---| | ||
| `getAll` | Retrieve all nodes. | | ||
| `getNode` | Retrieve one node. | | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
|
||
# services | ||
|
||
**Namespace** : alphayax\freebox\api\v6\services | ||
|
||
# Overview | ||
|
||
- [Home](./Home/__NAMESPACE__.md) | ||
- [Tileset](Home/__NAMESPACE__.md#Tileset) | ||
- [EndpointValues](Home/__NAMESPACE__.md#EndpointValues) | ||
- [Nodes](Home/__NAMESPACE__.md#Nodes) | ||
|
||
|
||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
/// Require Composer AutoLoader | ||
require_once dirname(__FILE__).'/../../vendor/autoload.php'; | ||
|
||
/// Define our application | ||
$App = new \alphayax\freebox\utils\Application( 'com.alphayax.freebox.os', 'AYX Freebox OS', '1.0.0'); | ||
$App->loadAppToken(); | ||
$App->openSession(); | ||
|
||
$nodeService = new \alphayax\freebox\api\v6\services\Home\Nodes($App); | ||
$nodes = $nodeService->getAll(); | ||
|
||
$nbNodes = count($nodes); | ||
echo "Found ".$nbNodes." nodes.".PHP_EOL; | ||
if ($nbNodes > 0) { | ||
echo "First node :".PHP_EOL; | ||
var_dump(current($nodes)); | ||
} | ||
echo PHP_EOL; | ||
echo PHP_EOL; | ||
|
||
$tileService = new \alphayax\freebox\api\v6\services\Home\Tileset($App); | ||
$tiles = $tileService->getTiles(); | ||
$nbTiles = count($tiles); | ||
echo "Found ".$nbTiles." tiles.".PHP_EOL; | ||
if ($nbTiles > 0) { | ||
echo "First tile :".PHP_EOL; | ||
var_dump(current($tiles)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
<?php | ||
namespace alphayax\freebox\api\v6\models\Home; | ||
|
||
use alphayax\freebox\utils\Model; | ||
|
||
class Endpoint extends Model | ||
{ | ||
/** | ||
* @var string (Read-Only) : The endpoint type | ||
* @see \alphayax\freebox\api\v6\symbols\Node\Enpoint\Type | ||
*/ | ||
protected $ep_type; | ||
|
||
/** @var int (Read-Only) : The endpoint id */ | ||
protected $id; | ||
|
||
/** | ||
* @var string (Read-Only) : Visibility level of this endpoint | ||
* @see | ||
*/ | ||
protected $visibility; | ||
|
||
/** @var string (Read-Only) : The endpoint displayable type */ | ||
protected $label; | ||
|
||
/** @var string (Read-Only) : The endpoint technical name */ | ||
protected $name; | ||
|
||
/** @var string (Read-Only) : The current value of the endpoint */ | ||
protected $value; | ||
|
||
/** | ||
* @var string (Read-Only) : The type of value this endpoint expose | ||
* @see \alphayax\freebox\api\v6\symbols\Node\Enpoint\ValueType | ||
*/ | ||
protected $value_type; | ||
|
||
/** @var EndpointUi (Read-Only) : Ui descriptor for this data to know how to display it */ | ||
protected $ui; | ||
|
||
public function __construct($properties_x = []) | ||
{ | ||
parent::__construct($properties_x); | ||
$this->initProperty('ui', EndpointUi::class); | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getEpType() | ||
{ | ||
return $this->ep_type; | ||
} | ||
|
||
/** | ||
* @return int | ||
*/ | ||
public function getId() | ||
{ | ||
return $this->id; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getVisibility() | ||
{ | ||
return $this->visibility; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getLabel() | ||
{ | ||
return $this->label; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getName() | ||
{ | ||
return $this->name; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getValue() | ||
{ | ||
return $this->value; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getValueType() | ||
{ | ||
return $this->value_type; | ||
} | ||
|
||
/** | ||
* @return EndpointUi | ||
*/ | ||
public function getUi() | ||
{ | ||
return $this->ui; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,145 @@ | ||
<?php | ||
namespace alphayax\freebox\api\v6\models\Home; | ||
|
||
use alphayax\freebox\utils\Model; | ||
|
||
class EndpointUi extends Model | ||
{ | ||
/** | ||
* @var string (Read-Only) : Display mode of this data | ||
* @see \alphayax\freebox\api\v6\symbols\Node\Enpoint\EndpointUiDisplay | ||
*/ | ||
protected $display; | ||
|
||
/** | ||
* @var string (Read-Only) : Access mode of this endpoint | ||
* @see \alphayax\freebox\api\v6\symbols\Node\Enpoint\HomeAccess | ||
*/ | ||
protected $access; | ||
|
||
/** @var string|null (Read-Only) : Url or name of the icon to display. The icon may be displayed for any value of “display”. */ | ||
protected $icon_url; | ||
|
||
/** @var string|null (Read-Only) : The unit of the value to display. */ | ||
protected $unit; | ||
|
||
/** @var string|null (Read-Only) : The hexadecimal presentation of the tint to apply to the icon fetched from “icon_url”. */ | ||
protected $icon_color; | ||
|
||
/** @var string|null (Read-Only) : The hexadecimal presentation of the color of this endpoint label. */ | ||
protected $text_color; | ||
|
||
/** @var string|null (Read-Only) : The hexadecimal presentation of the color of this endpoint value. */ | ||
protected $value_color; | ||
|
||
/** @var float[]|int[]|null (Read-Only) : Range of array of threshold values for this endpoint value. */ | ||
protected $range; | ||
|
||
/** @var string[]|null (Read-Only) : A range of colors to choose from instead of “icon_color”. The index in the range is the index in the “range” array which is just below the endpoint value. */ | ||
protected $icon_color_range; | ||
|
||
/** @var string[]|null (Read-Only) : A range of colors to choose from instead of “text_color”. The index in the range is the index in the “range” array which is just below the endpoint value. */ | ||
protected $text_color_range; | ||
|
||
/** @var string[]|null (Read-Only) : A range of colors to choose from instead of “value_color”. The index in the range is the index in the “range” array which is just below the endpoint value. */ | ||
protected $value_color_range; | ||
|
||
/** @var string[]|null (Read-Only) : Text values to display instead of the value itself. The index in the range is the index in the “range” array which is just below the endpoint value. */ | ||
protected $status_text_range; | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getDisplay() | ||
{ | ||
return $this->display; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getAccess() | ||
{ | ||
return $this->access; | ||
} | ||
|
||
/** | ||
* @return string|null | ||
*/ | ||
public function getIconUrl() | ||
{ | ||
return $this->icon_url; | ||
} | ||
|
||
/** | ||
* @return string|null | ||
*/ | ||
public function getUnit() | ||
{ | ||
return $this->unit; | ||
} | ||
|
||
/** | ||
* @return string|null | ||
*/ | ||
public function getIconColor() | ||
{ | ||
return $this->icon_color; | ||
} | ||
|
||
/** | ||
* @return string|null | ||
*/ | ||
public function getTextColor() | ||
{ | ||
return $this->text_color; | ||
} | ||
|
||
/** | ||
* @return string|null | ||
*/ | ||
public function getValueColor() | ||
{ | ||
return $this->value_color; | ||
} | ||
|
||
/** | ||
* @return float[]|int[]|null | ||
*/ | ||
public function getRange() | ||
{ | ||
return $this->range; | ||
} | ||
|
||
/** | ||
* @return string[]|null | ||
*/ | ||
public function getIconColorRange() | ||
{ | ||
return $this->icon_color_range; | ||
} | ||
|
||
/** | ||
* @return string[]|null | ||
*/ | ||
public function getTextColorRange() | ||
{ | ||
return $this->text_color_range; | ||
} | ||
|
||
/** | ||
* @return string[]|null | ||
*/ | ||
public function getValueColorRange() | ||
{ | ||
return $this->value_color_range; | ||
} | ||
|
||
/** | ||
* @return string[]|null | ||
*/ | ||
public function getStatusTextRange() | ||
{ | ||
return $this->status_text_range; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php | ||
namespace alphayax\freebox\api\v6\models\Home; | ||
|
||
use alphayax\freebox\utils\Model; | ||
|
||
class EndpointValue extends Model | ||
{ | ||
} |
Oops, something went wrong.