]> git.basschouten.com Git - openhab-addons.git/commitdiff
[ipcamera| add autoTracking channel for reolink camera (#17488)
authorRonny Grun <ronny.grun@t-online.de>
Sat, 5 Oct 2024 07:53:50 +0000 (09:53 +0200)
committerGitHub <noreply@github.com>
Sat, 5 Oct 2024 07:53:50 +0000 (09:53 +0200)
Signed-off-by: Ronny Grun <ronny.grun@t-online.de>
bundles/org.openhab.binding.ipcamera/README.md
bundles/org.openhab.binding.ipcamera/src/main/java/org/openhab/binding/ipcamera/internal/IpCameraBindingConstants.java
bundles/org.openhab.binding.ipcamera/src/main/java/org/openhab/binding/ipcamera/internal/ReolinkHandler.java
bundles/org.openhab.binding.ipcamera/src/main/resources/OH-INF/i18n/ipcamera.properties
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 5882b31c1a47d372bf23b244d2c62c4d1ad6c5fc..e0abbe6d8274ed3ea9508586005869342594a637 100644 (file)
@@ -220,6 +220,7 @@ The channels are kept consistent as much as possible from brand to brand to make
 | `animalAlarm`               | Switch | RW | Toggles when an animal is in view. |
 | `audioAlarm`                | Switch | R  | When the camera detects noise above a threshold this switch will move to ON. |
 | `autoLED`                    | Switch | RW |When ON this sets a cameras IR LED to automatically turn on or off. |
+| `autoTracking`              | Switch | RW |Turn the automatic mode for tracking ON or OFF. |
 | `autoWhiteLED`              | Switch | RW |When ON this sets a cameras visible white LED to automatically turn on or off. |
 | `carAlarm`                   | Switch | RW | When a car is detected the switch will turn ON. |
 | `cellMotionAlarm`           | Switch | R | ONVIF cameras only will reflect the status of the ONVIF event of the same name. |
index d7219fff9c91fdfa31269b924aeae7ad21a512e8..ddbe231d1157222c5e97fe819bdec57f670ddd98 100644 (file)
@@ -148,4 +148,5 @@ public class IpCameraBindingConstants {
     public static final String CHANNEL_ENABLE_EMAIL = "enableEmail";
     public static final String CHANNEL_ENABLE_PUSH = "enablePush";
     public static final String CHANNEL_ENABLE_RECORDINGS = "enableRecordings";
+    public static final String CHANNEL_AUTO_TRACKING = "autoTracking";
 }
index 2cde80aae1bd0c8d4bdf4b4e2c7f822025e1613b..c4f8100df3dbbf180d082f02399d5d079e654c1f 100644 (file)
@@ -508,6 +508,18 @@ public class ReolinkHandler extends ChannelDuplexHandler {
                                     + ipCameraHandler.cameraConfig.getNvrChannel() + ",\"mode\": 2,\"bright\": " + value
                                     + "}}}]");
                 }
+                break;
+            case CHANNEL_AUTO_TRACKING:
+                if (OnOffType.ON.equals(command)) {
+                    ipCameraHandler.sendHttpPOST("/api.cgi?cmd=SetAiCfg" + ipCameraHandler.reolinkAuth,
+                            "[{\"cmd\":\"SetAiCfg\",\"action\":0,\"param\":{\"bSmartTrack\":1,\"channel\": "
+                                    + ipCameraHandler.cameraConfig.getNvrChannel() + " }}]");
+                } else {
+                    ipCameraHandler.sendHttpPOST("/api.cgi?cmd=SetAiCfg" + ipCameraHandler.reolinkAuth,
+                            "[{\"cmd\":\"SetAiCfg\",\"action\":0,\"param\":{\"bSmartTrack\":0,\"channel\": "
+                                    + ipCameraHandler.cameraConfig.getNvrChannel() + " }}]");
+                }
+                break;
         }
     }
 
index 351e9d39d3f8e24fc72fa4525db1268f650d382d..b6178ff5d053eadd931ad9d7ff59815dcfac887a 100644 (file)
@@ -629,6 +629,8 @@ channel-type.ipcamera.audioAlarm.label = Audio Alarm
 channel-type.ipcamera.audioAlarm.description = Audio has triggered an Alarm.
 channel-type.ipcamera.autoLED.label = Auto LED
 channel-type.ipcamera.autoLED.description = Turn the automatic mode for the LED ON and OFF.
+channel-type.ipcamera.autoTracking.label = Auto Tracking
+channel-type.ipcamera.autoTracking.description = Turn the automatic mode for tracking ON or OFF.
 channel-type.ipcamera.autoWhiteLED.label = Auto White LED
 channel-type.ipcamera.autoWhiteLED.description = Turn the automatic mode for the visible white LED ON or OFF.
 channel-type.ipcamera.carAlarm.label = Car Alarm
index 77d294606b3013e94d763d7093aecc87fa172b26..c4c0acc6966de3a048c7e2e70a11a2dda55b832f 100644 (file)
                        <channel id="enableFTP" typeId="enableFTP"/>
                        <channel id="enableEmail" typeId="enableEmail"/>
                        <channel id="enablePush" typeId="enablePush"/>
+                       <channel id="autoTracking" typeId="autoTracking"/>
                </channels>
 
                <properties>
-                       <property name="thingTypeVersion">1</property>
+                       <property name="thingTypeVersion">2</property>
                </properties>
 
                <config-description>
                        </options>
                </state>
        </channel-type>
+
+       <channel-type id="autoTracking" advanced="true">
+               <item-type>Switch</item-type>
+               <label>Auto Tracking</label>
+               <description>Turn the automatic mode for tracking ON or OFF.</description>
+       </channel-type>
 </thing:thing-descriptions>
index 267bed561ab5b5477c23797b78fb08e9fec51127..c4d2f4e4f7c537e386e900b003540a5d12a73ff9 100644 (file)
                                <type>ipcamera:enablePush</type>
                        </add-channel>
                </instruction-set>
+               <instruction-set targetVersion="2">
+                       <add-channel id="autoTracking">
+                               <type>ipcamera:autoTracking</type>
+                       </add-channel>
+               </instruction-set>
        </thing-type>
 
        <thing-type uid="ipcamera:dahua">