Skip to content

Commit

Permalink
Update v1.7.20240628
Browse files Browse the repository at this point in the history
  • Loading branch information
Wilkware committed Jun 28, 2024
1 parent d11994f commit 42130b7
Show file tree
Hide file tree
Showing 21 changed files with 795 additions and 51 deletions.
108 changes: 108 additions & 0 deletions Blink Home Accessory/README.md
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/)
166 changes: 166 additions & 0 deletions Blink Home Accessory/form.json

Large diffs are not rendered by default.

31 changes: 31 additions & 0 deletions Blink Home Accessory/locale.json
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."
}
}
}
16 changes: 16 additions & 0 deletions Blink Home Accessory/module.json
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"
}
129 changes: 129 additions & 0 deletions Blink Home Accessory/module.php
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,
]));
}
}
7 changes: 6 additions & 1 deletion Blink Home Client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![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.6.20240606-orange.svg?style=flat-square)](https://github.com/Wilkware/BlinkHomeSystem)
[![Version](https://img.shields.io/badge/Modul%20Version-1.7.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)

Expand Down Expand Up @@ -123,6 +123,11 @@ Die Funktion liefert '1' im Erfolgsfall, sonst '0'.

### 8. Versionshistorie

v1.7.20240628

* _NEU_: Blink API Layer für Zubehör erweitert
* _FIX_: Konfigurationsformular überarbeitet und vereinheitlicht

v1.6.20240606

* _FIX_: Downloads von Videos verbessert
Expand Down
4 changes: 0 additions & 4 deletions Blink Home Client/form.json
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,6 @@
}
]
},
{
"type": "Label",
"caption": "\n"
},
{
"type": "ExpansionPanel",
"caption": "Source code, donation and licence ...",
Expand Down
6 changes: 6 additions & 0 deletions Blink Home Client/module.php
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,12 @@ public function ForwardData($json)
$result = $this->doMotion($token, $region, $account, $params['NetworkID'], $params['DeviceID'], $params['DeviceType'], $params['Detection']);
}
break;
case 'light':
$params = (array) $data['Params'];
if (isset($params['NetworkID']) && isset($params['DeviceID']) && isset($params['TargetID']) && isset($params['Switch'])) {
$result = $this->doLight($token, $region, $account, $params['NetworkID'], $params['TargetID'], $params['DeviceID'], $params['Switch']);
}
break;
case 'command':
$params = (array) $data['Params'];
if (isset($params['NetworkID']) && isset($params['CommandID'])) {
Expand Down
9 changes: 8 additions & 1 deletion Blink Home Configurator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![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.6.20240606-orange.svg?style=flat-square)](https://github.com/Wilkware/BlinkHomeSystem)
[![Version](https://img.shields.io/badge/Modul%20Version-1.7.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)

Expand Down Expand Up @@ -74,6 +74,13 @@ Das Modul bietet keine direkten Funktionsaufrufe.

### 8. Versionshistorie

v1.7.20240628

* _NEU_: Support für Mini 2 Kamera
* _NEU_: Support für Fllodlight Mount (Zubehör)
* _NEU_: Stromversorgungsart und Batterieladezustand hinzugefügt bzw. getrennt
* _FIX_: Fehler in Übersetzungen berichtigt

v1.6.20240606

* _NEU_: Support für Blink Indoor Kamera (3rd Gen)
Expand Down
15 changes: 10 additions & 5 deletions Blink Home Configurator/form.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
{
"caption": "DeviceID",
"name": "id",
"width": "100px"
"width": "75px"
},
{
"caption": "Name",
Expand All @@ -58,20 +58,25 @@
{
"caption": "Model",
"name": "model",
"width": "150px"
"width": "175px"
},
{
"caption": "Power",
"name": "power",
"width": "100px"
},
{
"caption": "Battery",
"caption": "Charging",
"name": "battery",
"width": "75ox"
"width": "75px"
},
{
"caption": "Firmware",
"name": "firmware",
"width": "75px"
},
{
"caption": "NetworkID",
"caption": "Network",
"name": "network",
"width": "75px"
}
Expand Down
Loading

0 comments on commit 42130b7

Please sign in to comment.