Unifi G3 Flex with Monocle Gateway



  • I’ve tried to get the Monocle Gateway working with my G3 Flex, but I can’t seem to get it to connect.

    • Unifi G3 Flex Camera (no local auth required)
    • Unifi CloudKey v2
    • Mac Mini running Monocle Gateway (tried @proxy and @tunnel, no success)

    Monocle Dashboard config (some info redacted):

      {
        "timestamp": "2019-08-26T13:01:05.987Z",
        "request": "InitializeCameraStreams",
        "response": [
          {
            "uri": "rtsp://192.168.1.20:7447/redacted",
            "proxy": "rtsp://proxy.monoclecam.com:443/d9cb3c53-4bbf-4e86-a088-redacted",
            "resolution": {
              "width": "1024",
              "height": "576"
            },
            "authorizationType": "NONE",
            "videoCodec": "H264",
            "audioCodec": "AAC",
            "protocol": "RTSP"
          }
        ]
      },
    

    And the connection logged (some info redacted):

    -------------------------------------------------
    INITIALIZE RTSP STREAM:  Garage Inside
    -------------------------------------------------
     - NAME  : Garage Inside
     - LABEL : PRIMARY
     - URL   : rtsp://192.168.1.20:7447/redacted
     - UUID  : STREAM:58a7aa9b-789c-47b8-8b78-redacted
     - SESS  : 809d17c3-078d-448c-a0f8-redacted
     - MODIF : Mon Aug 26 2019 08:02:25 GMT-0500 (CDT)
     - TAGS  : @proxy
    -------------------------------------------------
    
    2019-08-26T13:23:05.638Z [INFO]  [RTSP PROXY] REGISTERING STREAM [Garage Inside/PRIMARY]; (STREAM:58a7aa9b-789c-47b8-8b78-redacted)
    2019-08-26T13:23:05.642Z [DEBUG] <RTSP-PROXY> [REQUEST]  --> [REGISTER] rtsp://192.168.1.20:7447/redacted
    2019-08-26T13:23:05.642Z [TRACE] <RTSP-PROXY> [REQUEST]  --> [HEADERS] {
      "cseq": "1",
      "transport": "reuse_connection=0;preferred_delivery_protocol=udp;proxy_url_suffix=STREAM:58a7aa9b-789c-47b8-8b78-redacted"
    }
    2019-08-26T13:23:05.642Z [DEBUG] <RTSP-PROXY> [RESPONSE] <-- [200 (OK)] <cseq=1> (session=undefined)
    2019-08-26T13:23:05.643Z [TRACE] <RTSP-PROXY> [RESPONSE] <-- [HEADERS] {
      "cseq": "1",
      "date": "Mon, Aug 26 2019 13:23:05 GMT"
    }
    
    -------------------------------------------------
    INITIALIZE RTSP STREAM:  Garage Inside
    -------------------------------------------------
     - NAME  : Garage Inside
     - LABEL : PRIMARY
     - URL   : rtsp://192.168.1.20:7447/5FCL2gfTky4DaC2H
     - UUID  : STREAM:58a7aa9b-789c-47b8-8b78-redacted
     - SESS  : d9bd8edd-6e79-47d7-a947-redacted
     - MODIF : Mon Aug 26 2019 08:02:25 GMT-0500 (CDT)
     - TAGS  : @proxy
    -------------------------------------------------
    

    Monocle Gateway configuration file:

    • Had to change rtsp.ssl.port due to port conflict
    artemis:monocle erikankrom$ cat monocle.properties 
    # ******************************************************************
    # *             __  __  ___  _  _  ___   ___ _    ___              *
    # *            |  \/  |/ _ \| \| |/ _ \ / __| |  | __|             *
    # *            | |\/| | (_) | .` | (_) | (__| |__| _|              *
    # *            |_|  |_|\___/|_|\_|\___/ \___|____|___|             *
    # *                                                                *
    # ******************************************************************
    # *               MONOCLE GATEWAY CONFIGURATION FILE               *
    # ******************************************************************
    
    #--------------------------------------
    # RTSP SERVICE PROPERTIES
    #--------------------------------------
    #rtsp.host=0.0.0.0
    #rtsp.port=8555
    rtsp.ssl.port=9443
    
    #--------------------------------------
    # RTSP PROXY PROPERTIES
    #--------------------------------------
    #rtsp.proxy.port=8554
    #rtsp.proxy.expire_minutes=10
    #rtsp.proxy.debug=false
    #rtsp.proxy.verbose=false
    #rtsp.proxy.log=false
    
    #--------------------------------------
    # RTSP SERVICE REGISTRATION OVERRIDES
    #--------------------------------------
    #rtsp.register.fqdn=
    #rtsp.register.host=
    #rtsp.register.port=443
    
    #--------------------------------------
    # RTSP SSL CERTIFICATE & PRIVATE KEY
    #--------------------------------------
    #rtsp.ssl.cert=ssl-cert.pem
    #rtsp.ssl.key=ssl-key.pem
    

    Monocle Gateway startup output:

    artemis:monocle erikankrom$ ./monocle-gateway 
    
     ******************************************************************
     *             __  __  ___  _  _  ___   ___ _    ___              *
     *            |  \/  |/ _ \| \| |/ _ \ / __| |  | __|             *
     *            | |\/| | (_) | .` | (_) | (__| |__| _|              *
     *            |_|  |_|\___/|_|\_|\___/ \___|____|___|             *
     *                                                                *
     ******************************************************************
    
    
    -------------------------------------------------
    MONOCLE RUNTIME ENVIRONMENT
    -------------------------------------------------
    VERSION   = 0.0.4
    OS/ARCH   = darwin/x64
    PROCESS   = monocle-gateway (PID=71738)
    TIMESTAMP = 2019-08-26T01:24:29.046Z
    
    -------------------------------------------------
    MONOCLE GATEWAY SERVICE         (Version: 0.0.4)
    -------------------------------------------------
    [Monocle Starting]
    [Monocle Connecting]
    [Monocle Started]
    [RTSP Server Starting]
    [RTSP Server Listening] 0.0.0.0:8555 (RTSP)
    [RTSP Server Listening] 0.0.0.0:9443 (RTSP-TLS)
    [RTSP Proxy Started] (PID=71739)
    [RTSP Server Listening] 0.0.0.0:8554 (PROXY)
    [RTSP Server Started]
    [Monocle Connected]
    [RTSP Server Registered]
    
    -------------------------------------------------
    MONOCLE RTSP SERVICE - INITIALIZED
    -------------------------------------------------
    FQDN = 834785ed-8ba4-4bcd-8849-redacted.mproxy.io
    HOST = 192.168.1.50
    PORT = 443
    -------------------------------------------------
    

    Result:

    Alexa responds with “Hmm, the camera isn’t responding” after attempting 3 times to connect.

    Next Thoughts:

    I’m thinking the proxy is unable to get back into my network, so I would need to create a custom hostname for RTSP service registration that corresponds to my DDNS external hostname, and my external port that translates to internal port hosting the service on the Mac?

    Question:

    Have others been able to get this to work without needing a Gateway?



  • Hi @erikankrom
    Only just noticed your post.
    Your setup should work - I’m running 2 x G3 Flex and 2 x G3 Micros via my Monocle Gateway and they all stream fine to my Alexa devices - Spot, Fire Tablet & Show 5 .
    I’m tied up this week, but will make time at the weekend to post my configs.
    Two quick thoughts:

    • Can you prove that the Gateway is streaming correctly by pointing VLC at the stream - if that works then the issue is likely some non-compatible-with-Alexa setting. See below.
    • I remember reading somewhere that Alexa Streaming devices only like 1080p feeds - the res in your config reads as 1024x576, for 1080p it should be 1920 x 1080 - The Flex’s are capable of supporting this, so could this be the issue?


  • @autodrivel Thanks, a quick config comparison would help tremendously.



  • @erikankrom

    I realize there is a nice setting that suggests changing the HHTPS/SSL port would be OK. Unfortunately its not. Amazon has a security rule where their devices will only connect on port 443. Literally 4-4-3 only. I know it’s a stupid rule – I mean there is a valid SSL certificate and all, why they hardcode to port 443 if beyond me.

    So you might need to move the gateway somewhere where it can run and use port 443. Port 443 does not need to be exposed to the Internet. It’s only for Alexa devices on your local network to connect to the Monocle Gateway all inside your LAN.

    I think other Unifi users have been able to get it to work without the gateway. I don’t have any Unifi cameras to test with, so I can’t personally confirm this. However, there was a long forum thread on Ubiquiti’s forum asking for Alexa support and I know several users posted there with success stories using Monocle.

    Which Alexa devices are you trying to use? Some like the Echo Show 5 definitely require the Monocle Gateway.

    Thanks



  • Is your CK-G2 Plus actually running with an IP of 192.168.1.20? That’s the usual Ubiquiti default fallback IP address. Or, are you running your G3 Flex standalone with no Protect/Unifi Video NVR?



  • I got my UVC G3 Flex work using the gateway, but only one cam shows.
    How do you get all the cams that you have to show?
    They are all added.
    I see this:

    INITIALIZE RTSP STREAM: Front Yard

    • NAME : Front Yard
    • LABEL : PRIMARY
      Thank you


  • @Spider03 If they’re all added in your Monocle profile, did you also ‘Discover’ them at alexa.amazon.com under Smart Home, Devices, Discover?



  • @flptrnkng Well Damn lol. That was it all cams are now showing.
    Thank you flptmkng. Spend so much time on getting this to work that I over looked the small things.



  • @Spider03 It has bitten me before…


Log in to reply