Xiaomi Dafang

Интеграция с OpenHAB

https://community.openhab.org/t/how-to-configure-a-hacked-xiaomi-dafang-to-work-with-openhab/51121/13

.thing

Bridge mqtt:broker:mosquitto "Mosquitto" [ host="localhost", port=1883, secure=false, username="USERNAME", password="PASSWORD", clientID="openHAB2" ]
{
    // Xiaomi Dafang
    Thing topic somecamera "Some Camera" @ "Some Room" {
    Channels:
        Type string : system         "System"               [ commandTopic="home/dafang/set" ]
        Type string : vertical       "Vertical"             [ commandTopic="home/dafang/motors/vertical/set" ]
        Type string : horizontal     "Horizonzal"           [ commandTopic="home/dafang/motors/horizontal/set" ]
        Type switch : irleds         "IR LEDs"              [ stateTopic="home/dafang/leds/ir", commandTopic="home/dafang/leds/ir/set" ]
        Type switch : ircutoff       "IR Cut-Off Filter"    [ stateTopic="home/dafang/ir_cut", commandTopic="home/dafang/ir_cut/set" ]
        Type switch : nightauto      "Night Mode Auto"      [ stateTopic="home/dafang/night_mode/auto", commandTopic="home/dafang/night_mode/auto/set" ]
        Type switch : blueled        "Blue LED"             [ stateTopic="home/dafang/leds/blue", commandTopic="home/dafang/leds/blue/set" ]
        Type switch : yellowled      "Yellow LED"           [ stateTopic="home/dafang/leds/yellow", commandTopic="home/dafang/leds/yellow/set" ]
        Type switch : motion         "Motion Detection"     [ stateTopic="home/dafang/motion/detection", commandTopic="home/dafang/motion/detection/set" ]
        Type switch : rtsph264       "RTSP H264 Server"     [ stateTopic="home/dafang/rtsp_h264_server", commandTopic="home/dafang/rtsp_h264_server/set" ]
        Type switch : rtspmjpeg      "RTSP MJPEG Server"    [ stateTopic="home/dafang/rtsp_mjpeg_server", commandTopic="home/dafang/rtsp_mjpeg_server/set" ]
        Type switch : motiontrack    "Motion Tracking"      [ stateTopic="home/dafang/motion/tracking", commandTopic="home/dafang/motion/tracking/set" ]
        Type switch : motionmail     "Motion Send Mail"     [ stateTopic="home/dafang/motion/send_mail", commandTopic="home/dafang/motion/send_mail/set" ]  
        Type string : motionled      "Motion LED"           [ commandTopic="home/dafang/set" ]
        Type string : motionsnapshot "Motion Snapshot"      [ commandTopic="home/dafang/set" ]
        Type image  : motionimage    "Motion Image"         [ stateTopic="home/dafang/motion/snapshot/image" ]
        Type string : motionmqtt     "Motion MQTT"          [ commandTopic="home/dafang/set" ]
        Type number : brightness     "Brightness"           [ stateTopic="home/dafang/brightness" ]    
        Type switch : nightmode      "Night Mode"           [ stateTopic="home/dafang/night_mode", commandTopic="home/dafang/night_mode/set" ]
        Type string : audiotest      "Audio Test"           [ commandTopic="home/dafang/set" ]
        Type string : flipimage      "Flip Image"           [ commandTopic="home/dafang/set" ]
        Type string : calibrate      "Calibrate Motor"      [ commandTopic="home/dafang/set" ]
        Type string : uptime         "Uptime"               [ stateTopic="home/dafang", transformationPattern="JSONPATH:$.uptime" ]
        Type string : ssid           "WiFi SSID"            [ stateTopic="home/dafang", transformationPattern="JSONPATH:$.ssid" ]
        Type string : bitrate        "WiFi Bitrate"         [ stateTopic="home/dafang", transformationPattern="JSONPATH:$.bitrate" ]
        Type string : rssi           "WiFi Signal Strength" [ stateTopic="home/dafang", transformationPattern="JSONPATH:$.signal_level" ]
        Type string : linkquality    "WiFi Link Quality"    [ stateTopic="home/dafang", transformationPattern="JSONPATH:$.link_quality" ]
        Type string : noiselevel     "Noise Level"          [ stateTopic="home/dafang", transformationPattern="JSONPATH:$.noise_level" ]
    }
}

