From 138273a81d91501f4b36e12036e3f410e288538e Mon Sep 17 00:00:00 2001
From: Jonas Leder <jonas@jonasled.de>
Date: Sun, 29 Jan 2023 22:35:06 +0100
Subject: [PATCH] implement new actions

---
 assets/scripts/deviceSettings.js    | 7 +++----
 src/Controller/ActionController.php | 4 ++++
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/assets/scripts/deviceSettings.js b/assets/scripts/deviceSettings.js
index a92bd88..87f7a5b 100644
--- a/assets/scripts/deviceSettings.js
+++ b/assets/scripts/deviceSettings.js
@@ -6,14 +6,13 @@ async function saveDeviceSettings() {
 
     if(shortPress != '')
     {
-        await fetch('/executeAction', {
+        await fetch('/action/shortDelay', {
             method: 'POST',
             headers: {
                 'Content-Type': 'application/json'
             },
             body: JSON.stringify({
                 'address': Number(originalAddress),
-                'action': 4,
                 'value': Number(shortPress)
             })
         }).then(response => response.json()).then(data => {
@@ -23,7 +22,7 @@ async function saveDeviceSettings() {
 
     if(longPress != '')
     {
-        await fetch('/executeAction', {
+        await fetch('/action/longDelay', {
             method: 'POST',
             headers: {
                 'Content-Type': 'application/json'
@@ -40,7 +39,7 @@ async function saveDeviceSettings() {
 
     if(address != originalAddress)
     {
-        fetch('/executeAction', {
+        fetch('/action/address', {
             method: 'POST',
             headers: {
                 'Content-Type': 'application/json'
diff --git a/src/Controller/ActionController.php b/src/Controller/ActionController.php
index 6c4dedc..29b9370 100644
--- a/src/Controller/ActionController.php
+++ b/src/Controller/ActionController.php
@@ -75,6 +75,10 @@ class ActionController extends AbstractController
             'power' => $this->webResetter->pressPowerButton($requestBody['address'], $requestBody['value']),
             'reset' => $this->webResetter->pressResetButton($requestBody['address'], $requestBody['value']),
             'locate' => $this->webResetter->locateLED($requestBody['address'], $requestBody['value']),
+            'shortDelay' => $this->webResetter->shortDelay($requestBody['address'], $requestBody['value']),
+            'longDelay' => $this->webResetter->longDelay($requestBody['address'], $requestBody['value']),
+            'address' => $this->webResetter->changeAddress($requestBody['address'], $requestBody['value']),
+            'resetController' => $this->webResetter->reset($requestBody['address']),
             default => throw $this->createNotFoundException(),
         };
 
-- 
GitLab