Ver Fonte

Nexsmart Devices (Watch 2, Air 2, Air 3) (#3894)

* nexsmart_watch2_camera.yaml

Camera Device from Nexsmart. USB connected camera. No battery and therefor always on.
This integration does NOT support Camera directly from Tuya - For that you will use RTSP
This only expose all sensors
- I plan on importing the other types of cameras from nexsmart
- Streamlined all "nexsmart" yaml files. 
Notice "101" does not work for Tuya Local??
- add snapshot back as an event so it can still be captured if post processing to download the actual image from cloud can be figured out

* nexsmart_air2_camera.yaml
* nexsmart_air3_camera.yaml
Added confa for nexsmart air 2 and 3 cameras

PR #3894
---------

Co-authored-by: Jason Rumney <make-all@users.noreply.github.com>
Oliver Christensen há 3 meses atrás
pai
commit
f63238b084

+ 239 - 0
custom_components/tuya_local/devices/nexsmart_air2_camera.yaml

@@ -0,0 +1,239 @@
+name: Camera
+products:
+  # The product ID (or product_id) from your device information
+  - id: 0waimqh4mplog68x
+    manufacturer: Nexsmart
+    model: AIR 2
+entities:
+  # ------------------------------------
+  # 1. Main Camera & Snapshot
+  # ------------------------------------
+  - entity: event
+    name: Camera
+    category: diagnostic
+    icon: "mdi:camera-burst"
+    # Snapshot trigger (matches movement_detect_pic: 115)
+    dps:
+      - id: 115
+        name: event
+        type: base64
+        optional: true
+        sensitive: true
+        mapping:
+          - dps_val: null
+            value: null
+          - value: captured
+      - id: 115
+        name: snapshot_data
+        type: base64
+        optional: true
+        sensitive: true
+  # ------------------------------------
+  # 2. Battery and Power
+  # ------------------------------------
+  - entity: sensor
+    class: battery
+    category: diagnostic
+    # Battery Level Sensor (matches wireless_electricity: 145)
+    dps:
+      - id: 145
+        type: integer
+        name: sensor
+
+  - entity: binary_sensor
+    class: battery_charging
+    # Power Mode Sensor (matches wireless_powermode: 146)
+    dps:
+      - id: 146
+        type: string
+        name: sensor
+        mapping:
+          - dps_val: "0"
+            value: false
+          - dps_val: "1"
+            value: true
+
+  - entity: binary_sensor
+    class: connectivity
+    category: diagnostic
+    # Awake/Sleep Status (matches wireless_awake: 149)
+    dps:
+      - id: 149
+        type: boolean
+        name: sensor
+
+  - entity: number
+    name: Low battery threshold
+    icon: "mdi:battery-alert-variant-outline"
+    category: config
+    # Low Battery Threshold (matches wireless_lowpower: 147)
+    dps:
+      - id: 147
+        type: integer
+        name: value
+        unit: "%"
+        # Range is 10-50 based on device dump
+        range:
+          min: 10
+          max: 50
+
+  # ------------------------------------
+  # 3. Basic Configuration
+  # ------------------------------------
+
+  - entity: switch
+    name: Flip image
+    category: config
+    icon: "mdi:flip-horizontal"
+    # Flip Image Switch (matches basic_flip: 103)
+    dps:
+      - id: 103
+        type: boolean
+        name: switch
+        optional: true
+
+  - entity: switch
+    name: Watermark
+    category: config
+    icon: "mdi:watermark"
+    # Watermark/OSD Switch (matches basic_osd: 104)
+    dps:
+      - id: 104
+        type: boolean
+        name: switch
+        optional: true
+
+  - entity: select
+    name: Night vision
+    icon: "mdi:weather-night"
+    category: config
+    # Night Vision Mode Selector(matches basic_nightvision: 108)
+    dps:
+      - id: 108
+        type: string
+        name: option
+        optional: true
+        mapping:
+          - dps_val: "0"
+            value: Auto
+          - dps_val: "1"
+            value: "Off"
+          - dps_val: "2"
+            value: "On"
+
+  # ------------------------------------
+  # 4. Detection & Alarm
+  # ------------------------------------
+  - entity: switch
+    name: Motion detection
+    icon: "mdi:motion-sensor"
+    category: config
+    # PIR Switch (matches ipc_pir_switch: 240)
+    dps:
+      - id: 240
+        type: boolean
+        name: switch
+
+  - entity: number
+    name: Motion sensitivity
+    icon: "mdi:ruler-square"
+    category: config
+    # PIR Sensitivity (matches ipc_pir_sensitivity: 241)
+    dps:
+      - id: 241
+        type: integer
+        name: value
+        # Range is 1-10 based on device dump
+        range:
+          min: 1
+          max: 10
+
+  - entity: switch
+    name: Humanoid filter
+    icon: "mdi:account-alert"
+    category: config
+    # Humanoid Filter (matches humanoid_filter: 170)
+    dps:
+      - id: 170
+        type: boolean
+        name: switch
+
+  # ------------------------------------
+  # 5. Alarm Mode & Linkage
+  # ------------------------------------
+  # V2 does not support this
+
+  # ------------------------------------
+  # 6. Lights & Sirens
+  # ------------------------------------
+  # V2 does not support this
+
+  # ------------------------------------
+  # 7. SD Card and Storage
+  # ------------------------------------
+  - entity: sensor
+    name: SD capacity
+    category: diagnostic
+    icon: "mdi:micro-sd"
+    # SD Capacity Sensor (matches sd_storge: 109)
+    dps:
+      - id: 109
+        type: string
+        name: sensor
+        optional: true
+
+  - entity: sensor
+    name: SD status
+    class: enum
+    translation_key: status
+    category: diagnostic
+    icon: "mdi:micro-sd"
+    # SD Status Sensor (matches sd_status: 110)
+    dps:
+      - id: 110
+        type: integer
+        name: sensor
+        optional: true
+        mapping:
+          - dps_val: 1
+            value: normal
+          - dps_val: 2
+            value: fault
+          - dps_val: 3
+            value: full
+          - dps_val: 4
+            value: formatting
+          - dps_val: 5
+            value: missing
+          - dps_val: null
+            value: normal
+
+  - entity: button
+    name: SD format
+    category: config
+    icon: "mdi:micro-sd"
+    # SD Format Button (matches sd_format: 111) and Status (117)
+    dps:
+      - id: 111
+        type: boolean
+        name: button
+        optional: true
+        persist: false
+      - id: 117
+        type: integer
+        name: state
+        optional: true
+        persist: false
+        mapping:
+          - dps_val: -20000
+            value: Unknown
+          - dps_val: 2000
+            value: Formatting
+          - dps_val: 2001
+            value: Format failed
+          - dps_val: 2002
+            value: Card missing
+          - dps_val: 2003
+            value: Card error
+          - dps_val: null
+            value: Formatted

+ 311 - 0
custom_components/tuya_local/devices/nexsmart_air3_camera.yaml

@@ -0,0 +1,311 @@
+name: Camera
+products:
+  # The product ID (or product_id) from your device information
+  - id: vjjoayeljqpxz2oe
+    manufacturer: Nexsmart
+    model: AIR 3
+entities:
+  # ------------------------------------
+  # 1. Main Camera & Snapshot
+  # ------------------------------------
+  - entity: event
+    name: Camera
+    category: diagnostic
+    icon: "mdi:camera-burst"
+    # Snapshot trigger (matches movement_detect_pic: 115)
+    dps:
+      - id: 115
+        name: event
+        type: base64
+        optional: true
+        sensitive: true
+        mapping:
+          - dps_val: null
+            value: null
+          - value: captured
+      - id: 115
+        name: snapshot_data
+        type: base64
+        optional: true
+        sensitive: true
+  # ------------------------------------
+  # 2. Battery and Power
+  # ------------------------------------
+  - entity: sensor
+    class: battery
+    category: diagnostic
+    # Battery Level Sensor (matches wireless_electricity: 145)
+    dps:
+      - id: 145
+        type: integer
+        name: sensor
+
+  - entity: binary_sensor
+    class: battery_charging
+    # Power Mode Sensor (matches wireless_powermode: 146)
+    dps:
+      - id: 146
+        type: string
+        name: sensor
+        mapping:
+          - dps_val: "0"
+            value: false
+          - dps_val: "1"
+            value: true
+
+  - entity: binary_sensor
+    class: connectivity
+    category: diagnostic
+    # Awake/Sleep Status (matches wireless_awake: 149)
+    dps:
+      - id: 149
+        type: boolean
+        name: sensor
+
+  - entity: number
+    name: Low battery threshold
+    icon: "mdi:battery-alert-variant-outline"
+    category: config
+    # Low Battery Threshold (matches wireless_lowpower: 147)
+    dps:
+      - id: 147
+        type: integer
+        name: value
+        unit: "%"
+        # Range is 10-50 based on device dump
+        range:
+          min: 10
+          max: 50
+
+  # ------------------------------------
+  # 3. Basic Configuration
+  # ------------------------------------
+  - entity: light
+    translation_key: indicator
+    category: config
+    # Indicator LED (matches basic_indicator: 101)
+    dps:
+      - id: 101
+        type: boolean
+        name: switch
+
+  - entity: switch
+    name: Flip image
+    icon: "mdi:flip-horizontal"
+    category: config
+    # Flip Image Switch (matches basic_flip: 103)
+    dps:
+      - id: 103
+        type: boolean
+        name: switch
+
+  - entity: switch
+    name: Watermark
+    category: config
+    icon: "mdi:watermark"
+    # Watermark/OSD Switch (matches basic_osd: 104)
+    dps:
+      - id: 104
+        type: boolean
+        name: switch
+
+  - entity: select
+    name: Night vision
+    icon: "mdi:weather-night"
+    category: config
+    # Night Vision Mode Selector (matches nightvision_mode: 124)
+    dps:
+      - id: 124
+        type: string
+        name: option
+        mapping:
+          - dps_val: "auto"
+            value: Auto
+          - dps_val: "color_mode"
+            value: Color Night Vision
+          - dps_val: "ir_mode"
+            value: Infrared Night Vision
+
+  # ------------------------------------
+  # 4. Detection & Alarm
+  # ------------------------------------
+  - entity: switch
+    name: Motion detection
+    icon: "mdi:motion-sensor"
+    category: config
+    # PIR Switch (matches ipc_pir_switch: 240)
+    dps:
+      - id: 240
+        type: boolean
+        name: switch
+
+  - entity: number
+    name: Motion sensitivity
+    icon: "mdi:ruler-square"
+    category: config
+    # PIR Sensitivity (matches ipc_pir_sensitivity: 241)
+    dps:
+      - id: 241
+        type: integer
+        name: value
+        # Range is 1-10 based on device dump
+        range:
+          min: 1
+          max: 10
+
+  - entity: switch
+    name: Humanoid filter
+    icon: "mdi:account-alert"
+    category: config
+    # Humanoid Filter (matches humanoid_filter: 170)
+    dps:
+      - id: 170
+        type: boolean
+        name: switch
+
+  # ------------------------------------
+  # 5. Alarm Mode & Linkage
+  # ------------------------------------
+  - entity: select
+    name: Alarm mode
+    icon: "mdi:bell-ring-outline"
+    category: config
+    # Alarm Mode (matches alarm_mode: 243)
+    dps:
+      - id: 243
+        type: string
+        name: option
+        mapping:
+          # Mapping based on typical Tuya IPC modes
+          - dps_val: "0"
+            value: Disabled
+          - dps_val: "1"
+            value: All Day
+          - dps_val: "2"
+            value: Custom Schedule
+
+  - entity: select
+    name: Device linkage
+    icon: "mdi:link-variant"
+    category: config
+    # Device Linkage (matches linkage: 245)
+    dps:
+      - id: 245
+        type: string
+        name: option
+        mapping:
+          # Mapping based on typical Tuya IPC linkage/pre-record settings
+          - dps_val: "0"
+            value: Pre-Record Disabled
+          - dps_val: "1"
+            value: Short Pre-Record
+          - dps_val: "3"
+            value: Full Linkage/Record
+
+  # ------------------------------------
+  # 6. Lights & Sirens
+  # ------------------------------------
+  - entity: light
+    name: Floodlight
+    icon: "mdi:light-flood-down"
+    category: config
+    # Floodlight Light (matches floodlight_switch: 138)
+    dps:
+      - id: 138
+        type: boolean
+        name: switch
+
+  - entity: switch
+    name: Audible alarm
+    icon: "mdi:bell-alert"
+    category: config
+    # Audible Alarm Switch (matches ipc_audible_alarm: 242)
+    dps:
+      - id: 242
+        type: boolean
+        name: switch
+
+  - entity: siren
+    category: config
+    # Siren Switch (matches siren_switch: 159)
+    dps:
+      - id: 159
+        type: boolean
+        name: switch
+      - id: 195
+        type: integer
+        name: volume_level
+        # Range is 0-100 based on device dump
+        range:
+          min: 0
+          max: 100
+        mapping:
+          - scale: 100
+  # ------------------------------------
+  # 7. SD Card and Storage
+  # ------------------------------------
+  - entity: sensor
+    name: SD capacity
+    category: diagnostic
+    icon: "mdi:micro-sd"
+    # SD Capacity Sensor (matches sd_storge: 109)
+    dps:
+      - id: 109
+        type: string
+        name: sensor
+        optional: true
+
+  - entity: sensor
+    name: SD status
+    class: enum
+    translation_key: status
+    category: diagnostic
+    icon: "mdi:micro-sd"
+    # SD Status Sensor (matches sd_status: 110)
+    dps:
+      - id: 110
+        type: integer
+        name: sensor
+        mapping:
+          - dps_val: 1
+            value: normal
+          - dps_val: 2
+            value: fault
+          - dps_val: 3
+            value: full
+          - dps_val: 4
+            value: formatting
+          - dps_val: 5
+            value: missing
+          - dps_val: null
+            value: normal
+
+  - entity: button
+    name: SD format
+    category: config
+    icon: "mdi:micro-sd"
+    # SD Format Button (matches sd_format: 111) and Status (117)
+    dps:
+      - id: 111
+        type: boolean
+        name: button
+        optional: true
+        persist: false
+      - id: 117
+        type: integer
+        name: state
+        optional: true
+        persist: false
+        mapping:
+          - dps_val: -20000
+            value: Unknown
+          - dps_val: 2000
+            value: Formatting
+          - dps_val: 2001
+            value: Format failed
+          - dps_val: 2002
+            value: Card missing
+          - dps_val: 2003
+            value: Card error
+          - dps_val: null
+            value: Formatted

+ 315 - 0
custom_components/tuya_local/devices/nexsmart_watch2_camera.yaml

@@ -0,0 +1,315 @@
+name: Camera
+products:
+  # The product ID (or product_id) from your device information
+  - id: j0gmpjxe9pvqnsqx
+    manufacturer: Nexsmart
+    model: WATCH 2
+entities:
+  # ------------------------------------
+  # 1. Main Camera & Snapshot
+  # ------------------------------------
+  - entity: switch
+    name: Motion detection
+    icon: "mdi:motion-sensor"
+    category: config
+    # Motion Detection Switch (matches motion_switch: 134)
+    dps:
+      - id: 134
+        name: switch
+        type: boolean
+        optional: true
+
+  - entity: switch
+    name: SD card recording
+    icon: "mdi:video-outline"
+    category: config
+    # Recording Switch (matches record_switch: 150)
+    dps:
+      - id: 150
+        name: switch
+        type: boolean
+        optional: true
+  - entity: event
+    name: Camera
+    category: diagnostic
+    icon: "mdi:camera-burst"
+    # Snapshot trigger (matches movement_detect_pic: 115)
+    dps:
+      - id: 115
+        name: event
+        type: base64
+        optional: true
+        sensitive: true
+        mapping:
+          - dps_val: null
+            value: null
+          - value: captured
+      - id: 115
+        name: snapshot_data
+        type: base64
+        optional: true
+        sensitive: true
+  # ------------------------------------
+  # 2. Battery and Power
+  # ------------------------------------
+  # WIRED Camera so no "battery" sensors are present!
+
+  # ------------------------------------
+  # 3. Basic Configuration
+  # ------------------------------------
+
+  - entity: light
+    translation_key: indicator
+    category: config
+    # Basic Indicator (matches basic_indicator: 101)
+    dps:
+      - id: 101
+        type: boolean
+        name: switch
+
+  - entity: switch
+    name: Flip image
+    icon: "mdi:flip-horizontal"
+    category: config
+    # Flip Image Switch (matches basic_flip: 103)
+    dps:
+      - id: 103
+        type: boolean
+        name: switch
+
+  - entity: switch
+    name: Watermark
+    icon: "mdi:watermark"
+    category: config
+    # Watermark/OSD Switch (matches basic_osd: 104)
+    dps:
+      - id: 104
+        type: boolean
+        name: switch
+        optional: true
+
+  - entity: select
+    name: Night vision
+    icon: "mdi:weather-night"
+    category: config
+    # Night Vision Mode Selector (matches basic_nightvision: 108)
+    dps:
+      - id: 108
+        type: string
+        name: option
+        optional: true
+        mapping:
+          - dps_val: "0"
+            value: Auto
+          - dps_val: "1"
+            value: "Off"
+          - dps_val: "2"
+            value: "On"
+
+  # ------------------------------------
+  # 4. Detection & Alarm
+  # ------------------------------------
+  - entity: select
+    name: Motion sensitivity
+    icon: "mdi:motion-sensor"
+    category: config
+    # Motion Sensitivity Selector (matches motion_sensitivity: 106)
+    dps:
+      - id: 106
+        type: string
+        name: option
+        optional: true
+        mapping:
+          - dps_val: "0"
+            value: Low
+          - dps_val: "1"
+            value: Medium
+          - dps_val: "2"
+            value: High
+
+  - entity: switch
+    name: Motion alarm area
+    icon: "mdi:crop"
+    category: config
+    # Motion Area Switch (matches motion_area_switch: 168)
+    dps:
+      - id: 168
+        type: boolean
+        name: switch
+        optional: true
+
+  - entity: text
+    name: Motion alarm area
+    icon: "mdi:crop"
+    category: config
+    hidden: true
+    # Motion Area String Data (matches motion_area: 169)
+    dps:
+      - id: 169
+        type: base64
+        name: value
+        optional: true
+
+  - entity: switch
+    name: Sound detection
+    category: config
+    icon: "mdi:ear-hearing"
+    # Decibel Switch (matches decibel_switch: 139)
+    dps:
+      - id: 139
+        type: boolean
+        name: switch
+        optional: true
+      # Decibel Upload Data (matches decibel_upload: 141)
+      - id: 141
+        type: string
+        name: upload_timestamp
+        optional: true
+
+  - entity: select
+    name: Sound sensitivity
+    icon: "mdi:ear-hearing"
+    category: config
+    # Decibel Sensitivity Selector (matches decibel_sensitivity: 140)
+    dps:
+      - id: 140
+        type: string
+        name: option
+        mapping:
+          - dps_val: "0"
+            value: Low
+          - dps_val: "1"
+            value: High
+
+  # ------------------------------------
+  # 5. Alarm Mode & Linkage
+  # ------------------------------------
+  # Does not exist in V2
+
+  # ------------------------------------
+  # 6. Lights & Sirens
+  # ------------------------------------
+  # Does not exist in V2
+
+  # ------------------------------------
+  # 7. SD Card and Storage
+  # ------------------------------------
+  - entity: sensor
+    name: SD capacity
+    category: diagnostic
+    icon: "mdi:micro-sd"
+    # SD Capacity Sensor (matches sd_storge: 109)
+    dps:
+      - id: 109
+        type: string
+        name: sensor
+        optional: true
+
+  - entity: sensor
+    name: SD status
+    class: enum
+    category: diagnostic
+    icon: "mdi:micro-sd"
+    # SD Status Sensor (matches sd_status: 110)
+    dps:
+      - id: 110
+        type: integer
+        name: sensor
+        optional: true
+        mapping:
+          - dps_val: 1
+            value: normal
+          - dps_val: 2
+            value: fault
+          - dps_val: 3
+            value: full
+          - dps_val: 4
+            value: formatting
+          - dps_val: 5
+            value: missing
+          - dps_val: null
+            value: normal
+
+  - entity: button
+    name: SD format
+    category: config
+    icon: "mdi:micro-sd"
+    # SD Format Button (matches sd_format: 111) and Status (117)
+    dps:
+      - id: 111
+        type: boolean
+        name: button
+        optional: true
+        persist: false
+      - id: 117
+        type: integer
+        name: state
+        optional: true
+        persist: false
+        mapping:
+          - dps_val: 0
+            value: Ready
+          - dps_val: 2000
+            value: Formatting
+          - dps_val: 2001
+            value: Format failed
+          - dps_val: 2002
+            value: Card missing
+          - dps_val: 2003
+            value: Card error
+          - dps_val: null
+            value: Formatted
+
+  - entity: select
+    name: Recording mode
+    icon: "mdi:file-video"
+    category: config
+    # Recording Mode Selector (matches record_mode: 151)
+    dps:
+      - id: 151
+        type: string
+        name: option
+        optional: true
+        mapping:
+          - dps_val: "1"
+            value: Event
+          - dps_val: "2"
+            value: Continuous
+
+  # ------------------------------------
+  # 8. Advanced / ONVIF
+  # ------------------------------------
+  - entity: switch
+    name: ONVIF stream
+    category: config
+    # ONVIF Switch (matches onvif_switch: 255)
+    dps:
+      - id: 255
+        type: boolean
+        name: switch
+        optional: true
+
+  - entity: sensor
+    name: ONVIF IP address
+    category: diagnostic
+    icon: "mdi:ip-network"
+    # ONVIF IP Address (matches onvif_ip_addr: 254)
+    dps:
+      - id: 254
+        type: string
+        name: sensor
+        sensitive: true
+        optional: true
+
+  - entity: text
+    name: ONVIF password change
+    category: config
+    icon: "mdi:lock-reset"
+    hidden: true
+    # ONVIF Password Change (matches onvif_change_pwd: 253)
+    dps:
+      - id: 253
+        type: string
+        name: value
+        sensitive: true
+        optional: true