UID: mqtt:topic:mqtt:df3
label: DF3
thingTypeUID: mqtt:topic
configuration: {}
bridgeUID: mqtt:broker:mqtt
channels:
  - id: system
    channelTypeUID: mqtt:string
    label: System
    description: ""
    configuration:
      commandTopic: home/dafang/set
  - id: vertical
    channelTypeUID: mqtt:rollershutter
    label: Vertical
    description: ""
    configuration:
      commandTopic: home/dafang/motors/vertical/set
  - id: horizontal
    channelTypeUID: mqtt:rollershutter
    label: Horizontal
    description: null
    configuration:
      commandTopic: home/dafang/motors/horizontal/set
  - id: irleds
    channelTypeUID: mqtt:switch
    label: IR LEDs
    description: ""
    configuration:
      commandTopic: home/dafang/leds/ir/set
      stateTopic: home/dafang/leds/ir
  - id: ircutoff
    channelTypeUID: mqtt:switch
    label: IR Cut-Off Filter
    description: null
    configuration:
      commandTopic: home/dafang/ir_cut/set
      stateTopic: home/dafang/ir_cut
  - id: nightauto
    channelTypeUID: mqtt:switch
    label: Night Mode Auto
    description: null
    configuration:
      commandTopic: home/dafang/night_mode/auto/set
      stateTopic: home/dafang/night_mode/auto
  - id: blueled
    channelTypeUID: mqtt:switch
    label: Blue LED
    description: null
    configuration:
      commandTopic: home/dafang/leds/blue/set
      stateTopic: home/dafang/leds/blue
  - id: yellowled
    channelTypeUID: mqtt:switch
    label: Yellow LED
    description: null
    configuration:
      commandTopic: home/dafang/leds/yellow/set
      stateTopic: home/dafang/leds/yellow
  - id: motion
    channelTypeUID: mqtt:switch
    label: Motion Detection
    description: null
    configuration:
      commandTopic: home/dafang/motion/detection/set
      stateTopic: home/dafang/motion/detection
  - id: rtsph264
    channelTypeUID: mqtt:switch
    label: RTSP H264 Server
    description: null
    configuration:
      commandTopic: home/dafang/rtsp_h264_server/set
      stateTopic: home/dafang/rtsp_h264_server
  - id: rtspmjpeg
    channelTypeUID: mqtt:switch
    label: RTSP MJPEG Server
    description: ""
    configuration:
      commandTopic: home/dafang/rtsp_mjpeg_server/set
      stateTopic: home/dafang/rtsp_mjpeg_server
  - id: motiontrack
    channelTypeUID: mqtt:switch
    label: Motion Tracking
    description: ""
    configuration:
      commandTopic: home/dafang/motion/tracking/set
      stateTopic: home/dafang/motion/tracking
  - id: motionmail
    channelTypeUID: mqtt:switch
    label: Motion Send Mail
    description: ""
    configuration:
      commandTopic: home/dafang/motion/send_mail/set
      stateTopic: home/dafang/motion/send_mail
  - id: motiontelegram
    channelTypeUID: mqtt:switch
    label: Motion Send Telegram
    description: null
    configuration:
      commandTopic: home/dafang/motion/send_telegram/set
      stateTopic: home/dafang/motion/send_telegram
  - id: motionled
    channelTypeUID: mqtt:string
    label: Motion LED
    description: ""
    configuration:
      commandTopic: home/dafang/set
  - id: motionsnapshot
    channelTypeUID: mqtt:string
    label: Motion Snapshot
    description: ""
    configuration:
      commandTopic: home/dafang/set
  - id: motionimage
    channelTypeUID: mqtt:image
    label: Motion Image
    description: ""
    configuration:
      stateTopic: home/dafang/motion/snapshot/image
  - id: motionmqtt
    channelTypeUID: mqtt:string
    label: Motion MQTT
    description: ""
    configuration:
      commandTopic: home/dafang/set
  - id: brightness
    channelTypeUID: mqtt:number
    label: Brightness
    description: ""
    configuration:
      stateTopic: home/dafang/brightness
  - id: nightmode
    channelTypeUID: mqtt:switch
    label: Night Mode
    description: ""
    configuration:
      commandTopic: home/dafang/night_mode/set
      stateTopic: home/dafang/night_mode
  - id: audiotest
    channelTypeUID: mqtt:string
    label: Audio Test
    description: ""
    configuration:
      commandTopic: home/dafang/set
  - id: flipimage
    channelTypeUID: mqtt:string
    label: Flip Image
    description: ""
    configuration:
      commandTopic: home/dafang/set
  - id: calibrate
    channelTypeUID: mqtt:string
    label: Calibrate Motor
    description: ""
    configuration:
      commandTopic: home/dafang/set
  - id: uptime
    channelTypeUID: mqtt:string
    label: Uptime
    description: ""
    configuration:
      stateTopic: home/dafang
      transformationPattern: JSONPATH:$.uptime
  - id: ssid
    channelTypeUID: mqtt:string
    label: WiFi SSID
    description: null
    configuration:
      stateTopic: home/dafang
      transformationPattern: JSONPATH:$.ssid
  - id: bitrate
    channelTypeUID: mqtt:string
    label: WiFi Bitrate
    description: null
    configuration:
      stateTopic: home/dafang
      transformationPattern: JSONPATH:$.bitrate
  - id: rssi
    channelTypeUID: mqtt:string
    label: WiFi Signal Strength
    description: null
    configuration:
      stateTopic: home/dafang
      transformationPattern: JSONPATH:$.signal_level
  - id: linkquality
    channelTypeUID: mqtt:string
    label: WiFi Link Quality
    description: null
    configuration:
      stateTopic: home/dafang
      transformationPattern: JSONPATH:$.link_quality
  - id: noiselevel
    channelTypeUID: mqtt:string
    label: WiFi Noise Level
    description: null
    configuration:
      stateTopic: home/dafang
      transformationPattern: JSONPATH:$.noise_level

