Skip to content

Commit

Permalink
Update v1.8.20241024
Browse files Browse the repository at this point in the history
  • Loading branch information
Wilkware committed Oct 24, 2024
1 parent 3d484c4 commit e61fbd3
Show file tree
Hide file tree
Showing 15 changed files with 528 additions and 319 deletions.
4 changes: 2 additions & 2 deletions Blink Home Accessory/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Mit diesem Modul können Sie spezifische Funktionen des Zubehörs nutzen und ste
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)
6. [Visualisierung](#user-content-6-visualisierung)
7. [PHP-Befehlsreferenz](#user-content-7-php-befehlsreferenz)
8. [Versionshistorie](#user-content-8-versionshistorie)

Expand Down Expand Up @@ -75,7 +75,7 @@ switch_light | Lichtschalter | boolean | ~Switch | Variable zum a

Es werden keine zusätzlichen Profile benötigt.

### 6. WebFront
### 6. Visualisierung

Man kann die Statusvariablen direkt im WF verlinken.

Expand Down
9 changes: 7 additions & 2 deletions Blink Home Client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ IP-Symcon Modul für die zentrale Kommunikation mit den Blink Servern.
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)
6. [Visualisierung](#user-content-6-visualisierung)
7. [PHP-Befehlsreferenz](#user-content-7-php-befehlsreferenz)
8. [Versionshistorie](#user-content-8-versionshistorie)

Expand Down Expand Up @@ -87,7 +87,7 @@ OPTIONEN | Abrufen und Anzeigen der eingestellten Optionen

Es werden keine zusätzlichen Statusvariablen oder Profile benötigt.

### 6. WebFront
### 6. Visualisierung

Es ist keine weitere Steuerung oder gesonderte Darstellung integriert.

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

### 8. Versionshistorie

v1.8.20241024

* _NEU_: Blink API Layer für Directaufnamen (Record) erweitert
* _FIX_: Rechenfehler bei Zeiteinstellung (Heartbeat) korrigiert

v1.7.20240628

* _NEU_: Blink API Layer für Zubehör erweitert
Expand Down
15 changes: 11 additions & 4 deletions Blink Home Client/module.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function Create()
// Password
$this->RegisterPropertyString('AccountPassword', '');
// Heartbeat
$this->RegisterPropertyInteger('HeartbeatInterval', 24);
$this->RegisterPropertyInteger('HeartbeatInterval', 12);
// Heartbeat Timer
$this->RegisterTimer('TimerHeartbeat', 0, 'IPS_RequestAction(' . $this->InstanceID . ', "heartbeat", "");');
}
Expand Down Expand Up @@ -113,8 +113,8 @@ public function ApplyChanges()
parent::ApplyChanges();

$heartbeat = $this->ReadPropertyInteger('HeartbeatInterval');
// Timer ?
$this->SetTimerInterval('TimerHeartbeat', 60 * 1000 * $heartbeat);
// Timer (60min * 60sec * 1000ms)?
$this->SetTimerInterval('TimerHeartbeat', 60 * 60 * 1000 * $heartbeat);
}

/**
Expand Down Expand Up @@ -193,6 +193,12 @@ public function ForwardData($json)
$encode = true;
}
break;
case 'record':
$params = (array) $data['Params'];
if (isset($params['NetworkID']) && isset($params['DeviceID']) && isset($params['DeviceType'])) {
$result = $this->doRecord($token, $region, $account, $params['NetworkID'], $params['DeviceID'], $params['DeviceType']);
}
break;
case 'thumbnail':
$params = (array) $data['Params'];
if (isset($params['NetworkID']) && isset($params['DeviceID']) && isset($params['DeviceType'])) {
Expand Down Expand Up @@ -261,7 +267,8 @@ public function ForwardData($json)
}
// binary data
if ($encode == true) {
$result = utf8_encode($result);
$result = bin2hex($result);
//$result = utf8_encode($result);
}
// Return
return $result;
Expand Down
4 changes: 2 additions & 2 deletions Blink Home Configurator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ IP-Symcon Modul für die Verwaltung alle im Netzwerk befindlichen Bilnk Geräte.
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)
6. [Visualisierung](#user-content-6-visualisierung)
7. [PHP-Befehlsreferenz](#user-content-7-php-befehlsreferenz)
8. [Versionshistorie](#user-content-8-versionshistorie)

Expand Down Expand Up @@ -64,7 +64,7 @@ Geräte | Konfigurationsliste zum Verwalten der entsprechenden

Es werden keine zusätzlichen Statusvariablen oder Profile benötigt.

### 6. WebFront
### 6. Visualisierung

Es ist keine weitere Steuerung oder gesonderte Darstellung integriert.

Expand Down
13 changes: 10 additions & 3 deletions Blink Home Device/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.7.20240628-orange.svg?style=flat-square)](https://github.com/Wilkware/BlinkHomeSystem)
[![Version](https://img.shields.io/badge/Modul%20Version-1.8.20241024-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 All @@ -15,7 +15,7 @@ Ermöglicht die Kommunikation mit einem Blink Endgerät, derzeit vornehmlich Kam
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)
6. [Visualisierung](#user-content-6-visualisierung)
7. [PHP-Befehlsreferenz](#user-content-7-php-befehlsreferenz)
8. [Versionshistorie](#user-content-8-versionshistorie)

Expand Down Expand Up @@ -112,7 +112,7 @@ Name | Typ | Beschreibung
BHS.Update | Integer | Auslöser Profil (1: '►')
BHS.Battery | Integer | Batterieladezustandsanzeige (0 ... 3)

### 6. WebFront
### 6. Visualisierung

Man kann die Statusvariablen direkt im WF verlinken.

Expand All @@ -122,6 +122,13 @@ Ein direkter Aufruf von öffentlichen Funktionen ist nicht notwendig!

### 8. Versionshistorie

v1.8.20241024

* _NEU_: Auslösen einer Direktaufnahme (Clip aufnehmen)
* _NEU_: Neue Option zum automatischen Zurücksetzen des Kommando-Stacks
* _NEU_: Zufälliger Zeit-Offset bei Neustart (un damit auch bei Konfigurationsänderungen)
* _FIX_: Konfigurationsformular vereinheitlicht

v1.7.20240628

* _NEU_: Support für Blink Mini 2
Expand Down
62 changes: 42 additions & 20 deletions Blink Home Device/form.json
Original file line number Diff line number Diff line change
Expand Up @@ -238,23 +238,27 @@
"suffix": "minutes",
"minimum": 0,
"maximum": 1440,
"width": "450px"
"width": "221px"
}
]
},
{
"type": "SelectEvent",
"name": "ImageSchedule",
"caption": "Schedule:",
"width": "450px"
},
{
"type": "RowLayout",
"items": [
{
"type": "SelectEvent",
"name": "ImageSchedule",
"caption": "Schedule:",
"width": "450px"
"type": "Button",
"caption": "Add Schedule",
"onClick": "IPS_RequestAction($id,'create_schedule',$id);"
},
{
"type": "Label",
"name": "LabelSchedule",
"caption": "The schedule for updating the snapshots can be created via the button below!"
"caption": "With the help of the button you can create a weekly programme.\nIt is created below the instance. It can then be set to your own needs."
}
]
}
Expand All @@ -274,29 +278,47 @@
"name": "UpdateBattery",
"caption": "Create a variable to display the battery charge level!",
"visible": false
},
{
"type": "RowLayout",
"items": [
{
"type": "CheckBox",
"name": "ResetCommand",
"caption": "Automatic reset of the command stack!"
},
{
"type": "Label",
"caption": "WARNING: Activation can lead to functional errors under certain circumstances!",
"italic": true,
"color": 16711680
}
]
}
]
}
],
"actions": [
{
"type": "Label",
"caption": "With the help of the button you can create a weekly programme.\nIt is created below the instance. It can then be set to your own needs."
},
{
"type": "Button",
"caption": "Add Schedule",
"onClick": "IPS_RequestAction($id,'create_schedule',$id);"
},
{
"type": "Label",
"caption": "Taking a ..."
},
{
"type": "Button",
"caption": "Snapshot",
"onClick": "IPS_RequestAction($id,'snapshot',$id);",
"enabled": false
"type": "RowLayout",
"items": [
{
"type": "Button",
"caption": "Snapshot",
"onClick": "IPS_RequestAction($id,'snapshot',$id);",
"enabled": false
},
{
"type": "Button",
"caption": "Record",
"onClick": "IPS_RequestAction($id,'record',$id);",
"enabled": true
}
]
},
{
"name": "EchoPopup",
Expand Down
5 changes: 4 additions & 1 deletion Blink Home Device/locale.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
"Create a variable to trigger a snapshot of the current view of the camera!": "Anlegen einer Variabel zur Auslösung einer Momentaufnahme der aktuellen Ansicht der Kamera!",
"Create a variable to display the battery charge level!": "Erstellen einer Variable zur Anzeige des Ladezustands der Batterie!",
"Create a timestamp on each snapshot!": "Erstellen eines Zeitstempels auf jeder Momentaufnahme!",
"Automatic reset of the command stack!": "Automatisches Zurücksetzen des Kommando-Stacks!",
"WARNING: Activation can lead to functional errors under certain circumstances!": "WARNUNG: Aktivierung kann unter Umständen zu Funktionsfehlern führen!",
"Top margin:": "Seitenrand Oben:",
"Left margin:": "Seitenrand Links:",
"Font size:": "Schriftgröße:",
Expand All @@ -50,9 +52,10 @@
"ok": "Gut",
"usb": "USB",
"Reset": "Zurücksetzen",
"Record": "Aufnehmen",
"Image": "Bild",
"Advanced settings ...": "Erweiterte Einstellungen ...",
"Taking a ...": "Momentaufnahme machen ...",
"Taking a ...": "Einen Momentaufnahme oder Aufzeichnung machen ...",
"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."
Expand Down
63 changes: 52 additions & 11 deletions Blink Home Device/module.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ public function Create()
// Variable
$this->RegisterPropertyBoolean('UpdateImage', false);
$this->RegisterPropertyBoolean('UpdateBattery', false);
$this->RegisterPropertyBoolean('ResetCommand', false);
// Register update timer
$this->RegisterTimer('TimerSnapshot', 0, 'IPS_RequestAction(' . $this->InstanceID . ', "snapshot", "");');
$this->RegisterTimer('TimerCommand', 0, 'IPS_RequestAction(' . $this->InstanceID . ', "command", "");');
Expand Down Expand Up @@ -130,7 +131,7 @@ public function GetConfigurationForm()
}

// Buttons?
$form['actions'][3]['enabled'] = $snapshot;
$form['actions'][1]['items'][0]['enabled'] = $snapshot;

// Debug output
//$this->SendDebug(__FUNCTION__, $form);
Expand Down Expand Up @@ -167,19 +168,27 @@ public function ApplyChanges()
$this->SetValueInteger('snapshot', 1);
$this->EnableAction('snapshot');
}
// Record clip
$this->MaintainVariable('record', $this->Translate('Record'), VARIABLETYPE_INTEGER, 'BHS.Update', 4, true);
$this->SetValueInteger('snapshot', 1);
$this->EnableAction('record');
// Update battery
$this->MaintainVariable('battery', $this->Translate('Battery'), VARIABLETYPE_INTEGER, 'BHS.Battery', 3, $battery);
// Media Object
if ($image) {
$this->CreateMediaImage('thumbnail', $this->Translate('Image'), $device, 'jpg', $cache);
// Timer solo or over schedule?
if ($schedule == 0) {
$this->SetTimerInterval('TimerSnapshot', 60 * 1000 * $interval);
} else {
$wsi = $this->GetWeeklyScheduleInfo($schedule, time(), true);
$this->SendDebug(__FUNCTION__, $wsi);
if ($wsi['ActionID'] == self::BLINK_SCHEDULE_SNAPSHOT_ON) {
$this->SetTimerInterval('TimerSnapshot', 60 * 1000 * $interval);
// Timer active?
if ($interval > 0) {
$rand = rand(30, 180) * 1000;
// Timer solo or schedule?
if ($schedule == 0) {
$this->SetTimerInterval('TimerSnapshot', $rand + (60 * 1000 * $interval));
} else {
$wsi = $this->GetWeeklyScheduleInfo($schedule, time(), true);
$this->SendDebug(__FUNCTION__, $wsi);
if ($wsi['ActionID'] == self::BLINK_SCHEDULE_SNAPSHOT_ON) {
$this->SetTimerInterval('TimerSnapshot', $rand + (60 * 1000 * $interval));
}
}
}
} else {
Expand Down Expand Up @@ -214,6 +223,9 @@ public function RequestAction($ident, $value)
case 'liveview':
$this->LiveView();
break;
case 'record':
$this->Record();
break;
case 'signals':
$this->Signals();
break;
Expand Down Expand Up @@ -273,8 +285,14 @@ private function Thumbnail()
{
$command = $this->ReadAttributeString('CommandID');
if ($command != '') {
$this->LogMessage('[' . IPS_GetName($this->InstanceID) . '] ' . ' Command still active!', KL_ERROR);
$this->SendDebug(__FUNCTION__, 'Command still active!');
$reset = $this->ReadPropertyBoolean('ResetCommand');
if ($reset) {
$this->LogMessage('[' . IPS_GetName($this->InstanceID) . '] ' . ' Commando was reset!', KL_WARNING);
$this->WriteAttributeString('CommandID', '');
} else {
$this->LogMessage('[' . IPS_GetName($this->InstanceID) . '] ' . ' Command still active!', KL_ERROR);
}
return;
}
$network = $this->ReadPropertyString('NetworkID');
Expand Down Expand Up @@ -360,7 +378,8 @@ private function Image()
// get image
$param = ['Path' => $path];
// Request
$response = utf8_decode($this->RequestDataFromParent('image', $param));
//FIXME: $response = utf8_decode($this->RequestDataFromParent('image', $param));
$response = hex2bin($this->RequestDataFromParent('image', $param));
if ($response === '[]') {
$this->SendDebug(__FUNCTION__, 'No Image for Path!');
return;
Expand Down Expand Up @@ -442,6 +461,28 @@ private function LiveView()
}
}

/**
* Start a live recording clip.
*/
private function Record()
{
$network = $this->ReadPropertyString('NetworkID');
$device = $this->ReadPropertyString('DeviceID');
$type = $this->ReadPropertyString('DeviceType');
// Parameter
$param = ['NetworkID' => $network, 'DeviceID' => $device, 'DeviceType' => $type];
// Request
$response = $this->RequestDataFromParent('record', $param);
$this->SendDebug(__FUNCTION__, $response);
if ($response === '[]') {
$this->SendDebug(__FUNCTION__, 'Error occurred for liveview');
}
else {
// Echo message
$this->EchoMessage($this->PrettyPrint(null, $response));
}
}

/**
* Get Signal information
*/
Expand Down
Loading

0 comments on commit e61fbd3

Please sign in to comment.