From dab52f4e58a4bba787f97d2559f0356bde23ead0 Mon Sep 17 00:00:00 2001 From: Matthew Skinner Date: Sun, 19 May 2024 22:23:38 +1000 Subject: [PATCH] Add new AI alarms for Foscam (#16775) Signed-off-by: Matthew Skinner Signed-off-by: Ciprian Pascu --- .../ipcamera/internal/FoscamHandler.java | 24 +++++++++++++++++++ .../resources/OH-INF/thing/thing-types.xml | 7 ++++++ .../resources/OH-INF/update/instructions.xml | 16 +++++++++++++ 3 files changed, 47 insertions(+) diff --git a/bundles/org.openhab.binding.ipcamera/src/main/java/org/openhab/binding/ipcamera/internal/FoscamHandler.java b/bundles/org.openhab.binding.ipcamera/src/main/java/org/openhab/binding/ipcamera/internal/FoscamHandler.java index fef6343de78..84227d70b33 100644 --- a/bundles/org.openhab.binding.ipcamera/src/main/java/org/openhab/binding/ipcamera/internal/FoscamHandler.java +++ b/bundles/org.openhab.binding.ipcamera/src/main/java/org/openhab/binding/ipcamera/internal/FoscamHandler.java @@ -105,6 +105,30 @@ public class FoscamHandler extends ChannelDuplexHandler { ipCameraHandler.setChannelState(CHANNEL_ENABLE_LED, OnOffType.ON); } + if (content.contains("2")) { + ipCameraHandler.motionDetected(CHANNEL_HUMAN_ALARM); + } else if (content.contains("1")) { + ipCameraHandler.noMotionDetected(CHANNEL_HUMAN_ALARM); + } + + if (content.contains("2")) { + ipCameraHandler.motionDetected(CHANNEL_LINE_CROSSING_ALARM); + } else if (content.contains("1")) { + ipCameraHandler.noMotionDetected(CHANNEL_LINE_CROSSING_ALARM); + } + + if (content.contains("2")) { + ipCameraHandler.motionDetected(CHANNEL_CAR_ALARM); + } else if (content.contains("1")) { + ipCameraHandler.noMotionDetected(CHANNEL_CAR_ALARM); + } + + if (content.contains("2")) { + ipCameraHandler.motionDetected(CHANNEL_ANIMAL_ALARM); + } else if (content.contains("1")) { + ipCameraHandler.noMotionDetected(CHANNEL_ANIMAL_ALARM); + } + if (content.contains("")) { ctx.close(); } diff --git a/bundles/org.openhab.binding.ipcamera/src/main/resources/OH-INF/thing/thing-types.xml b/bundles/org.openhab.binding.ipcamera/src/main/resources/OH-INF/thing/thing-types.xml index cfa00fd3f58..77d294606b3 100644 --- a/bundles/org.openhab.binding.ipcamera/src/main/resources/OH-INF/thing/thing-types.xml +++ b/bundles/org.openhab.binding.ipcamera/src/main/resources/OH-INF/thing/thing-types.xml @@ -1444,6 +1444,7 @@ + @@ -1462,7 +1463,13 @@ + + + + + 1 + diff --git a/bundles/org.openhab.binding.ipcamera/src/main/resources/OH-INF/update/instructions.xml b/bundles/org.openhab.binding.ipcamera/src/main/resources/OH-INF/update/instructions.xml index 20fd7b2aa06..267bed561ab 100644 --- a/bundles/org.openhab.binding.ipcamera/src/main/resources/OH-INF/update/instructions.xml +++ b/bundles/org.openhab.binding.ipcamera/src/main/resources/OH-INF/update/instructions.xml @@ -31,4 +31,20 @@ + + + + ipcamera:carAlarm + + + ipcamera:humanAlarm + + + ipcamera:animalAlarm + + + ipcamera:lineCrossingAlarm + + +