https://10.44.1.12/cgi-bin/currentpic.cgi

save_snapshot=true
publish_mqtt_message=true

.items

// Xiaomi Dafang
Group  g1F_Cam01               "Cam 01"                    <dafang>           (Cameras, Xiaomi)

String Cam01_System            "System"                    <dafang>           (g1F_Cam01) { channel="mqtt:topic:mqtt:df3:system", autoupdate="false"}
Rollershutter Cam01_Vertical          "Vertical"                  <vertical>         (g1F_Cam01) { channel="mqtt:topic:mqtt:df3:vertical", autoupdate="false"}
Rollershutter Cam01_Horizontal        "Horizonzal"                <horizontal>       (g1F_Cam01) { channel="mqtt:topic:mqtt:df3:horizonzal", autoupdate="false"}

Switch Cam01_IR_LEDs           "IR LEDs [%s]"              <led_purple>       (g1F_Cam01) { channel="mqtt:topic:mqtt:df3:irleds" }
Switch Cam01_IR_CutOff         "IR Cut-Off Filter [%s]"    <led_purple>       (g1F_Cam01) { channel="mqtt:topic:mqtt:df3:ircutoff" }
Switch Cam01_Night_Mode_Auto   "Night Mode Auto [%s]"      <scene>            (g1F_Cam01) { channel="mqtt:topic:mqtt:df3:nightauto" }
Switch Cam01_Blue_LED          "Blue LED [%s]"             <led_blue>         (g1F_Cam01) { channel="mqtt:topic:mqtt:df3:blueled" }        
Switch Cam01_Yellow_LED        "Yellow LED [%s]"           <led_yellow>       (g1F_Cam01) { channel="mqtt:topic:mqtt:df3:yellowled" }
Switch Cam01_Motion_Detection  "Motion Detection [%s]"     <motion_detection> (g1F_Cam01) { channel="mqtt:topic:mqtt:df3:motion" }
Switch Cam01_RTSP_H264_Server  "RTSP H264 Server [%s]"     <h264>             (g1F_Cam01) { channel="mqtt:topic:mqtt:df3:rtsph264" }
Switch Cam01_RTSP_MJPEG_Server "RTSP MJEPG Server [%s]"    <mjpeg>            (g1F_Cam01) { channel="mqtt:topic:mqtt:df3:rtspmjpeg" }
Switch Cam01_Motion_Send_Mail  "Motion Send Mail [%s]"     <gmail>            (g1F_Cam01) { channel="mqtt:topic:mqtt:df3:motionmail" }
Switch Cam01_Motion_Send_Telegram  "Motion Send Telegram [%s]"     <telegram>            (g1F_Cam01) { channel="mqtt:topic:mqtt:df3:motiontelegram" }
String Cam01_Motion_LED        "Motion LED"                <led_yellow>       (g1F_Cam01) { channel="mqtt:topic:mqtt:df3:motionled" }
String Cam01_Motion_Snapshot   "Motion Snapshot"           <snapshot>         (g1F_Cam01) { channel="mqtt:topic:mqtt:df3:motionsnapshot" }
String Cam01_Motion_MQTT       "Motion MQTT"               <mqtt>             (g1F_Cam01) { channel="mqtt:topic:mqtt:df3:motionmqtt" }
Number Cam01_Brightness        "Brightness [%s]"           <brightness>       (g1F_Cam01) { channel="mqtt:topic:mqtt:df3:brightness" }
Switch Cam01_Night_Mode        "Night Mode [%s]"           <night>            (g1F_Cam01) { channel="mqtt:topic:mqtt:df3:nightmode" }
Switch Cam01_Motion_Tracking   "Motion Tracking [%s]"      <motion_tracking>  (g1F_Cam01) { channel="mqtt:topic:mqtt:df3:motiontrack" }
String Cam01_Audio_Test        "Audio Test"                <audio>            (g1F_Cam01) { channel="mqtt:topic:mqtt:df3:audiotest", autoupdate="false"}
String Cam01_Flip_Image        "Flip Image"                <flip>             (g1F_Cam01) { channel="mqtt:topic:mqtt:df3:flipimage", autoupdate="false"}
String Cam01_Calibrate         "Calibrate Motor"           <calibrate>        (g1F_Cam01) { channel="mqtt:topic:mqtt:df3:calibrate", autoupdate="false"}
String Cam01_Calibrate_Axis    "Calibrate Motor Axis"      <calibrate>        (g1F_Cam01) { channel="mqtt:topic:mqtt:df3:calibrate", autoupdate="false"}

String Cam01_Uptime            "Uptime [%s]"               <none>             (g1F_Cam01) { channel="mqtt:topic:mqtt:df3:uptime" }
String Cam01_SSID              "WiFi SSID [%s]"            <wifi>             (g1F_Cam01) { channel="mqtt:topic:mqtt:df3:ssid" }
String Cam01_BitRate           "WiFi Bitrate [%s]"         <wifi>             (g1F_Cam01) { channel="mqtt:topic:mqtt:df3:bitrate" }
String Cam01_RSSI              "WiFi Signal Strength [%s]" <wifi>             (g1F_Cam01) { channel="mqtt:topic:mqtt:df3:rssi" }
String Cam01_Link_Quality      "WiFi Link Quality [%s]"    <wifi>             (g1F_Cam01) { channel="mqtt:topic:mqtt:df3:linkquality" }
String Cam01_Noise             "WiFi Noise Level [%s]"     <none>             (g1F_Cam01) { channel="mqtt:topic:mqtt:df3:noiselevel" }

Image  Cam01_Motion_Image      "Motion Image"              <snapshot>         (g1F_Cam01) {channel="mqtt:topic:mqtt:df3:motionimage"}