]> git.basschouten.com Git - openhab-addons.git/commitdiff
Add new AI alarms for Foscam (#16775)
authorMatthew Skinner <matt@pcmus.com>
Sun, 19 May 2024 12:23:38 +0000 (22:23 +1000)
committerGitHub <noreply@github.com>
Sun, 19 May 2024 12:23:38 +0000 (14:23 +0200)
Signed-off-by: Matthew Skinner <matt@pcmus.com>
bundles/org.openhab.binding.ipcamera/src/main/java/org/openhab/binding/ipcamera/internal/FoscamHandler.java
bundles/org.openhab.binding.ipcamera/src/main/resources/OH-INF/thing/thing-types.xml
bundles/org.openhab.binding.ipcamera/src/main/resources/OH-INF/update/instructions.xml

index fef6343de78ab203e49833bba6697029c703e20d..84227d70b333df6e767a1d10a558545e03fec6b4 100644 (file)
@@ -105,6 +105,30 @@ public class FoscamHandler extends ChannelDuplexHandler {
                 ipCameraHandler.setChannelState(CHANNEL_ENABLE_LED, OnOffType.ON);
             }
 
+            if (content.contains("<humanDetectAlarmState>2</humanDetectAlarmState>")) {
+                ipCameraHandler.motionDetected(CHANNEL_HUMAN_ALARM);
+            } else if (content.contains("<humanDetectAlarmState>1</humanDetectAlarmState>")) {
+                ipCameraHandler.noMotionDetected(CHANNEL_HUMAN_ALARM);
+            }
+
+            if (content.contains("<crossLineDetectAlarmState>2</crossLineDetectAlarmState>")) {
+                ipCameraHandler.motionDetected(CHANNEL_LINE_CROSSING_ALARM);
+            } else if (content.contains("<crossLineDetectAlarmState>1</crossLineDetectAlarmState>")) {
+                ipCameraHandler.noMotionDetected(CHANNEL_LINE_CROSSING_ALARM);
+            }
+
+            if (content.contains("<carDetectAlarmState>2</carDetectAlarmState>")) {
+                ipCameraHandler.motionDetected(CHANNEL_CAR_ALARM);
+            } else if (content.contains("<carDetectAlarmState>1</carDetectAlarmState>")) {
+                ipCameraHandler.noMotionDetected(CHANNEL_CAR_ALARM);
+            }
+
+            if (content.contains("<petDetectAlarmState>2</petDetectAlarmState>")) {
+                ipCameraHandler.motionDetected(CHANNEL_ANIMAL_ALARM);
+            } else if (content.contains("<petDetectAlarmState>1</petDetectAlarmState>")) {
+                ipCameraHandler.noMotionDetected(CHANNEL_ANIMAL_ALARM);
+            }
+
             if (content.contains("</CGI_Result>")) {
                 ctx.close();
             }
index cfa00fd3f58ccf2091eb41eab4b7bba4e22f5f29..77d294606b3013e94d763d7093aecc87fa172b26 100644 (file)
                        <channel id="mp4History" typeId="mp4History"/>
                        <channel id="mp4HistoryLength" typeId="mp4HistoryLength"/>
                        <channel id="lastMotionType" typeId="lastMotionType"/>
+                       <channel id="lineCrossingAlarm" typeId="lineCrossingAlarm"/>
                        <channel id="ffmpegMotionControl" typeId="ffmpegMotionControl"/>
                        <channel id="ffmpegMotionAlarm" typeId="ffmpegMotionAlarm"/>
                        <channel id="enableMotionAlarm" typeId="enableMotionAlarm"/>
                        <channel id="rtspUrl" typeId="rtspUrl"/>
                        <channel id="imageUrl" typeId="imageUrl"/>
                        <channel id="hlsUrl" typeId="hlsUrl"/>
+                       <channel id="carAlarm" typeId="carAlarm"/>
+                       <channel id="humanAlarm" typeId="humanAlarm"/>
+                       <channel id="animalAlarm" typeId="animalAlarm"/>
                </channels>
+               <properties>
+                       <property name="thingTypeVersion">1</property>
+               </properties>
                <config-description>
 
                        <parameter-group name="Settings">
index 20fd7b2aa06258e85bc51e3f22a7414593be7df5..267bed561ab5b5477c23797b78fb08e9fec51127 100644 (file)
                </instruction-set>
        </thing-type>
 
+       <thing-type uid="ipcamera:foscam">
+               <instruction-set targetVersion="1">
+                       <add-channel id="carAlarm">
+                               <type>ipcamera:carAlarm</type>
+                       </add-channel>
+                       <add-channel id="humanAlarm">
+                               <type>ipcamera:humanAlarm</type>
+                       </add-channel>
+                       <add-channel id="animalAlarm">
+                               <type>ipcamera:animalAlarm</type>
+                       </add-channel>
+                       <add-channel id="lineCrossingAlarm">
+                               <type>ipcamera:lineCrossingAlarm</type>
+                       </add-channel>
+               </instruction-set>
+       </thing-type>
 </update:update-descriptions>