Skip to content

Commit

Permalink
Neu: Shelly Plus 2PM Running State hinzugefügt
Browse files Browse the repository at this point in the history
Neu: Public Function ToggleAfter: Shelly Plus1, Shelly Plus 2PM, Shelly Plus Plug S, Shelly Pro 1, Shelly Pro 2, Shelly Pro 3, Shelly Pro 4PM, Shelly Pro 3EM, Gen3 Shelly 1 Mini, Gen3 Shelly 1PM Mini
  • Loading branch information
Schnittcher committed Aug 2, 2024
1 parent b37547a commit fe1f47d
Show file tree
Hide file tree
Showing 28 changed files with 358 additions and 29 deletions.
12 changes: 12 additions & 0 deletions Gen3Shelly1Mini/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,16 @@ Variable ID Status 1 = 12345
```php
RequestAction(12345, true); //Status 1 Einschalten;
RequestAction(12345, false); //Status 1 Ausschalten;
```

```php
SHELLY_ToggleAfter($InstanceID, $switch, $value, $toggle_after)
```
Mit dieser Funktion kann ein Timer gestartet werden.

**Beispiel:**

```php
SHELLY_ToggleAfter(12345, 0, true, 10); //Schaltet Relay 0 für 10 Sekunden auf ein.
SHELLY_ToggleAfter(12345, 0, false, 10); //Schaltet Relay 0 nach 10 Sekunden auf ein.
```
13 changes: 12 additions & 1 deletion Gen3Shelly1Mini/README_en.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,15 @@ Variable ID State 1 = 12345
RequestAction(12345 true); //Switch On State 1
RequestAction(12345 false); //Switch Off State 1

```
```

```php
SHELLY_ToggleAfter($InstanceID, $switch, $value, $toggle_after)
```
This function can be used to start a timer.

**Beispiel:**

```php
SHELLY_ToggleAfter(12345, 0, true, 10); //Switches Relay 0 to on for 10 seconds.
SHELLY_ToggleAfter(12345, 0, false, 10); //Switches Relay 0 to on after 10 seconds.
12 changes: 12 additions & 0 deletions Gen3Shelly1Mini/module.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,18 @@ public function ReceiveData($JSONString)
}
}
}

public function ToggleAfter(int $switch, bool $value, int $toggle_after)
{
$Topic = $this->ReadPropertyString('MQTTTopic') . '/rpc';

$Payload['id'] = 1;
$Payload['src'] = 'user_1';
$Payload['method'] = 'Switch.Set';
$Payload['params'] = ['id' => $switch, 'on' => $value, 'toggle_after' => $toggle_after];

$this->sendMQTT($Topic, json_encode($Payload));
}
private function SwitchMode(int $switch, bool $value)
{
$Topic = $this->ReadPropertyString('MQTTTopic') . '/rpc';
Expand Down
18 changes: 16 additions & 2 deletions ShellyPlus1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
Es können die Kanäle geschaltet werden und die Messwerte werden in IP-Symcon dargestellt.

## Inhaltverzeichnis
1. [Konfiguration](#1-konfiguration)
2. [Funktionen](#2-funktionen)
- [ShellyPlus1](#shellyplus1)
- [Inhaltverzeichnis](#inhaltverzeichnis)
- [1. Konfiguration](#1-konfiguration)
- [2. Funktionen](#2-funktionen)

## 1. Konfiguration

Expand Down Expand Up @@ -40,4 +42,16 @@

RequestAction(25836, true); //Status 4 Einschalten;
RequestAction(25836, false); //Status 4 Ausschalten;
```

```php
SHELLY_ToggleAfter($InstanceID, $switch, $value, $toggle_after)
```
Mit dieser Funktion kann ein Timer gestartet werden.

**Beispiel:**

```php
SHELLY_ToggleAfter(12345, 0, true, 10); //Schaltet Relay 0 für 10 Sekunden auf ein.
SHELLY_ToggleAfter(12345, 0, false, 10); //Schaltet Relay 0 nach 10 Sekunden auf ein.
```
19 changes: 16 additions & 3 deletions ShellyPlus1/README_en.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
The channels can be switched and the sensor data is visualized in IP-Symcon.

