-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
795 additions
and
51 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
# Blink Home Accessory | ||
|
||
[![Version](https://img.shields.io/badge/Symcon-PHP--Modul-red.svg?style=flat-square)](https://www.symcon.de/service/dokumentation/entwicklerbereich/sdk-tools/sdk-php/) | ||
[![Product](https://img.shields.io/badge/Symcon%20Version-6.4-blue.svg?style=flat-square)](https://www.symcon.de/produkt/) | ||
[![Version](https://img.shields.io/badge/Modul%20Version-1.0.20240628-orange.svg?style=flat-square)](https://github.com/Wilkware/BlinkHomeSystem) | ||
[![License](https://img.shields.io/badge/License-CC%20BY--NC--SA%204.0-green.svg?style=flat-square)](https://creativecommons.org/licenses/by-nc-sa/4.0/) | ||
[![Actions](https://img.shields.io/github/actions/workflow/status/wilkware/BlinkHomeSystem/style.yml?branch=main&label=CheckStyle&style=flat-square)](https://github.com/Wilkware/BlinkHomeSystem/actions) | ||
|
||
Mit diesem Modul können Sie spezifische Funktionen des Zubehörs nutzen und steuern. | ||
|
||
## Inhaltverzeichnis | ||
|
||
1. [Funktionsumfang](#user-content-1-funktionsumfang) | ||
2. [Voraussetzungen](#user-content-2-voraussetzungen) | ||
3. [Installation](#user-content-3-installation) | ||
4. [Einrichten der Instanzen in IP-Symcon](#user-content-4-einrichten-der-instanzen-in-ip-symcon) | ||
5. [Statusvariablen und Profile](#user-content-5-statusvariablen-und-profile) | ||
6. [WebFront](#user-content-6-webfront) | ||
7. [PHP-Befehlsreferenz](#user-content-7-php-befehlsreferenz) | ||
8. [Versionshistorie](#user-content-8-versionshistorie) | ||
|
||
### 1. Funktionsumfang | ||
|
||
Blink bietet verschiedene Zubehöre für ihre Produkte an. Soweit sie ansteuerbar sind bzw. eigene Funktionalitäten liefern werden sie über dieses Modul abgebildet. | ||
Es ist derzeit noch nicht absehbar, welchen Funktionsumfang das Modul endgültig umfasst. | ||
|
||
### 2. Voraussetzungen | ||
|
||
* IP-Symcon ab Version 6.4 | ||
|
||
### 3. Installation | ||
|
||
* Über den Module Store das 'Blink Home System'-Modul installieren. | ||
* Alternativ über das Module Control folgende URL hinzufügen | ||
`https://github.com/Wilkware/BlinkHomeSystem` oder `git://github.com/Wilkware/BlinkHomeSystem.git` | ||
|
||
### 4. Einrichten der Instanzen in IP-Symcon | ||
|
||
* Unter "Instanz hinzufügen" ist das _'Blink Home Accessory'_-Modul unter dem Hersteller _'Amazon'_ aufgeführt. | ||
* Über den _'Blink Home Configurator'_ kann eine einfache Installation vorgenommen werden. | ||
Weitere Informationen zum Hinzufügen von Instanzen in der [Dokumentation der Instanzen](https://www.symcon.de/service/dokumentation/konzepte/instanzen/#Instanz_hinzufügen) | ||
|
||
__Konfigurationsseite__: | ||
|
||
_Einstellungsbereich:_ | ||
|
||
> Zubehörinformationen ... | ||
Name | Beschreibung | ||
-------------- | ------------------ | ||
Gerätetyp | Typbezeichnung (Kamera) | ||
Gerätemodell | Modellbezeichnung | ||
Geräte-ID | Interne Gerätenummer (6-stellig) | ||
Netwerk-ID | Interne Netwerknummer (6-stellig) | ||
Ziel-ID | Gerätenummer des verbundenen Endgerätes (Kamera) | ||
|
||
_Aktionsbereich:_ | ||
|
||
Aktion | Beschreibung | ||
------------------- | ------------------ | ||
AN | Schaltet Flutlicht an (Blink Floodlight Mount) | ||
AUS | Schaltet Flutlicht aus (Blink Floodlight Mount) | ||
|
||
### 5. Statusvariablen und Profile | ||
|
||
Die Statusvariablen werden automatisch angelegt. Das Löschen einzelner kann zu Fehlfunktionen führen. | ||
|
||
#### Statusvariablen | ||
|
||
Ident | Name | Typ | Profil | Beschreibung | ||
------------------- | ------------------ | ------- | ---------- | ------------------- | ||
switch_light | Lichtschalter | boolean | ~Switch | Variable zum an- und ausschalten des Flutlichtes | ||
|
||
#### Profile | ||
|
||
Es werden keine zusätzlichen Profile benötigt. | ||
|
||
### 6. WebFront | ||
|
||
Man kann die Statusvariablen direkt im WF verlinken. | ||
|
||
### 7. PHP-Befehlsreferenz | ||
|
||
Ein direkter Aufruf von öffentlichen Funktionen ist nicht notwendig! | ||
|
||
### 8. Versionshistorie | ||
|
||
v1.0.20240630 | ||
|
||
* _NEU_: Initialversion | ||
|
||
## Entwickler | ||
|
||
Seit nunmehr über 10 Jahren fasziniert mich das Thema Haussteuerung. In den letzten Jahren betätige ich mich auch intensiv in der IP-Symcon Community und steuere dort verschiedenste Skript und Module bei. Ihr findet mich dort unter dem Namen @pitti ;-) | ||
|
||
[![GitHub](https://img.shields.io/badge/GitHub-@wilkware-181717.svg?style=for-the-badge&logo=github)](https://wilkware.github.io/) | ||
|
||
## Spenden | ||
|
||
Die Software ist für die nicht kommerzielle Nutzung kostenlos, über eine Spende bei Gefallen des Moduls würde ich mich freuen. | ||
|
||
[![PayPal](https://img.shields.io/badge/PayPal-spenden-00457C.svg?style=for-the-badge&logo=paypal)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=8816166) | ||
|
||
## Lizenz | ||
|
||
Namensnennung - Nicht-kommerziell - Weitergabe unter gleichen Bedingungen 4.0 International | ||
|
||
[![Licence](https://img.shields.io/badge/License-CC_BY--NC--SA_4.0-EF9421.svg?style=for-the-badge&logo=creativecommons)](https://creativecommons.org/licenses/by-nc-sa/4.0/) |
Large diffs are not rendered by default.
Oops, something went wrong.
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,31 @@ | ||
{ | ||
"translations": { | ||
"de": { | ||
"Blink Home Accessory": "Blink Home Zubehör", | ||
"\nBlink Home Accessory\n ": "\nBlink Home Zubehör\n ", | ||
"This module allows you to use and control specific accessory functions.": "Mit diesem Modul können Sie spezifische Funktionen des Zubehörs nutzen und steuern.", | ||
"Accessorie information ...": "Zubehörinformationen ...", | ||
"Device type:": "Gerätetyp:", | ||
"Device model:": "Gerätemodell:", | ||
"Device ID:": "Geräte-ID:", | ||
"Network ID:": "Netwerk-ID:", | ||
"Target ID:": "Ziel-ID:", | ||
"Accessorie": "Zubehör", | ||
"Power supply": "Stromversorgung", | ||
"Battery": "Batterie", | ||
"unknown": "Unbekannt", | ||
"critical": "Niedrig", | ||
"low": "Mittel", | ||
"ok": "Gut", | ||
"usb": "USB", | ||
"On": "An", | ||
"Off": "Aus", | ||
"Switching the floodlight on or off ...": "An- oder Ausschalten des Flutlichtes ...", | ||
"Light switch": "Lichtschalter", | ||
"Advanced settings ...": "Erweiterte Einstellungen ...", | ||
"Development and debug information ...": "Entwicklungs- und Debuginformationen ...", | ||
"Source code, donation and licence ...": "Quellcode, Spende und Lizenz ...", | ||
"The software is free of charge for non-commercial use, I would appreciate a donation if you like the module.": "Die Software ist für die nicht kommerzielle Nutzung kostenlos, über eine Spende bei Gefallen des Moduls würde ich mich sehr freuen." | ||
} | ||
} | ||
} |
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,16 @@ | ||
{ | ||
"id": "{1D064E05-B3D7-54C6-F37D-D0068AEF7B89}", | ||
"name": "Blink Home Accessory", | ||
"url": "https://wilkware.de/ip-symcon-module/blink/", | ||
"type": 3, | ||
"vendor": "Amazon", | ||
"aliases": [], | ||
"parentRequirements": [ | ||
"{83027B09-C481-91E7-6D24-BF49AA871452}" | ||
], | ||
"childRequirements": [], | ||
"implemented": [ | ||
"{7DD36C8D-6581-25FE-9FEA-98024108BED6}" | ||
], | ||
"prefix": "BHS" | ||
} |
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,129 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
// Generell funktions | ||
require_once __DIR__ . '/../libs/_traits.php'; | ||
|
||
// Blink Home Accessory | ||
class BlinkHomeAccessory extends IPSModule | ||
{ | ||
// Helper Traits | ||
use DebugHelper; | ||
use VariableHelper; | ||
|
||
/** | ||
* Overrides the internal IPSModule::Create($id) function | ||
*/ | ||
public function Create() | ||
{ | ||
//Never delete this line! | ||
parent::Create(); | ||
// Connect to client | ||
$this->ConnectParent('{AF126D6D-83D1-44C2-6F61-96A4BB7A0E62}'); | ||
// CommandStatus | ||
$this->RegisterAttributeString('CommandID', ''); | ||
// Device | ||
$this->RegisterPropertyString('DeviceType', 'null'); | ||
$this->RegisterPropertyString('DeviceModel', 'null'); | ||
$this->RegisterPropertyString('DeviceID', ''); | ||
$this->RegisterPropertyString('NetworkID', ''); | ||
$this->RegisterPropertyString('TargetID', ''); | ||
} | ||
|
||
/** | ||
* Overrides the internal IPSModule::Destroy($id) function | ||
*/ | ||
public function Destroy() | ||
{ | ||
//Never delete this line! | ||
parent::Destroy(); | ||
} | ||
|
||
/** | ||
* Configuration Form. | ||
* | ||
* @return JSON configuration string. | ||
*/ | ||
public function GetConfigurationForm() | ||
{ | ||
// Get Form | ||
$form = json_decode(file_get_contents(__DIR__ . '/form.json'), true); | ||
|
||
// Return if parent is not confiured | ||
if (!$this->HasActiveParent()) { | ||
return json_encode($form); | ||
} | ||
|
||
return json_encode($form); | ||
} | ||
|
||
/** | ||
* Overrides the internal IPSModule::ApplyChanges($id) function | ||
*/ | ||
public function ApplyChanges() | ||
{ | ||
//Never delete this line! | ||
parent::ApplyChanges(); | ||
|
||
$this->MaintainVariable('switch_light', $this->Translate('Light switch'), VARIABLETYPE_BOOLEAN, '~Switch', 1, true); | ||
$this->EnableAction('switch_light'); | ||
} | ||
|
||
/** | ||
* RequestAction. | ||
* | ||
* @param string $ident Ident. | ||
* @param string $value Value. | ||
*/ | ||
public function RequestAction($ident, $value) | ||
{ | ||
// Debug output | ||
$this->SendDebug(__FUNCTION__, $ident . ' => ' . $value); | ||
switch ($ident) { | ||
case 'switch_light': | ||
$this->SwitchLight($value); | ||
break; | ||
default: | ||
break; | ||
} | ||
//return true; | ||
} | ||
|
||
/** | ||
* Enable or disable light | ||
* | ||
* @param bool $value true for switch on, otherwise off.. | ||
*/ | ||
private function SwitchLight(bool $value) | ||
{ | ||
$network = $this->ReadPropertyString('NetworkID'); | ||
$device = $this->ReadPropertyString('DeviceID'); | ||
$target = $this->ReadPropertyString('TargetID'); | ||
// Parameter | ||
$param = ['NetworkID' => $network, 'DeviceID' => $device, 'TargetID' => $target, 'Switch' => $value]; | ||
// Request | ||
$response = $this->RequestDataFromParent('light', $param); | ||
$this->SendDebug(__FUNCTION__, $response); | ||
if ($response === '[]') { | ||
$this->SendDebug(__FUNCTION__, 'Error occurred for switching motion detection'); | ||
} else { | ||
$this->SetValueBoolean('switch_light', $value); | ||
} | ||
} | ||
|
||
/** | ||
* Returns the ascending list of category names for a given category id | ||
* | ||
* @param string $endpoint API endpoint request. | ||
* @return string Result of the API call. | ||
*/ | ||
private function RequestDataFromParent(string $endpoint, array $params = []) | ||
{ | ||
return $this->SendDataToParent(json_encode([ | ||
'DataID' => '{83027B09-C481-91E7-6D24-BF49AA871452}', | ||
'Endpoint' => $endpoint, | ||
'Params' => $params, | ||
])); | ||
} | ||
} |
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
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
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
Oops, something went wrong.