## Table of Contents
1. [Configuration](#1-configuration)
2. [Functions](#2-functions)
- [ShellyPlus1PM](#shellyplus1pm)
- [Table of Contents](#table-of-contents)
- [1. Configuration](#1-configuration)
- [2. Functions](#2-functions)

## 1. Configuration

Expand Down Expand Up @@ -41,4 +43,15 @@

RequestAction(25836, true); //Switch On State 4
RequestAction(25836, false); //Switch Off State 4
```
```

```php
SHELLY_ToggleAfter($InstanceID, $switch, $value, $toggle_after)
```
This function can be used to start a timer.

**Beispiel:**

```php
SHELLY_ToggleAfter(12345, 0, true, 10); //Switches Relay 0 to on for 10 seconds.
SHELLY_ToggleAfter(12345, 0, false, 10); //Switches Relay 0 to on after 10 seconds.
13 changes: 12 additions & 1 deletion ShellyPlus1/module.php
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,18 @@ public function ReceiveData($JSONString)
}
}

public function ToggleAfter(int $switch, bool $value, int $toggle_after)
{
$Topic = $this->ReadPropertyString('MQTTTopic') . '/rpc';

$Payload['id'] = 1;
$Payload['src'] = 'user_1';
$Payload['method'] = 'Switch.Set';
$Payload['params'] = ['id' => $switch, 'on' => $value, 'toggle_after' => $toggle_after];

$this->sendMQTT($Topic, json_encode($Payload));
}

private function SwitchMode(int $switch, bool $value)
{
$Topic = $this->ReadPropertyString('MQTTTopic') . '/rpc';
Expand All @@ -188,7 +200,6 @@ private function SwitchMode(int $switch, bool $value)
$Payload['src'] = 'user_1';
$Payload['method'] = 'Switch.Set';
$Payload['params'] = ['id' => $switch, 'on' => $value];

$this->sendMQTT($Topic, json_encode($Payload));
}
}
12 changes: 12 additions & 0 deletions ShellyPlus2PM/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,16 @@
Variable ID Position = 56789
```php
RequestAction(56789, 25); //Rolladen aus 25% fahren!
```

```php
SHELLY_ToggleAfter($InstanceID, $switch, $value, $toggle_after)
```
Mit dieser Funktion kann ein Timer gestartet werden.

**Beispiel:**

```php
SHELLY_ToggleAfter(12345, 0, true, 10); //Schaltet Relay 0 für 10 Sekunden auf ein.
SHELLY_ToggleAfter(12345, 0, false, 10); //Schaltet Relay 0 nach 10 Sekunden auf ein.
```
13 changes: 12 additions & 1 deletion ShellyPlus2PM/README_en.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,15 @@
Variable ID Position = 56789
```php
RequestAction(56789, 25); //Move shutter to 25%
```
```

```php
SHELLY_ToggleAfter($InstanceID, $switch, $value, $toggle_after)
```
This function can be used to start a timer.

**Beispiel:**

```php
SHELLY_ToggleAfter(12345, 0, true, 10); //Switches Relay 0 to on for 10 seconds.
SHELLY_ToggleAfter(12345, 0, false, 10); //Switches Relay 0 to on after 10 seconds.
3 changes: 2 additions & 1 deletion ShellyPlus2PM/locale.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
"External Input Percent 2": "Externer Eingang 2 (Prozent)",
"Device": "Gerät",
"Devices": "Geräte",
"Zeroing by unreach": "Nullung durch Unerreichbarkeit"
"Zeroing by unreach": "Nullung durch Unerreichbarkeit",
"Running State": "Laufender Status"
}
}
}
14 changes: 14 additions & 0 deletions ShellyPlus2PM/module.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class ShellyPlus2PM extends ShellyModule
['Temperature1', 'Temperature1', VARIABLETYPE_FLOAT, '~Temperature', [], 'relay', false, true, false],

['State', 'State', VARIABLETYPE_INTEGER, '~ShutterMoveStop', [], 'roller', true, true, false],
['RunningState', 'Running State', VARIABLETYPE_STRING, '', [], 'roller', true, true, false],
['CoverPosition', 'Position', VARIABLETYPE_INTEGER, '~Shutter', [], 'roller', true, true, false],

['Input0', 'Input 1', VARIABLETYPE_BOOLEAN, '~Switch', [], '', false, true, false],
Expand Down Expand Up @@ -168,6 +169,7 @@ public function ReceiveData($JSONString)
if (array_key_exists('cover:0', $Payload['params'])) {
$cover = $Payload['params']['cover:0'];
if (array_key_exists('state', $cover)) {
$this->SetValue('RunningState', $cover['state']);
switch ($cover['state']) {
case 'stopped':
$this->SetValue('State', 2);
Expand Down Expand Up @@ -328,6 +330,18 @@ public function ReceiveData($JSONString)
}
}

public function ToggleAfter(int $switch, bool $value, int $toggle_after)
{
$Topic = $this->ReadPropertyString('MQTTTopic') . '/rpc';

$Payload['id'] = 1;
$Payload['src'] = 'user_1';
$Payload['method'] = 'Switch.Set';
$Payload['params'] = ['id' => $switch, 'on' => $value, 'toggle_after' => $toggle_after];

$this->sendMQTT($Topic, json_encode($Payload));
}

private function SwitchMode(int $switch, bool $value)
{
$Topic = $this->ReadPropertyString('MQTTTopic') . '/rpc';
Expand Down
12 changes: 12 additions & 0 deletions ShellyPlusPlugsS/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,16 @@
Instanz ID = 12345
```php
SHELLY_SetLEDOff(12345); //Schaltet den Mode auf "Completely off".
```

```php
SHELLY_ToggleAfter($InstanceID, $switch, $value, $toggle_after)
```
Mit dieser Funktion kann ein Timer gestartet werden.

**Beispiel:**

```php
SHELLY_ToggleAfter(12345, 0, true, 10); //Schaltet Relay 0 für 10 Sekunden auf ein.
SHELLY_ToggleAfter(12345, 0, false, 10); //Schaltet Relay 0 nach 10 Sekunden auf ein.
```
13 changes: 12 additions & 1 deletion ShellyPlusPlugsS/README_en.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,15 @@
```php
RequestAction(12345 true); //Switch On
RequestAction(12345 false); //Switch Off
```
```

```php
SHELLY_ToggleAfter($InstanceID, $switch, $value, $toggle_after)
```
This function can be used to start a timer.

**Beispiel:**

```php
SHELLY_ToggleAfter(12345, 0, true, 10); //Switches Relay 0 to on for 10 seconds.
SHELLY_ToggleAfter(12345, 0, false, 10); //Switches Relay 0 to on after 10 seconds.
12 changes: 12 additions & 0 deletions ShellyPlusPlugsS/module.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,18 @@ public function SetLEDOff()
$this->setUiCOnfig($config);
}

public function ToggleAfter(int $switch, bool $value, int $toggle_after)
{
$Topic = $this->ReadPropertyString('MQTTTopic') . '/rpc';

$Payload['id'] = 1;
$Payload['src'] = 'user_1';
$Payload['method'] = 'Switch.Set';
$Payload['params'] = ['id' => $switch, 'on' => $value, 'toggle_after' => $toggle_after];

$this->sendMQTT($Topic, json_encode($Payload));
}

private function SwitchMode(int $switch, bool $value)
{
$Topic = $this->ReadPropertyString('MQTTTopic') . '/rpc';
Expand Down
18 changes: 16 additions & 2 deletions ShellyPro1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
Es können die Kanäle geschaltet werden und die Messwerte werden in IP-Symcon dargestellt.

## Inhaltverzeichnis
1. [Konfiguration](#1-konfiguration)
2. [Funktionen](#2-funktionen)
- [ShellyPro1](#shellypro1)
- [Inhaltverzeichnis](#inhaltverzeichnis)
- [1. Konfiguration](#1-konfiguration)
- [2. Funktionen](#2-funktionen)

## 1. Konfiguration

Expand All @@ -25,4 +27,16 @@
```php
RequestAction(12345, true); //Status Einschalten;
RequestAction(12345, false); //Status Ausschalten;
```

```php
SHELLY_ToggleAfter($InstanceID, $switch, $value, $toggle_after)
```
Mit dieser Funktion kann ein Timer gestartet werden.

**Beispiel:**

```php
SHELLY_ToggleAfter(12345, 0, true, 10); //Schaltet Relay 0 für 10 Sekunden auf ein.
SHELLY_ToggleAfter(12345, 0, false, 10); //Schaltet Relay 0 nach 10 Sekunden auf ein.
```
19 changes: 16 additions & 3 deletions ShellyPro1/README_en.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
The channels can be switched and the sensor data is visualized in IP-Symcon.

## Table of Contents
1. [Configuration](#1-configuration)
2. [Functions](#2-functions)
- [ShellyPro1PM](#shellypro1pm)
- [Table of Contents](#table-of-contents)
- [1. Configuration](#1-configuration)
- [2. Functions](#2-functions)

## 1. Configuration

Expand All @@ -26,4 +28,15 @@
```php
RequestAction(12345 true); //Switch On State
RequestAction(12345 false); //Switch Off State
```
```

```php
SHELLY_ToggleAfter($InstanceID, $switch, $value, $toggle_after)
```
This function can be used to start a timer.

**Beispiel:**

```php
SHELLY_ToggleAfter(12345, 0, true, 10); //Switches Relay 0 to on for 10 seconds.
SHELLY_ToggleAfter(12345, 0, false, 10); //Switches Relay 0 to on after 10 seconds.
12 changes: 12 additions & 0 deletions ShellyPro1/module.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,18 @@ public function ReceiveData($JSONString)
}
}

public function ToggleAfter(int $switch, bool $value, int $toggle_after)
{
$Topic = $this->ReadPropertyString('MQTTTopic') . '/rpc';

$Payload['id'] = 1;
$Payload['src'] = 'user_1';
$Payload['method'] = 'Switch.Set';
$Payload['params'] = ['id' => $switch, 'on' => $value, 'toggle_after' => $toggle_after];

$this->sendMQTT($Topic, json_encode($Payload));
}

private function SwitchMode(int $switch, bool $value)
{
$Topic = $this->ReadPropertyString('MQTTTopic') . '/rpc';
Expand Down
18 changes: 16 additions & 2 deletions ShellyPro2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
Es können die Kanäle geschaltet werden und die Messwerte werden in IP-Symcon dargestellt.

## Inhaltverzeichnis
1. [Konfiguration](#1-konfiguration)
2. [Funktionen](#2-funktionen)
- [ShellyPro2](#shellypro2)
- [Inhaltverzeichnis](#inhaltverzeichnis)
- [1. Konfiguration](#1-konfiguration)
- [2. Funktionen](#2-funktionen)

## 1. Konfiguration

Expand All @@ -31,4 +33,16 @@

RequestAction(56789, true); //Status 2 Einschalten;
RequestAction(56789, false); //Status 2 Ausschalten;
```

```php
SHELLY_ToggleAfter($InstanceID, $switch, $value, $toggle_after)
```
Mit dieser Funktion kann ein Timer gestartet werden.

**Beispiel:**

```php
SHELLY_ToggleAfter(12345, 0, true, 10); //Schaltet Relay 0 für 10 Sekunden auf ein.
SHELLY_ToggleAfter(12345, 0, false, 10); //Schaltet Relay 0 nach 10 Sekunden auf ein.
```
Loading

0 comments on commit fe1f47d

Please sign in to comment.